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
--- /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;
-$connectinterval = 30;
+$connectinterval = 60;
sub init
{
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 $!");
Msg::set_event_handler($sock, read=>undef, write=>undef, error=>undef);
$sock->close;
$lastconnect = $main::systime;
+ $sock = undef;
}
+ $finishing = 0;
}
sub login
}
} else {
if (Msg::_err_will_block($!)) {
- return;
+ return;
} else {
- $bytes_read = 0;
+ _error();
+ return;
}
}
sub _error
{
- 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);
- $sock = undef;
for (%circuit) {
&{$_->{eproc}}() if $_->{eproc};
$_->disconnect;
}
+ $sock = undef;
$lastconnect = $main::systime;
+ $finishing = 0;
}
sub _decode
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;
%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]',
$version = '1.54';
$subversion = '0';
-$build = '207';
+$build = '208';
1;