I have got a copy of AGW Packet Engine Pro on windows and tested
the code with that. I have also added some commands to enable/disable
the AGW connection on the fly.
You can carry on with the message until you are ready to send it.
=== 0^SET/ADDRESS <your address>^Record your postal address
You can carry on with the message until you are ready to send it.
=== 0^SET/ADDRESS <your address>^Record your postal address
+=== 9^SET/AGWENGINE^Enable the AGW Engine
+=== 9^UNSET/AGWENGINE^Disable the AGW Engine
+These commands assume that /spider/local/AGWConnect.pm has been setup
+correctly and you wish to do some testing or otherwise want to alter
+the default state of your connection to the AGW Engine.
+
+=== 9^SET/AGWMONITOR^Enable Monitoring on the AGW Engine
+=== 9^UNSET/AGWMONITOR^Disable Monitoring on the AGW Engine
+
=== 0^SET/ANNOUNCE^Allow announce messages to come out on your terminal
=== 0^UNSET/ANNOUNCE^Stop announce messages coming out on your terminal
=== 0^SET/ANNOUNCE^Allow announce messages to come out on your terminal
=== 0^UNSET/ANNOUNCE^Stop announce messages coming out on your terminal
--- /dev/null
+#
+# set AGW engine on
+#
+#
+#
+
+my $self = shift;
+return (1, $self->msg('e5')) if $self->priv < 9;
+unless ($AGWMsg::enable) {
+ $AGWMsg::enable = 1;
+ return (1, $self->msg('agwe'));
+}
+return (1);
+
--- /dev/null
+#
+# set AGW engine off
+#
+#
+#
+
+my $self = shift;
+return (1, $self->msg('e5')) if $self->priv < 9;
+if ($AGWMsg::enable) {
+ AGWMsg::finish() if $AGWMsg::sock;
+ $AGWMsg::enable = 0;
+ return (1, $self->msg('agwu'));
+}
+return (1);
%circuit = ();
$total_in = $total_out = 0;
$lastconnect = 0;
%circuit = ();
$total_in = $total_out = 0;
$lastconnect = 0;
finish();
dbg("AGW initialising and connecting to $addr/$port ...");
finish();
dbg("AGW initialising and connecting to $addr/$port ...");
- $sock = IO::Socket::INET->new(PeerAddr => $addr, PeerPort => $port, Proto=>'tcp', Timeout=>15);
+ $sock = IO::Socket::INET->new(PeerAddr => $addr, PeerPort => $port, Proto=>'tcp', Timeout=>3);
$lastconnect = $main::systime;
unless ($sock) {
dbg("Cannot connect to AGW Engine at $addr/$port $!");
$lastconnect = $main::systime;
unless ($sock) {
dbg("Cannot connect to AGW Engine at $addr/$port $!");
Msg::set_event_handler($sock, read=>undef, write=>undef, error=>undef);
$sock->close;
$lastconnect = $main::systime;
Msg::set_event_handler($sock, read=>undef, write=>undef, error=>undef);
$sock->close;
$lastconnect = $main::systime;
}
} else {
if (Msg::_err_will_block($!)) {
}
} else {
if (Msg::_err_will_block($!)) {
- dbg("error on AGW connection $addr/$port $!");
+ return if $finishing;
+ $finishing++;
+ dbg("AGW connection error on $addr/$port $!");
Msg::set_event_handler($sock, read=>undef, write=>undef, error=>undef);
Msg::set_event_handler($sock, read=>undef, write=>undef, error=>undef);
for (%circuit) {
&{$_->{eproc}}() if $_->{eproc};
$_->disconnect;
}
for (%circuit) {
&{$_->{eproc}}() if $_->{eproc};
$_->disconnect;
}
$lastconnect = $main::systime;
$lastconnect = $main::systime;
sub process
{
# try to reconnect to AGW if we could not previously or there was an error
sub process
{
# try to reconnect to AGW if we could not previously or there was an error
- if ($enable && !$sock && ($lastconnect + $connectinterval) >= $main::systime) {
+ if ($enable && !$sock && $main::systime >= $lastconnect + $connectinterval) {
init();
}
return unless $sock;
init();
}
return unless $sock;
%msgs = (
en => {
addr => 'Address set to: $_[0]',
%msgs = (
en => {
addr => 'Address set to: $_[0]',
- already => '$_[0] already connected',
+ agwe => 'AGW Engine enabled',
+ agwu => 'AGW Engine disabled',
+ already => '$_[0] already connected',
anns => 'Announces enabled for $_[0]',
annu => 'Announces disabled for $_[0]',
annts => 'AnnTalk enabled for $_[0]',
anns => 'Announces enabled for $_[0]',
annu => 'Announces disabled for $_[0]',
annts => 'AnnTalk enabled for $_[0]',
$version = '1.54';
$subversion = '0';
$version = '1.54';
$subversion = '0';