Prevent undef warnings on perl socket read nbytes test
authorBill Erickson <berick@esilibrary.com>
Wed, 14 Mar 2012 15:38:18 +0000 (11:38 -0400)
committerDan Scott <dan@coffeecode.net>
Fri, 16 Mar 2012 01:35:48 +0000 (21:35 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Dan Scott <dan@coffeecode.net>
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");