[LON-CAPA-cvs] cvs: loncom / LondConnection.pm
foxr
lon-capa-cvs@mail.lon-capa.org
Sun, 03 Aug 2003 00:45:54 -0000
foxr Sat Aug 2 20:45:54 2003 EDT
Modified files:
/loncom LondConnection.pm
Log:
1. Shorten the connection timeout to 5 seconds so lonnet in loncron
doesn't take forever in the presence of down nodes.
2. Correct the handling of failed sends... an errno of 0 should be an error
as it indicates a end file condition which means the remote peer hung up
on us. This is the probable cause of the compute bound looping of
loncnew.
Index: loncom/LondConnection.pm
diff -u loncom/LondConnection.pm:1.7 loncom/LondConnection.pm:1.8
--- loncom/LondConnection.pm:1.7 Tue Jul 1 21:12:35 2003
+++ loncom/LondConnection.pm Sat Aug 2 20:45:54 2003
@@ -1,7 +1,7 @@
# This module defines and implements a class that represents
# a connection to a lond daemon.
#
-# $Id: LondConnection.pm,v 1.7 2003/07/02 01:12:35 foxr Exp $
+# $Id: LondConnection.pm,v 1.8 2003/08/03 00:45:54 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -153,7 +153,8 @@
unless ($self->{Socket} = IO::Socket::INET->new(PeerHost => $self->{Host},
PeerPort => $self->{Port},
Type => SOCK_STREAM,
- Proto => "tcp")) {
+ Proto => "tcp",
+ Timeout => 5)) {
return undef; # Inidicates the socket could not be made.
}
#
@@ -215,11 +216,10 @@
my $rv = $socket->recv($data, POSIX::BUFSIZ, 0);
my $errno = $! + 0; # Force numeric context.
- unless (defined($rv) && (length($data)> 0)) {# Read failed,
+ unless (defined($rv) && length $data) {# Read failed,
if(($errno == POSIX::EWOULDBLOCK) ||
($errno == POSIX::EAGAIN) ||
- ($errno == POSIX::EINTR) ||
- ($errno == 0)) {
+ ($errno == POSIX::EINTR)) {
return 0;
}