[Patches] [PATCH] Bug 6466 - hung socket read causes SIP tests to fail

koha-patchbot at kohaaloha.com koha-patchbot at kohaaloha.com
Sat Dec 31 20:10:03 NZDT 2011


From: JAMES Mason <mason at kohaaloha.com>
Date: Mon, 6 Jun 2011 16:10:39 +1200
Subject: [PATCH] Bug 6466 - hung socket read causes SIP tests to fail

Signed-off-by: Chris Cormack <chris at bigballofwax.co.nz>
---
 C4/SIP/t/SIPtest.pm |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/C4/SIP/t/SIPtest.pm b/C4/SIP/t/SIPtest.pm
index 62d5646..0504d23 100644
--- a/C4/SIP/t/SIPtest.pm
+++ b/C4/SIP/t/SIPtest.pm
@@ -185,10 +185,14 @@ sub one_msg {
 
     # If reading or writing fails, then the server's dead,
     # so there's no point in continuing.
-    if (!write_msg({seqno => $seqno}, $test->{msg}, $sock)) {
-		BAIL_OUT("Write failure in $test->{id}");
-    } elsif (!($resp = <$sock>)) {
-		BAIL_OUT("Read failure in $test->{id}");
+    if ( !write_msg( { seqno => $seqno }, $test->{msg}, $sock ) ) {
+        BAIL_OUT("Write failure in $test->{id}");
+    }
+
+    my $rv = sysread( $sock, $resp, 10000000 ); # 10000000 is a big number
+
+    if ( !$rv ) {
+        BAIL_OUT("Read failure in $test->{id}");
     }
 
 	chomp($resp);
-- 
1.7.5.4


More information about the Patches mailing list