Diff for /loncom/lond between versions 1.144 and 1.147

version 1.144, 2003/09/16 09:47:01 version 1.147, 2003/09/23 11:23:31
Line 60 Line 60
 # 09/08/2003 Ron Fox:  Told lond to take care of change logging so we  # 09/08/2003 Ron Fox:  Told lond to take care of change logging so we
 #      don't have to remember it:  #      don't have to remember it:
 # $Log$  # $Log$
   # Revision 1.147  2003/09/23 11:23:31  foxr
   # Comlplete implementation of reinit functionality.  Must still implement
   # the actual initialization functionality, but the process can now
   # receive the request and either invoke the appropriate internal function or
   # signal the correct lonc.
   #
   # Revision 1.146  2003/09/16 10:28:14  foxr
   # ReinitProcess - decode the process selector and produce the associated pid
   # filename.  Note: While it is possible to test that valid process selectors are
   # handled properly I am not able to test that invalid process selectors produce
   # the appropriate error as lonManage also blocks the use of invalid process selectors.
   #
   # Revision 1.145  2003/09/16 10:13:20  foxr
   # Added ReinitProcess function to oversee the parsing and processing of the
   # reinit:<process> client request.
   #
 # Revision 1.144  2003/09/16 09:47:01  foxr  # Revision 1.144  2003/09/16 09:47:01  foxr
 # Added skeletal support for SIGUSR2 (update hosts.tab)  # Added skeletal support for SIGUSR2 (update hosts.tab)
 #  #
Line 338  sub PushFile { Line 354  sub PushFile {
   
     if(!InstallFile($tablefile, $contents)) {      if(!InstallFile($tablefile, $contents)) {
  &logthis('<font color="red"> Pushfile: unable to install '   &logthis('<font color="red"> Pushfile: unable to install '
  .$tablefile." $! </font>");   .$tablefile." $! </font>");
  return "error:$!";   return "error:$!";
     }      }
     else {      else {
Line 353  sub PushFile { Line 369  sub PushFile {
     return "ok";      return "ok";
   
 }  }
   
   #
   #  Called to re-init either lonc or lond.
   #
   #  Parameters:
   #    request   - The full request by the client.  This is of the form
   #                reinit:<process>  
   #                where <process> is allowed to be either of 
   #                lonc or lond
   #
   #  Returns:
   #     The string to be sent back to the client either:
   #   ok         - Everything worked just fine.
   #   error:why  - There was a failure and why describes the reason.
   #
   #
   sub ReinitProcess {
       my $request = shift;
   
   
       # separate the request (reinit) from the process identifier and
       # validate it producing the name of the .pid file for the process.
       #
       #
       my ($junk, $process) = split(":", $request);
       my $processpidfile = $perlvar{'lonDaemons'}.'/logs/';
       if($process eq 'lonc') {
    $processpidfile = $processpidfile."lonc.pid";
    if (!open(PIDFILE, "< $processpidfile")) {
       return "error:Open failed for $processpidfile";
    }
    my $loncpid = <PIDFILE>;
    close(PIDFILE);
    logthis('<font color="red"> Reinitializing lonc pid='.$loncpid
    ."</font>");
    kill("USR2", $loncpid);
       } elsif ($process eq 'lond') {
    logthis('<font color="red"> Reinitializing self (lond) </font>');
    &UpdateHosts; # Lond is us!!
       } else {
    &logthis('<font color="yellow" Invalid reinit request for '.$process
    ."</font>");
    return "error:Invalid process identifier $process";
       }
       return 'ok';
   }
   
 #  #
 #  Convert an error return code from lcpasswd to a string value.  #  Convert an error return code from lcpasswd to a string value.
 #  #
Line 499  sub HUPSMAN {                      # sig Line 562  sub HUPSMAN {                      # sig
 #     now be honored.  #     now be honored.
 #  #
 sub UpdateHosts {  sub UpdateHosts {
       logthis('<font color="blue"> Updating connections </font>');
 }  }
   
 sub checkchildren {  sub checkchildren {
Line 952  sub make_new_child { Line 1016  sub make_new_child {
        if ($wasenc == 1) {         if ($wasenc == 1) {
    my $cert = GetCertificate($userinput);     my $cert = GetCertificate($userinput);
    if(ValidManager($cert)) {     if(ValidManager($cert)) {
        print $client "ok\n";         chomp($userinput);
          my $reply = ReinitProcess($userinput);
          print $client  "$reply\n";
    } else {     } else {
        print $client "refused\n";         print $client "refused\n";
    }     }

Removed from v.1.144  
changed lines
  Added in v.1.147


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>