X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FAGWMsg.pm;h=6afcbcba18416aac52cee63e5d10b605edd4c09b;hb=3362e8773892a409a7b6193eeaeaa9ed1e186e09;hp=9a39874cc7d4c6030547b35134861f3dc20623e6;hpb=e9a4c82122720cd66da440e4ff6f88aaded8e146;p=spider.git diff --git a/perl/AGWMsg.pm b/perl/AGWMsg.pm index 9a39874c..6afcbcba 100644 --- a/perl/AGWMsg.pm +++ b/perl/AGWMsg.pm @@ -41,7 +41,7 @@ $rproc = undef; $noports = 0; $lastytime = $lasthtime = time; $ypolltime = 10 unless defined $ypolltime; -$hpolltime = 120 unless defined $hpolltime; +$hpolltime = 300 unless defined $hpolltime; %circuit = (); sub init @@ -76,11 +76,16 @@ sub init _sendf('m') if $monitor; } +my $finishing = 0; + sub finish { + return if $finishing; if ($sock) { + $finishing = 1; dbg('err', "AGW ending..."); for (values %circuit) { + &{$_->{eproc}}() if $_->{eproc}; $_->disconnect; } # say we are going @@ -315,7 +320,10 @@ sub _decode } elsif ($sort eq 'd') { dbg('agw', "AGW '$from'->'$to' port: $port Disconnected"); my $conn = _find($from eq $main::mycall ? $to : $from); - $conn->in_disconnect if $conn; + if ($conn) { + &{$conn->{eproc}}() if $conn->{eproc}; + $conn->in_disconnect; + } } elsif ($sort eq 'y') { my ($frames) = unpack "V", $data; dbg('agwpollans', "AGW Frames Outstanding on port $port = $frames"); @@ -387,7 +395,6 @@ sub in_disconnect { my $conn = shift; delete $circuit{$conn->{agwcall}}; - _sendf('d', $conn->{agwcall}, $main::mycall, $conn->{agwport}, $conn->{agwpid}); $conn->SUPER::disconnect; } @@ -410,6 +417,8 @@ sub enqueue $msg =~ s/^[-\w]+\|//; # _sendf('Y', $main::mycall, $conn->{call}, $conn->{agwport}, $conn->{agwpid}); _sendf('D', $main::mycall, $conn->{agwcall}, $conn->{agwport}, $conn->{agwpid}, $msg . $conn->{lineend}); + my $len = length($msg) + 1; + dbg('agw', "AGW Data Out port: $conn->{agwport} pid: $conn->{agwpid} '$main::mycall'->'$conn->{agwcall}' length: $len \"$msg\""); } }