From: minima Date: Fri, 30 Mar 2001 11:15:20 +0000 (+0000) Subject: allow for errors on accept X-Git-Tag: R_1_47~77 X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=b7e47e72297ced0ec9ce120922e6de2e5614a3fe;p=spider.git allow for errors on accept --- diff --git a/Changes b/Changes index a9179966..3906c70f 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,5 @@ +30Mar01======================================================================= +1. fix errors on accept in EXtMsg 29Mar01======================================================================= 1. add better tracking of AGW circuits (possibly) 2. add set and unset/agwmonitor (ing) [for all the notice it seems to take] diff --git a/perl/ExtMsg.pm b/perl/ExtMsg.pm index 49982a18..2fd19873 100644 --- a/perl/ExtMsg.pm +++ b/perl/ExtMsg.pm @@ -122,29 +122,34 @@ sub to_connected sub new_client { my $server_conn = shift; my $sock = $server_conn->{sock}->accept(); - my $conn = $server_conn->new($server_conn->{rproc}); - $conn->{sock} = $sock; - - my ($rproc, $eproc) = &{$server_conn->{rproc}} ($conn, $conn->{peerhost} = $sock->peerhost(), $conn->{peerport} = $sock->peerport()); - if ($eproc) { - $conn->{eproc} = $eproc; - Msg::set_event_handler ($sock, "error" => $eproc); + if ($sock) { + my $conn = $server_conn->new($server_conn->{rproc}); + $conn->{sock} = $sock; + + my ($rproc, $eproc) = &{$server_conn->{rproc}} ($conn, $conn->{peerhost} = $sock->peerhost(), $conn->{peerport} = $sock->peerport()); + if ($eproc) { + $conn->{eproc} = $eproc; + Msg::set_event_handler ($sock, "error" => $eproc); + } + if ($rproc) { + $conn->{rproc} = $rproc; + my $callback = sub {$conn->_rcv}; + Msg::set_event_handler ($sock, "read" => $callback); + # send login prompt + $conn->{state} = 'WL'; + # $conn->send_raw("\xff\xfe\x01\xff\xfc\x01\ff\fd\x22"); + # $conn->send_raw("\xff\xfa\x22\x01\x01\xff\xf0"); + # $conn->send_raw("\xFF\xFC\x01"); + $conn->_send_file("$main::data/issue"); + $conn->send_raw("login: "); + $conn->_dotimeout(60); + } else { + &{$conn->{eproc}}() if $conn->{eproc}; + $conn->disconnect(); + } + } else { + dbg('err', "ExtMsg: error on accept ($!)"); } - if ($rproc) { - $conn->{rproc} = $rproc; - my $callback = sub {$conn->_rcv}; - Msg::set_event_handler ($sock, "read" => $callback); - # send login prompt - $conn->{state} = 'WL'; -# $conn->send_raw("\xff\xfe\x01\xff\xfc\x01\ff\fd\x22"); -# $conn->send_raw("\xff\xfa\x22\x01\x01\xff\xf0"); -# $conn->send_raw("\xFF\xFC\x01"); - $conn->_send_file("$main::data/issue"); - $conn->send_raw("login: "); - $conn->_dotimeout(60); - } else { - $conn->disconnect(); - } } sub start_connect