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;
# 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);
$_->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);
}
} 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') {
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;