[LON-CAPA-cvs] cvs: loncom / lond
foxr
lon-capa-cvs@mail.lon-capa.org
Tue, 16 Sep 2003 10:28:14 -0000
foxr Tue Sep 16 06:28:14 2003 EDT
Modified files:
/loncom lond
Log:
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.
Index: loncom/lond
diff -u loncom/lond:1.145 loncom/lond:1.146
--- loncom/lond:1.145 Tue Sep 16 06:13:20 2003
+++ loncom/lond Tue Sep 16 06:28:14 2003
@@ -2,7 +2,7 @@
# The LearningOnline Network
# lond "LON Daemon" Server (port "LOND" 5663)
#
-# $Id: lond,v 1.145 2003/09/16 10:13:20 foxr Exp $
+# $Id: lond,v 1.146 2003/09/16 10:28:14 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -60,6 +60,12 @@
# 09/08/2003 Ron Fox: Told lond to take care of change logging so we
# don't have to remember it:
# $Log: lond,v $
+# 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.
@@ -104,7 +110,7 @@
my $status='';
my $lastlog='';
-my $VERSION='$Revision: 1.145 $'; #' stupid emacs
+my $VERSION='$Revision: 1.146 $'; #' stupid emacs
my $remoteVERSION;
my $currenthostid;
my $currentdomainid;
@@ -376,6 +382,23 @@
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'}.'/';
+ if($process eq 'lonc') {
+ $processpidfile = $processpidfile."lonc.pid";
+ } elsif ($process eq 'lond') {
+ $processpidfile = $processpidfile."lond.pid";
+ } else {
+ &logthis('<font color="yellow" Invalid reinit request for '.$process
+ ."</font>");
+ return "error:Invalid process identifier $process";
+ }
+ &logthis('<font color="red"> Reinitializing '.$process." </font>");
return 'ok';
}
@@ -978,6 +1001,7 @@
if ($wasenc == 1) {
my $cert = GetCertificate($userinput);
if(ValidManager($cert)) {
+ chomp($userinput);
my $reply = ReinitProcess($userinput);
print $client "$reply\n";
} else {