--- loncom/loncnew 2018/12/06 13:52:28 1.106 +++ loncom/loncnew 2020/01/12 01:21:33 1.109 @@ -2,7 +2,7 @@ # The LearningOnline Network with CAPA # lonc maintains the connections to remote computers # -# $Id: loncnew,v 1.106 2018/12/06 13:52:28 raeburn Exp $ +# $Id: loncnew,v 1.109 2020/01/12 01:21:33 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -94,8 +94,10 @@ my $executable = $0; # Get the full # # The variables below are only used by the child processes. # -my $RemoteHost; # Name of host child is talking to. -my $RemoteHostId; # default lonid of host child is talking to. +my $RemoteHost; # Hostname of host child is talking to. +my $RemoteHostId; # lonid of host child is talking to. +my $RemoteDefHostId; # default lonhostID of host child is talking to. +my $RemoteLoncapaRev; # LON-CAPA version of host child is talking to. my @all_host_ids; my $UnixSocketDir= $perlvar{'lonSockDir'}; my $IdleConnections = Stack->new(); # Set of idle connections @@ -612,7 +614,7 @@ sub CompleteTransaction { StartClientReply($Transaction, $data); } else { # Delete deferred transaction file. Log("SUCCESS", "A delayed transaction was completed"); - LogPerm("S:".$Socket->PeerLoncapaHim().":".$Transaction->getRequest()); + LogPerm("S:".$Transaction->getClient().":".$Transaction->getRequest()); unlink($Transaction->getFile()); } } @@ -670,7 +672,6 @@ Parameters: =item client The LondTransaction we are failing. - =cut @@ -1248,7 +1249,9 @@ sub MakeLondConnection { my $Connection = LondConnection->new(&GetServerHost(), &GetServerPort(), - &GetHostId()); + &GetHostId(), + &GetDefHostId(), + &GetLoncapaRev()); if($Connection eq undef) { Log("CRITICAL","Failed to make a connection with lond."); @@ -1549,7 +1552,7 @@ sub GetServerHost { =pod -=head2 GetServerId +=head2 GetHostId Returns the hostid whose lond we talk with. @@ -1561,6 +1564,30 @@ sub GetHostId { =pod +=head2 GetDefHostId + +Returns the default hostid for the node whose lond we talk with. + +=cut + +sub GetDefHostId { # Setup by the fork. + return $RemoteDefHostId; +} + +=pod + +=head2 GetLoncapaRev + +Returns the LON-CAPA version for the node whose lond we talk with. + +=cut + +sub GetLoncapaRev { + return $RemoteLoncapaRev; # Setup by the fork. +} + +=pod + =head2 GetServerPort Returns the lond port number. @@ -1822,7 +1849,7 @@ sub ChildProcess { # Create a new child for host passed in: sub CreateChild { - my ($host, $hostid) = @_; + my ($host, $hostid, $defhostid, $loncaparev) = @_; my $sigset = POSIX::SigSet->new(SIGINT); sigprocmask(SIG_BLOCK, $sigset); @@ -1837,6 +1864,8 @@ sub CreateChild { undef(@all_host_ids); } else { # child. $RemoteHostId = $hostid; + $RemoteDefHostId = $defhostid; + $RemoteLoncapaRev = $loncaparev; ShowStatus("Connected to ".$RemoteHost); $SIG{INT} = 'DEFAULT'; sigprocmask(SIG_UNBLOCK, $sigset); @@ -1904,7 +1933,7 @@ sub get_remote_hostname { (my $hostname,my $lonid,@all_host_ids) = split(':',$data); $ChildHost{$hostname}++; if ($ChildHost{$hostname} == 1) { - &CreateChild($hostname,$lonid); + &CreateChild($hostname,$lonid,$all_host_ids[-1]); } else { &Log('WARNING',"Request for a second child on $hostname"); }