added IP address logging for connections
[spider.git] / perl / cluster.pl
index e7f386977baad7a5137884f74e5d2adb13655274..516e7cb1eb8f57ae33478d313e97ee9627df3245 100755 (executable)
@@ -159,7 +159,8 @@ sub new_channel
        
        # is he locked out ?
        if ($user->lockout) {
-               Log('DXCommand', "$call is locked out, disconnected");
+               my $host = $conn->{peerhost} || "unknown";
+               Log('DXCommand', "$call on $host is locked out, disconnected");
                $conn->disconnect;
                return;
        }
@@ -266,35 +267,37 @@ sub reap
 # the cluster
 sub process_inqueue
 {
-       my $self = shift @inqueue;
-       return if !$self;
+       while (@inqueue) {
+               my $self = shift @inqueue;
+               return if !$self;
        
-       my $data = $self->{data};
-       my $dxchan = $self->{dxchan};
-       my $error;
-       my ($sort, $call, $line) = DXChannel::decode_input($dxchan, $data);
-       return unless defined $sort;
+               my $data = $self->{data};
+               my $dxchan = $self->{dxchan};
+               my $error;
+               my ($sort, $call, $line) = DXChannel::decode_input($dxchan, $data);
+               return unless defined $sort;
        
-       # do the really sexy console interface bit! (Who is going to do the TK interface then?)
-       dbg("<- $sort $call $line\n") if $sort ne 'D' && isdbg('chan');
-
-       # handle A records
-       my $user = $dxchan->user;
-       if ($sort eq 'A' || $sort eq 'O') {
-               $dxchan->start($line, $sort);  
-       } elsif ($sort eq 'I') {
-               die "\$user not defined for $call" if !defined $user;
-               # normal input
-               $dxchan->normal($line);
-               $dxchan->disconnect if ($dxchan->{state} eq 'bye');
-       } elsif ($sort eq 'Z') {
-               $dxchan->disconnect;
-       } elsif ($sort eq 'D') {
-               ;                       # ignored (an echo)
-       } elsif ($sort eq 'G') {
-               $dxchan->enhanced($line);
-       } else {
-               print STDERR atime, " Unknown command letter ($sort) received from $call\n";
+               # do the really sexy console interface bit! (Who is going to do the TK interface then?)
+               dbg("<- $sort $call $line\n") if $sort ne 'D' && isdbg('chan');
+
+               # handle A records
+               my $user = $dxchan->user;
+               if ($sort eq 'A' || $sort eq 'O') {
+                       $dxchan->start($line, $sort);  
+               } elsif ($sort eq 'I') {
+                       die "\$user not defined for $call" if !defined $user;
+                       # normal input
+                       $dxchan->normal($line);
+                       $dxchan->disconnect if ($dxchan->{state} eq 'bye');
+               } elsif ($sort eq 'Z') {
+                       $dxchan->disconnect;
+               } elsif ($sort eq 'D') {
+                       ;                                       # ignored (an echo)
+               } elsif ($sort eq 'G') {
+                       $dxchan->enhanced($line);
+               } else {
+                       print STDERR atime, " Unknown command letter ($sort) received from $call\n";
+               }
        }
 }