added loginfo stuff
[spider.git] / perl / DXMsg.pm
index b2665df8f0a6cf5786782e1f85035e93b3d91723..a3c0798e73f948cfcebdf74665da8b069dc243fd 100644 (file)
@@ -43,8 +43,8 @@ $maxage = 30 * 86400;                 # the maximum age that a message shall live for if not m
 $last_clean = 0;                               # last time we did a clean
 @forward = ();                  # msg forward table
 $timeout = 30*60;               # forwarding timeout
-$waittime = 60*60;              # time an aborted outgoing message waits before trying again
-$queueinterval = 2*60;          # run the queue every 2 minutes
+$waittime = 30*60;              # time an aborted outgoing message waits before trying again
+$queueinterval = 1*60;          # run the queue every 1 minute
 $lastq = 0;
 
 
@@ -130,21 +130,22 @@ sub process
        # this is periodic processing
        if (!$self || !$line) {
 
-               # wander down the work queue stopping any messages that have timed out
-               for (keys %busy) {
-                       my $node = $_;
-                       my $ref = $busy{$_};
-                       if (exists $ref->{lastt} && $main::systime > $ref->{lastt} + $timeout) {
-                               dbg('msg', "Timeout, stopping msgno: $ref->{msgno} -> $node");
-                               $ref->stop_msg($node);
+               if ($main::systime > $lastq + $queueinterval) {
 
-                               # delay any outgoing messages that fail
-                               $ref->{waitt} = $main::systime + $waittime + rand(120) if $node ne $main::mycall;
+                       # wander down the work queue stopping any messages that have timed out
+                       for (keys %busy) {
+                               my $node = $_;
+                               my $ref = $busy{$_};
+                               if (exists $ref->{lastt} && $main::systime >= $ref->{lastt} + $timeout) {
+                                       dbg('msg', "Timeout, stopping msgno: $ref->{msgno} -> $node");
+                                       $ref->stop_msg($node);
+                                       
+                                       # delay any outgoing messages that fail
+                                       $ref->{waitt} = $main::systime + $waittime + rand(120) if $node ne $main::mycall;
+                               }
                        }
-               }
 
-               # queue some message if the interval timer has gone off
-               if ($main::systime > $lastq + $queueinterval) {
+                       # queue some message if the interval timer has gone off
                        queue_msg(0);
                        $lastq = $main::systime;
                }
@@ -367,7 +368,6 @@ sub process
                                $ref->stop_msg($self->call);
                                $ref = undef;
                        }
-                       
                        last SWITCH;
                }
 
@@ -575,7 +575,7 @@ sub queue_msg
        my $call = shift;
        my $ref;
        my $clref;
-       my @nodelist = DXProt::get_all_ak1a();
+       my @nodelist = DXChannel::get_all_ak1a();
        
        # bat down the message list looking for one that needs to go off site and whose
        # nearest node is not busy.
@@ -824,7 +824,7 @@ sub do_send_stuff
        } elsif ($self->state eq 'sendbody') {
                confess "local var gone missing" if !ref $self->{loc};
                my $loc = $self->{loc};
-               if ($line eq "\032" || uc $line eq "/EX") {
+               if ($line eq "\032" || $line eq '%1A' || uc $line eq "/EX") {
                        my $to;
                        
                        if (@{$loc->{lines}} > 0) {
@@ -889,8 +889,11 @@ sub dir
 sub load_forward
 {
        my @out;
-       do "$forwardfn" if -e "$forwardfn";
-       push @out, $@ if $@;
+       my $s = readfilestr($forwardfn);
+       if ($s) {
+               eval $s;
+               push @out, $@ if $@;
+       }
        return @out;
 }
 
@@ -898,8 +901,11 @@ sub load_forward
 sub load_badmsg
 {
        my @out;
-       do "$badmsgfn" if -e "$badmsgfn";
-       push @out, $@ if $@;
+       my $s = readfilestr($badmsgfn);
+       if ($s) {
+               eval $s;
+               push @out, $@ if $@;
+       }
        return @out;
 }