version 1.106, 2018/12/06 13:52:28
|
version 1.107, 2018/12/10 17:34:22
|
Line 94 my $executable = $0; # Get the full
|
Line 94 my $executable = $0; # Get the full
|
# |
# |
# The variables below are only used by the child processes. |
# The variables below are only used by the child processes. |
# |
# |
my $RemoteHost; # Name of host child is talking to. |
my $RemoteHost; # Hostname of host child is talking to. |
my $RemoteHostId; # default lonid 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 @all_host_ids; |
my @all_host_ids; |
my $UnixSocketDir= $perlvar{'lonSockDir'}; |
my $UnixSocketDir= $perlvar{'lonSockDir'}; |
my $IdleConnections = Stack->new(); # Set of idle connections |
my $IdleConnections = Stack->new(); # Set of idle connections |
Line 1248 sub MakeLondConnection {
|
Line 1249 sub MakeLondConnection {
|
|
|
my $Connection = LondConnection->new(&GetServerHost(), |
my $Connection = LondConnection->new(&GetServerHost(), |
&GetServerPort(), |
&GetServerPort(), |
&GetHostId()); |
&GetHostId(), |
|
&GetDefHostId()); |
|
|
if($Connection eq undef) { |
if($Connection eq undef) { |
Log("CRITICAL","Failed to make a connection with lond."); |
Log("CRITICAL","Failed to make a connection with lond."); |
Line 1549 sub GetServerHost {
|
Line 1551 sub GetServerHost {
|
|
|
=pod |
=pod |
|
|
=head2 GetServerId |
=head2 GetHostId |
|
|
Returns the hostid whose lond we talk with. |
Returns the hostid whose lond we talk with. |
|
|
Line 1561 sub GetHostId {
|
Line 1563 sub GetHostId {
|
|
|
=pod |
=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 GetServerPort |
=head2 GetServerPort |
|
|
Returns the lond port number. |
Returns the lond port number. |
Line 1822 sub ChildProcess {
|
Line 1836 sub ChildProcess {
|
# Create a new child for host passed in: |
# Create a new child for host passed in: |
|
|
sub CreateChild { |
sub CreateChild { |
my ($host, $hostid) = @_; |
my ($host, $hostid, $defhostid) = @_; |
|
|
my $sigset = POSIX::SigSet->new(SIGINT); |
my $sigset = POSIX::SigSet->new(SIGINT); |
sigprocmask(SIG_BLOCK, $sigset); |
sigprocmask(SIG_BLOCK, $sigset); |
Line 1837 sub CreateChild {
|
Line 1851 sub CreateChild {
|
undef(@all_host_ids); |
undef(@all_host_ids); |
} else { # child. |
} else { # child. |
$RemoteHostId = $hostid; |
$RemoteHostId = $hostid; |
|
$RemoteDefHostId = $defhostid; |
ShowStatus("Connected to ".$RemoteHost); |
ShowStatus("Connected to ".$RemoteHost); |
$SIG{INT} = 'DEFAULT'; |
$SIG{INT} = 'DEFAULT'; |
sigprocmask(SIG_UNBLOCK, $sigset); |
sigprocmask(SIG_UNBLOCK, $sigset); |
Line 1904 sub get_remote_hostname {
|
Line 1919 sub get_remote_hostname {
|
(my $hostname,my $lonid,@all_host_ids) = split(':',$data); |
(my $hostname,my $lonid,@all_host_ids) = split(':',$data); |
$ChildHost{$hostname}++; |
$ChildHost{$hostname}++; |
if ($ChildHost{$hostname} == 1) { |
if ($ChildHost{$hostname} == 1) { |
&CreateChild($hostname,$lonid); |
&CreateChild($hostname,$lonid,$all_host_ids[-1]); |
} else { |
} else { |
&Log('WARNING',"Request for a second child on $hostname"); |
&Log('WARNING',"Request for a second child on $hostname"); |
} |
} |