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

foxr lon-capa-cvs@mail.lon-capa.org
Mon, 03 Nov 2003 10:39:24 -0000


foxr		Mon Nov  3 05:39:24 2003 EDT

  Modified files:              
    /loncom	lonManage 
  Log:
  Block out top level logic for standalone operation.. NOTE:  lonManage
  will not work until further notice (the logic is all stubs for now).
  
  
Index: loncom/lonManage
diff -u loncom/lonManage:1.20 loncom/lonManage:1.21
--- loncom/lonManage:1.20	Mon Nov  3 05:24:49 2003
+++ loncom/lonManage	Mon Nov  3 05:39:24 2003
@@ -3,9 +3,9 @@
 #
 #  lonManage supports remote management of nodes in a LonCAPA cluster.
 #
-#  $Id: lonManage,v 1.20 2003/11/03 10:24:49 foxr Exp $
+#  $Id: lonManage,v 1.21 2003/11/03 10:39:24 foxr Exp $
 #
-# $Id: lonManage,v 1.20 2003/11/03 10:24:49 foxr Exp $
+# $Id: lonManage,v 1.21 2003/11/03 10:39:24 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -73,6 +73,7 @@
 
 my $MyHost="";			# Host name to use as me.
 my $ForeignHostTab="";		# Name of foreign hosts table.
+my $ServerPort;			# Port used to connect to lond.
 
 #
 #   prints out utility's command usage info.
@@ -110,9 +111,25 @@
 
 
 }
+
+sub MakeLondConnection {
+    my $host = shift;
+    return "junk";
+}
+
+sub NegotiateStartup {
+    my $connection = shift;
+
+    return "ok";
+}
+sub PerformTransaction {
+    my $connection  = shift;
+    my $command     = shift;
+
+    return "ok";
+}
 #
-#   Lifted from lonnet.pm - and we need to figure out a way to get it back in.
-#   Performas a transaction with lond via the lonc proxy server.
+# Performs a transaction direct to a remote lond.
 #   Parameter:
 #      cmd  - The text of the request.
 #      host - The host to which the request ultimately goes.
@@ -121,17 +138,33 @@
 #      lond/lonc etc.
 #
 sub subreply {
-    my ($cmd,$server)=@_;
-    my $peerfile="$perlvar{'lonSockDir'}/$server";
-    my $client=IO::Socket::UNIX->new(Peer    =>"$peerfile",
-                                     Type    => SOCK_STREAM,
-                                     Timeout => 10)
-       or return "con_lost";
-    print $client "$cmd\n";
-    my $answer=<$client>;
-    if (!$answer) { $answer="con_lost"; }
-    chomp($answer);
-    return $answer;
+    my $cmd = shift;
+    my $host = shift;
+
+
+    my $connection  = MakeLondConnection($host);
+    if ($connection eq undef) {
+	return "Connect Failed";
+    }
+    my $reply = NegotiateStartup($connection);
+    if($reply != "ok") {
+	return "connection negotiation failed";
+    }
+    my $reply =  PerformTransaction($connection, $cmd);
+    return $reply;
+
+
+     #    my ($cmd,$server)=@_;
+     #    my $peerfile="$perlvar{'lonSockDir'}/$server";
+     #    my $client=IO::Socket::UNIX->new(Peer    =>"$peerfile",
+     #                                     Type    => SOCK_STREAM,
+     #                                     Timeout => 10)
+     #       or return "con_lost";
+     #    print $client "$cmd\n";
+     #    my $answer=<$client>;
+     #    if (!$answer) { $answer="con_lost"; }
+     #    chomp($answer);
+     #    return $answer;
 }
 #   >>> BUGBUG <<< 
 #
@@ -242,11 +275,11 @@
 					    "$perlvar{'lonTabDir'}/hosts.tab");
 	%hostshash     = %{$hoststab};
 	$MyHost        = $perlvar{lonHostID}; # Set hostname from vars.
+	$ServerPort    = $perlvar{londPort};
     } else {
 	my $hoststab   = LondConnection::read_hosts($ForeignHostTab);
 	%hostshash     = %{$hoststab};
-	$perlvar{londPort}   = 5663;
-	$perlvar{lonSockDir} = "/home/httpd/sockets";
+	$ServerPort    = 5663;
     }
 
 }