--- loncom/loncnew 2018/08/07 17:12:09 1.105 +++ loncom/loncnew 2018/12/14 02:05:38 1.108 @@ -2,7 +2,7 @@ # The LearningOnline Network with CAPA # lonc maintains the connections to remote computers # -# $Id: loncnew,v 1.105 2018/08/07 17:12:09 raeburn Exp $ +# $Id: loncnew,v 1.108 2018/12/14 02:05:38 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 @@ -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"); } @@ -2223,7 +2252,6 @@ sub KillThemAll { # Our children >will< die. # but we need to catch their death and cleanup after them in case this is # a restart set of kills - my $execdir = $perlvar{'lonDaemons'}; my @allpids = keys(%ChildPid); foreach my $pid (@allpids) { my $serving = $ChildPid{$pid};