re-arrange ExtMsg a bit to cope with $sock->peerhost and port failures
authorminima <minima>
Sun, 3 Jun 2001 12:49:43 +0000 (12:49 +0000)
committerminima <minima>
Sun, 3 Jun 2001 12:49:43 +0000 (12:49 +0000)
perl/ExtMsg.pm

index 07d77cba3a05b92ddb8b31bf82acd208a4421d1c..4efb3484c0621d58c90631ab247ff6c67d87304a 100644 (file)
@@ -129,14 +129,14 @@ sub new_client {
                $conn->{sock} = $sock;
                Msg::blocking($sock, 0);
                $conn->{blocking} = 0;
-               my $host;
-               eval {$host = $conn->{peerhost}};
-               my $port;
-               eval {$port = $conn->{peerport}} unless $@;
+               eval {$conn->{peerhost} = $sock->peerhost};
                if ($@) {
+                       dbg('conn', $@);
                        $conn->disconnect;
                } else {
-                       my ($rproc, $eproc) = &{$server_conn->{rproc}} ($conn, $conn->{peerhost} = $host, $conn->{peerport} = $port);
+                       eval {$conn->{peerport} = $sock->peerport};
+                       $conn->{peerport} = 0 if $@;
+                       my ($rproc, $eproc) = &{$server_conn->{rproc}} ($conn, $conn->{peerhost}, $conn->{peerport});
                        dbg('connll', "accept $conn->{cnum} from $conn->{peerhost} $conn->{peerport}");
                        if ($eproc) {
                                $conn->{eproc} = $eproc;