[LON-CAPA-cvs] cvs: loncom / lonc

www lon-capa-cvs@mail.lon-capa.org
Tue, 19 Feb 2002 21:49:12 -0000


www		Tue Feb 19 16:49:12 2002 EDT

  Modified files:              
    /loncom	lonc 
  Log:
  Removing old garbage
  
  
Index: loncom/lonc
diff -u loncom/lonc:1.26 loncom/lonc:1.27
--- loncom/lonc:1.26	Tue Feb 19 16:12:22 2002
+++ loncom/lonc	Tue Feb 19 16:49:12 2002
@@ -5,7 +5,7 @@
 # provides persistent TCP connections to the other servers in the network
 # through multiplexed domain sockets
 #
-# $Id: lonc,v 1.26 2002/02/19 21:12:22 www Exp $
+# $Id: lonc,v 1.27 2002/02/19 21:49:12 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -80,7 +80,7 @@
 
 sub online {
     my $host=shift;
-    my $p=Net::Ping->new("tcp",10);
+    my $p=Net::Ping->new("tcp",20);
     my $online=$p->ping("$host");
     $p->close();
     undef ($p);
@@ -161,7 +161,9 @@
     my ($id,$domain,$role,$name,$ip)=split(/:/,$configline);
     chomp($ip);
     $hostip{$id}=$ip;
+    $hostname{$id}=$name;
 }
+
 close(CONFIG);
 
 # -------------------------------------------------------- Routines for forking
@@ -185,8 +187,7 @@
     unlink($port);
 }
 
-sub HUNTSMAN {                      # signal handler for SIGINT
-    local($SIG{CHLD}) = 'IGNORE';   # we're going to kill our children
+sub hangup {
     foreach (keys %children) {
         $wasserver=$children{$_};
         &status("Closing $wasserver");
@@ -194,6 +195,11 @@
         &status("Kill PID $_ for $wasserver");
 	kill ('INT',$_);
     }
+}
+
+sub HUNTSMAN {                      # signal handler for SIGINT
+    local($SIG{CHLD}) = 'IGNORE';   # we're going to kill our children
+    &hangup();
     my $execdir=$perlvar{'lonDaemons'};
     unlink("$execdir/logs/lonc.pid");
     &logthis("<font color=red>CRITICAL: Shutting down</font>");
@@ -202,13 +208,7 @@
 
 sub HUPSMAN {                      # signal handler for SIGHUP
     local($SIG{CHLD}) = 'IGNORE';  # we're going to kill our children
-    foreach (keys %children) {
-        $wasserver=$children{$_};
-        &status("Closing $wasserver");
-        &logthis('Closing '.$wasserver.': '.&subreply('exit',$wasserver));
-        &status("Kill PID $_ for $wasserver");
-	kill ('INT',$_);
-    }
+    &hangup();
     &logthis("<font color=red>CRITICAL: Restarting</font>");
     unlink("$execdir/logs/lonc.pid");
     my $execdir=$perlvar{'lonDaemons'};
@@ -230,12 +230,6 @@
 
 sub USRMAN {
     &logthis("USR1: Trying to establish connections again");
-    foreach $thisserver (keys %hostip) {
-	$answer=subreply("ping",$thisserver);
-        &logthis("USR1: Ping $thisserver "
-        ."(pid >$childpid{$thisserver}<, $childatt{thisserver} attempts): "
-        ." >$answer<");
-    }
     %childatt=();
     &checkchildren();
 }