From: minima Date: Mon, 9 Apr 2001 21:47:46 +0000 (+0000) Subject: add some extra info around connects for tracking connections X-Git-Tag: R_1_47~41 X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=3f64c5686df118fa3f3a1d66a87f25b89eb1732a;p=spider.git add some extra info around connects for tracking connections --- diff --git a/Changes b/Changes index 4cb272e4..7c565d2c 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,7 @@ 1. altered PC21 logic somewhat to eliminate dup PC21s 2. disconnect should remove dangling local users in the routing table. 3. fixed nasty recursive timer bug +4. added some extra info to make connect tracking a bit easier. 09Apr01======================================================================= 1. changed lockfile name to cluster.lck (from .lock) for MSWin's benefit 08Apr01======================================================================= diff --git a/perl/ExtMsg.pm b/perl/ExtMsg.pm index cc938bd8..8a5e4612 100644 --- a/perl/ExtMsg.pm +++ b/perl/ExtMsg.pm @@ -129,6 +129,7 @@ sub new_client { $conn->{blocking} = 0; my ($rproc, $eproc) = &{$server_conn->{rproc}} ($conn, $conn->{peerhost} = $sock->peerhost(), $conn->{peerport} = $sock->peerport()); + dbg('connll', "accept $conn->{cnum} from $conn->{peerhost} $conn->{peerport}"); if ($eproc) { $conn->{eproc} = $eproc; Msg::set_event_handler ($sock, "error" => $eproc); @@ -363,8 +364,9 @@ sub _send_file if ($f) { while (<$f>) { chomp; - dbg('connll', $_); - $conn->send_raw($_ . $conn->{lineend}); + my $l = $_; + dbg('connll', "connect $conn->{cnum}: $l"); + $conn->send_raw($l . $conn->{lineend}); } $f->close; } diff --git a/perl/Msg.pm b/perl/Msg.pm index f1f60edf..81593796 100644 --- a/perl/Msg.pm +++ b/perl/Msg.pm @@ -73,9 +73,9 @@ sub new csort => 'telnet', timeval => 60, blocking => 0, + cnum => ++$noconns, }; - $noconns++; dbg('connll', "Connection created ($noconns)"); return bless $conn, $class; } @@ -121,7 +121,7 @@ sub conns confess "changing $pkg->{call} to $call" if exists $pkg->{call} && $call ne $pkg->{call}; $pkg->{call} = $call; $ref = $conns{$call} = $pkg; - dbg('connll', "Connection $call stored"); + dbg('connll', "Connection $pkg->{cnum} $call stored"); } else { $ref = $conns{$call}; } @@ -194,7 +194,7 @@ sub disconnect { delete $conns{$call} if $ref && $ref == $conn; } $call ||= 'unallocated'; - dbg('connll', "Connection $call disconnected"); + dbg('connll', "Connection $conn->{cnum} $call disconnected"); unless ($main::is_win) { kill 'TERM', $conn->{pid} if exists $conn->{pid}; @@ -522,7 +522,9 @@ sub DESTROY { my $conn = shift; my $call = $conn->{call} || 'unallocated'; - dbg('connll', "Connection $call being destroyed ($noconns)"); + my $host = $conn->{peerhost} || ''; + my $port = $conn->{peerport} || ''; + dbg('connll', "Connection $conn->{cnum} $call [$host $port] being destroyed"); $noconns--; }