If the connection to AGW goes away or AGW is not loaded when dxspider starts
up, then there was no retry mechanism for restarting the connection. Now
it will try to connect every 30 seconds if AGW is enabled and there is no
connection present.
+25Feb08=======================================================================
+1. Arrange for AGWMsg to retry connection either if the AGW engine isn't
+loaded on startup or it disappears for some reason and restarts.
19Feb08=======================================================================
1. Added CTY-1801 cty.dat data.
2. Fix problem with entering non-ascii data and then executing commands that
19Feb08=======================================================================
1. Added CTY-1801 cty.dat data.
2. Fix problem with entering non-ascii data and then executing commands that
use DXDebug;
use vars qw(@ISA $sock @outqueue $send_offset $inmsg $rproc $noports $lastytime
use DXDebug;
use vars qw(@ISA $sock @outqueue $send_offset $inmsg $rproc $noports $lastytime
- $lasthtime $ypolltime $hpolltime %circuit $total_in $total_out);
+ $lasthtime $ypolltime $hpolltime %circuit $total_in $total_out
+ $lastconnect $connectinterval);
@ISA = qw(Msg ExtMsg);
$sock = undef;
@ISA = qw(Msg ExtMsg);
$sock = undef;
$hpolltime = 300 unless defined $hpolltime;
%circuit = ();
$total_in = $total_out = 0;
$hpolltime = 300 unless defined $hpolltime;
%circuit = ();
$total_in = $total_out = 0;
+$lastconnect = 0;
+$connectinterval = 30;
$rproc = shift;
finish();
$rproc = shift;
finish();
dbg("AGW initialising and connecting to $addr/$port ...");
$sock = IO::Socket::INET->new(PeerAddr => $addr, PeerPort => $port, Proto=>'tcp', Timeout=>15);
dbg("AGW initialising and connecting to $addr/$port ...");
$sock = IO::Socket::INET->new(PeerAddr => $addr, PeerPort => $port, Proto=>'tcp', Timeout=>15);
+ $lastconnect = $main::systime;
unless ($sock) {
dbg("Cannot connect to AGW Engine at $addr/$port $!");
return;
unless ($sock) {
dbg("Cannot connect to AGW Engine at $addr/$port $!");
return;
Msg->sleep(2);
Msg::set_event_handler($sock, read=>undef, write=>undef, error=>undef);
$sock->close;
Msg->sleep(2);
Msg::set_event_handler($sock, read=>undef, write=>undef, error=>undef);
$sock->close;
+ $lastconnect = $main::systime;
&{$_->{eproc}}() if $_->{eproc};
$_->disconnect;
}
&{$_->{eproc}}() if $_->{eproc};
$_->disconnect;
}
+ $lastconnect = $main::systime;
+ # try to reconnect to AGW if we could not previously or there was an error
+ if ($enable && !$sock && ($lastconnect + $connectinterval) >= $main::systime) {
+ init();
+ }
if ($ypolltime && $main::systime - $lastytime >= $ypolltime) {
for (my $i = 0; $i < $noports; $i++) {
_sendf('y', undef, undef, $i );
if ($ypolltime && $main::systime - $lastytime >= $ypolltime) {
for (my $i = 0; $i < $noports; $i++) {
_sendf('y', undef, undef, $i );
$version = '1.54';
$subversion = '0';
$version = '1.54';
$subversion = '0';