[LON-CAPA-cvs] cvs: loncom / loncnew
foxr
lon-capa-cvs@mail.lon-capa.org
Tue, 30 Sep 2003 11:11:17 -0000
foxr Tue Sep 30 07:11:17 2003 EDT
Modified files:
/loncom loncnew
Log:
Add book-keeping hashes to support the re-init procedure.
Index: loncom/loncnew
diff -u loncom/loncnew:1.25 loncom/loncnew:1.26
--- loncom/loncnew:1.25 Tue Sep 23 07:22:14 2003
+++ loncom/loncnew Tue Sep 30 07:11:17 2003
@@ -2,7 +2,7 @@
# The LearningOnline Network with CAPA
# lonc maintains the connections to remote computers
#
-# $Id: loncnew,v 1.25 2003/09/23 11:22:14 foxr Exp $
+# $Id: loncnew,v 1.26 2003/09/30 11:11:17 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -45,6 +45,9 @@
# Change log:
# $Log: loncnew,v $
+# Revision 1.26 2003/09/30 11:11:17 foxr
+# Add book-keeping hashes to support the re-init procedure.
+#
# Revision 1.25 2003/09/23 11:22:14 foxr
# Tested ability to receive sigusr2 This is now logged and must be
# properly implemented as a re-read of hosts and re-init of appropriate
@@ -161,6 +164,8 @@
# parent and shared variables.
my %ChildHash; # by pid -> host.
+my %HostToPid; # By host -> pid.
+my %HostHash; # by loncapaname -> IP.
my $MaxConnectionCount = 10; # Will get from config later.
@@ -1520,6 +1525,7 @@
if($pid) { # Parent
$RemoteHost = "Parent";
$ChildHash{$pid} = $RemoteHost;
+ $HostToPid{$host}= $pid;
sigprocmask(SIG_UNBLOCK, $sigset);
} else { # child.
@@ -1582,6 +1588,7 @@
my $hostentryref = $HostIterator->get();
CreateChild($hostentryref->[0]);
+ $HostHash{$hostentryref->[0]} = $hostentryref->[4];
$HostIterator->next();
}
$RemoteHost = "Parent Server";
@@ -1604,6 +1611,7 @@
my $deadchild = wait();
if(exists $ChildHash{$deadchild}) { # need to restart.
my $deadhost = $ChildHash{$deadchild};
+ delete($HostToPid{$deadhost});
delete($ChildHash{$deadchild});
Log("WARNING","Lost child pid= ".$deadchild.
"Connected to host ".$deadhost);