X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXMsg.pm;h=98c41ef1d7f935f899f2688a6aca1b06f1a1c195;hb=6ea05be3ca5b4857bb319782c408d5784658ec20;hp=b2665df8f0a6cf5786782e1f85035e93b3d91723;hpb=e76e5e7e943c5af1d984ec60ad80524424420fa2;p=spider.git diff --git a/perl/DXMsg.pm b/perl/DXMsg.pm index b2665df8..98c41ef1 100644 --- a/perl/DXMsg.pm +++ b/perl/DXMsg.pm @@ -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; } @@ -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; }