[LON-CAPA-cvs] cvs: loncom / LondConnection.pm lond
albertel
lon-capa-cvs@mail.lon-capa.org
Fri, 03 Mar 2006 20:06:24 -0000
albertel Fri Mar 3 15:06:24 2006 EDT
Modified files:
/loncom lond LondConnection.pm
Log:
- have lond handle the inline sethost: cmd
- set the lond version in lonc which can handle this
Index: loncom/lond
diff -u loncom/lond:1.321 loncom/lond:1.322
--- loncom/lond:1.321 Tue Feb 21 13:43:37 2006
+++ loncom/lond Fri Mar 3 15:06:21 2006
@@ -2,7 +2,7 @@
# The LearningOnline Network
# lond "LON Daemon" Server (port "LOND" 5663)
#
-# $Id: lond,v 1.321 2006/02/21 18:43:37 albertel Exp $
+# $Id: lond,v 1.322 2006/03/03 20:06:21 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -61,7 +61,7 @@
my $lastlog='';
my $lond_max_wait_time = 13;
-my $VERSION='$Revision: 1.321 $'; #' stupid emacs
+my $VERSION='$Revision: 1.322 $'; #' stupid emacs
my $remoteVERSION;
my $currenthostid="default";
my $currentdomainid;
@@ -4515,6 +4515,22 @@
# fix all the userinput -> user_input.
my $wasenc = 0; # True if request was encrypted.
# ------------------------------------------------------------ See if encrypted
+ # for command
+ # sethost:<server>
+ # <command>:<args>
+ # we just send it to the processor
+ # for
+ # sethost:<server>:<command>:<args>
+ # we do the implict set host and then do the command
+ if ($userinput =~ /^sethost:/) {
+ (my $cmd,my $newid,$userinput) = split(':',$userinput,3);
+ if (defined($userinput)) {
+ &sethost("$cmd:$newid");
+ } else {
+ $userinput = "$cmd:$newid";
+ }
+ }
+
if ($userinput =~ /^enc/) {
$userinput = decipher($userinput);
$wasenc=1;
@@ -6107,6 +6123,11 @@
sub sethost {
my ($remotereq) = @_;
my (undef,$hostid)=split(/:/,$remotereq);
+ # ignore sethost if we are already correct
+ if ($hostid eq $currenthostid) {
+ return 'ok';
+ }
+
if (!defined($hostid)) { $hostid=$perlvar{'lonHostID'}; }
if ($hostip{$perlvar{'lonHostID'}} eq $hostip{$hostid}) {
$currenthostid =$hostid;
Index: loncom/LondConnection.pm
diff -u loncom/LondConnection.pm:1.39 loncom/LondConnection.pm:1.40
--- loncom/LondConnection.pm:1.39 Fri Jan 27 15:37:12 2006
+++ loncom/LondConnection.pm Fri Mar 3 15:06:22 2006
@@ -1,7 +1,7 @@
# This module defines and implements a class that represents
# a connection to a lond daemon.
#
-# $Id: LondConnection.pm,v 1.39 2006/01/27 20:37:12 albertel Exp $
+# $Id: LondConnection.pm,v 1.40 2006/03/03 20:06:22 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -738,7 +738,7 @@
# Setup the trasaction
# currently no version of lond supports inlining the sethost
- if ($self->PeerVersion() <= 10000000) {
+ if ($self->PeerVersion() <= 321) {
if ($server ne $self->{LoncapaHim}) {
$self->{NextRequest} = $data;
$self->{TransactionRequest} = "$sethost:$server\n";
@@ -747,6 +747,7 @@
$self->{TransactionRequest} = $data;
}
} else {
+ $self->{LoncapaHim} = $server;
$self->{TransactionRequest} = "$sethost:$server:$data";
}
$self->{TransactionReply} = "";
@@ -1257,8 +1258,8 @@
#
sub PeerVersion {
my $self = shift;
- my ($version) = ($self->{LondVersion} =~ /Revision 1\.(\d+)/);
- return $self->{LondVersion};
+ my ($version) = ($self->{LondVersion} =~ /Revision: 1\.(\d+)/);
+ return $version;
}
1;