--- loncom/LondConnection.pm 2010/12/21 11:17:33 1.50 +++ loncom/LondConnection.pm 2018/09/02 18:30:54 1.53.2.1 @@ -1,7 +1,7 @@ # This module defines and implements a class that represents # a connection to a lond daemon. # -# $Id: LondConnection.pm,v 1.50 2010/12/21 11:17:33 foxr Exp $ +# $Id: LondConnection.pm,v 1.53.2.1 2018/09/02 18:30:54 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -189,7 +189,8 @@ sub new { LocalKeyFile => "", CipherKey => "", LondVersion => "Unknown", - Cipher => undef}; + Cipher => undef, + ClientData => undef}; bless($self, $class); unless ($self->{Socket} = IO::Socket::INET->new(PeerHost => $self->{Host}, PeerPort => $self->{Port}, @@ -200,6 +201,7 @@ sub new { return undef; # Inidicates the socket could not be made. } my $socket = $self->{Socket}; # For local use only. + $socket->sockopt(SO_KEEPALIVE, 1); # Turn on keepalive probes when idle. # If we are local, we'll first try local auth mode, otherwise, we'll try # the ssl auth mode: @@ -340,9 +342,12 @@ sub Readable { $self->Transition("Disconnected"); return -1; } - # Append the data to the buffer. And figure out if the read is done: + # If we actually got data, reset the timeout. - $self->{TimeoutRemaining} = $self->{TimeoutValue}; # getting data resets the timeout period. + if (length $data) { + $self->{TimeoutRemaining} = $self->{TimeoutValue}; # getting data resets the timeout period. + } + # Append the data to the buffer. And figure out if the read is done: &Debug(9,"Received from host: ".$data); $self->{TransactionReply} .= $data; @@ -1140,6 +1145,30 @@ sub PeerVersion { return $version; } +# +# Manipulate the client data field +# +sub SetClientData { + my ($self, $newData) = @_; + $self->{ClientData} = $newData; +} +# +# Get the current client data field. +# +sub GetClientData { + my $self = shift; + return $self->{ClientData}; +} + +# +# Get the HostID of our peer +# + +sub PeerLoncapaHim { + my $self = shift; + return $self->{LoncapaHim}; +} + 1; =pod