added some anti thrash code for crossing messages
[spider.git] / perl / DXMsg.pm
index 146392f44f970a83eb269167c1590a29b71cb414..75b88abc8e450f3fb4934bd0dcae5e14cda262a0 100644 (file)
@@ -130,11 +130,11 @@ sub process
                for (keys %busy) {
                        my $node = $_;
                        my $ref = $busy{$_};
-                       if ($main::systime > $ref->{lastt} + $timeout) {
+                       if (exists $ref->{lastt} && $main::systime > $ref->{lastt} + $timeout) {
                                $ref->stop_msg($node);
 
                                # delay any outgoing messages that fail
-                               $ref->{waitt} = $main::systime + $waittime if $node ne $main::mycall;
+                               $ref->{waitt} = $main::systime + $waittime + rand(120) if $node ne $main::mycall;
                        }
                }
                
@@ -273,7 +273,7 @@ sub process
                        } else {
                                $self->send(DXProt::pc42($f[2], $f[1], $f[3])); # unknown stream
                        }
-                       queue_msg(0);
+                       queue_msg(0);
                        last SWITCH;
                }