allow for errors on accept
authorminima <minima>
Fri, 30 Mar 2001 11:15:20 +0000 (11:15 +0000)
committerminima <minima>
Fri, 30 Mar 2001 11:15:20 +0000 (11:15 +0000)
Changes
perl/ExtMsg.pm

diff --git a/Changes b/Changes
index a91799668237482f526464e1e622fa761b4b17f9..3906c70fd8ba0f3dfee03c2e7a89a199b0ff4ef4 100644 (file)
--- 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]
index 49982a18c9aafd9e2f54588cb7aad99c1172b7ac..2fd19873eae890b619030266f1bc34db625bf030 100644 (file)
@@ -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