X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FAGWMsg.pm;h=8aa47dbfe1671f791a0d93deb041cfd09462f87d;hb=8b94259b7a3e97751662280d0cbd606ff7a68e1e;hp=d80f423547184c456a46bce03a512c13b33b7d53;hpb=c644e2f01b7528fb3cd4666a552a5ee282462e88;p=spider.git diff --git a/perl/AGWMsg.pm b/perl/AGWMsg.pm index d80f4235..8aa47dbf 100644 --- a/perl/AGWMsg.pm +++ b/perl/AGWMsg.pm @@ -45,7 +45,7 @@ sub init finish(); dbg('err', "AGW initialising and connecting to $addr/$port ..."); - $sock = IO::Socket::INET->new(PeerAddr => $addr, PeerPort => $port, Proto=>'tcp'); + $sock = IO::Socket::INET->new(PeerAddr => $addr, PeerPort => $port, Proto=>'tcp', Timeout => 30); unless ($sock) { dbg('err', "Cannot connect to AGW Engine at $addr/$port $!"); return; @@ -63,6 +63,7 @@ sub init # R frame for the release number # G frame to ask for ports # X frame to say who we are + # optional m frame to enable monitoring _sendf('R'); _sendf('G'); _sendf('X', $main::mycall); @@ -80,6 +81,7 @@ sub finish $_->disconnect; } # say we are going + _sendf('m') if $monitor; _sendf('x', $main::mycall); Msg->sleep(2); Msg::set_event_handler($sock, read=>undef, write=>undef, error=>undef); @@ -262,6 +264,9 @@ sub _decode } } else { $conn = AGWMsg->new($rproc); + $conn->{agwpid} = $pid; + $conn->{agwport} = $port; + $conn->{lineend} = "\cR"; $conn->to_connected($call, 'A', $conn->{csort} = 'ax25'); } } elsif ($sort eq 'd') { @@ -309,9 +314,17 @@ sub in_disconnect sub disconnect { my $conn = shift; - _sendf('d', $main::mycall, $conn->{call}); + _sendf('d', $main::mycall, $conn->{call}, $conn->{agwport}); $conn->SUPER->disconnect; } +sub enqueue +{ + my ($conn, $msg) = @_; + if ($msg =~ /^[D]/) { + $msg =~ s/^[-\w]+\|//; + _sendf('D', $main::mycall, $conn->{call}, $conn->{agwport}, $conn->{agwpid}, $msg . $conn->{lineend}); + } +} 1;