added error message for cached data on a closed socket
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 22 May 2006 18:18:32 +0000 (18:18 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 22 May 2006 18:18:32 +0000 (18:18 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@4333 dcc99617-32d9-48b4-a31d-7c20da2025e4

OpenSRF/src/perlmods/OpenSRF/Transport/SlimJabber/Client.pm

index 075afcf..e646fc1 100644 (file)
@@ -578,7 +578,7 @@ sub flush_socket {
        my $self = shift;
        my $socket = $self->{_socket};
 
-       if( $socket and $socket->connected() ) {
+       if( $socket ) {
 
                my $buf;
                my      $flags = fcntl($socket, F_GETFL, 0);
@@ -586,9 +586,14 @@ sub flush_socket {
                fcntl($socket, F_SETFL, $flags | O_NONBLOCK);
                while( my $n = sysread( $socket, $buf, 8192 ) ) {
                        $logger->debug("flush_socket dropped $n bytes of data");
+                       if(!$socket->connected()) {
+                               $logger->error("flush_socket dropped data on disconnected socket: $buf");
+                       }
                }
                fcntl($socket, F_SETFL, $flags);
 
+               return 0 unless $socket->connected();
+
                return 1;
 
        } else {