From 0e8eb9941052d826a52887fd1a46201122865bea Mon Sep 17 00:00:00 2001 From: daniceexi Date: Wed, 9 Oct 2013 08:55:31 -0400 Subject: [PATCH] defect 3183: check the socket sending result so that do the retry for sending failed --- xCAT-server/sbin/xcatd | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index eda5b8008..372b5855f 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -876,6 +876,9 @@ until ($quit) { next; #just keep pulling things off listen queue onto our own } my $cnnection=shift @pendingconnections; + my $previous = select ($cnnection); #assure that perl buffering is not in play at the low level + $|=1; + select ($previous); my $connection; my $child = xCAT::Utils->xfork(); #Yes we fork, IO::Socket::SSL is not threadsafe.. if ($child) { @@ -912,6 +915,9 @@ until ($quit) { unless ($connection) { xexit 0; } + $previous=select($connection); #also assure buffering not in play at SSL socket, which seems to be possibly independent of lower socket + $|=1; + select($previous); $clientselect->add($connection); my $peerhost=undef; my $peerfqdn=undef; @@ -1733,6 +1739,7 @@ sub service_connection { do { $bytesread=sysread($sock,$line,65536,length($line)) } while ($bytesread); if (length($line)==0) { if (not defined $bytesread and $! == EAGAIN) { next; } # + if (not defined $bytesread and ($! == EAGAIN or $! == ECHILD)) { next; } # ECHILD makes no sense, but some platform does it last; } $flags=fcntl($sock,F_GETFL,0); @@ -1885,7 +1892,9 @@ sub send_pending_responses { $blocks += 1; } foreach (0..$blocks) { + do { syswrite($sock,$resp,4096,$_*4096); + } while (($! == EAGAIN) or ($! == ECHILD)); } }; }