Prevent undef warnings on perl socket read nbytes test collab/berick/perl-dead-socket-check-avoid-warnings
authorBill Erickson <berick@esilibrary.com>
Wed, 14 Mar 2012 15:38:18 +0000 (11:38 -0400)
committerBill Erickson <berick@esilibrary.com>
Thu, 15 Mar 2012 13:29:44 +0000 (09:29 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
src/perl/lib/OpenSRF/Transport/SlimJabber/XMPPReader.pm

index b8a5da1..b68e418 100644 (file)
@@ -226,7 +226,7 @@ sub wait {
         $first_read = 0;
     }
 
-    if ($nbytes == 0 and $first_read) {
+    if ($first_read and defined $nbytes and $nbytes == 0) {
         # if the first read on an active socket is 0 bytes, 
         # the socket has been disconnected from the remote end. 
         $logger->error("Disconnected from Jabber server");