Add the first draft of the usermanual and minor changes to adminmanual
[spider.git] / perl / cluster.pl
index d34a3337b270cf27a1c912e2a17594f1047ed77e..2c94dcc1cb619571baef325fe4607071c453bb1c 100755 (executable)
@@ -83,7 +83,7 @@ $systime = 0;                                 # the time now (in seconds)
 $version = "1.47";                             # the version no of the software
 $starttime = 0;                 # the starting time of the cluster   
 $lockfn = "cluster.lock";       # lock file name
-@outstanding_connects = ();     # list of outstanding connects
+#@outstanding_connects = ();     # list of outstanding connects
 @listeners = ();                               # list of listeners
 
       
@@ -128,8 +128,8 @@ sub rec
  
                # is there one already connected to me - locally? 
                my $user = DXUser->get($call);
-               if (DXChannel->get($call)) {
-                       my $mess = DXM::msg($lang, ($user && $user->is_node) ? 'concluster' : 'conother', $call);
+               if ($sort ne 'O' && Msg->conns($call)) {
+                       my $mess = DXM::msg($lang, ($user && $user->is_node) ? 'concluster' : 'conother', $call, $main::mycall);
                        already_conn($conn, $call, $mess);
                        return;
                }
@@ -139,16 +139,16 @@ sub rec
                        if (($user->is_node || $call eq $myalias) && !DXCluster->get_exact($call)) {
                                ;
                        } else {
-                               if (DXCluster->get_exact($call)) {
-                                       my $mess = DXM::msg($lang, $user->is_node ? 'concluster' : 'conother', $call);
+                               if (my $ref = DXCluster->get_exact($call)) {
+                                       my $mess = DXM::msg($lang, 'concluster', $call, $ref->mynode->call);
                                        already_conn($conn, $call, $mess);
                                        return;
                                }
                        }
                        $user->{lang} = $main::lang if !$user->{lang}; # to autoupdate old systems
                } else {
-                       if (DXCluster->get_exact($call)) {
-                               my $mess = DXM::msg($lang, 'conother', $call);
+                       if (my $ref = DXCluster->get_exact($call)) {
+                               my $mess = DXM::msg($lang, 'concluster', $call, $ref->mynode->call);
                                already_conn($conn, $call, $mess);
                                return;
                        }
@@ -159,9 +159,13 @@ sub rec
                if ($user->lockout) {
                        Log('DXCommand', "$call is locked out, disconnected");
                        $conn->send_now("Z$call|bye"); # this will cause 'client' to disconnect
+                       $conn->disconnect;
                        return;
                }
 
+               # mark him up
+               $conn->conns($call) unless $sort eq 'O';
+               
                # create the channel
                $dxchan = DXCommandmode->new($call, $conn, $user) if $user->is_user;
                $dxchan = DXProt->new($call, $conn, $user) if $user->is_node;
@@ -243,7 +247,7 @@ sub reap
        my $cpid;
        while (($cpid = waitpid(-1, WNOHANG)) > 0) {
                dbg('reap', "cpid: $cpid");
-               @outstanding_connects = grep {$_->{pid} != $cpid} @outstanding_connects;
+#              Msg->pid_gone($cpid);
                $zombies-- if $zombies > 0;
        }
        dbg('reap', "cpid: $cpid");