--- loncom/Attic/lonManage 2003/11/03 10:24:49 1.20 +++ loncom/Attic/lonManage 2003/11/03 10:39:24 1.21 @@ -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 %hostshash; # Host table as a host 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 @@ USAGE } + +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 @@ USAGE # 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 @@ sub ReadConfig { "$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; } }