checking socket connect state before sending final packet and calling shutdown (to...
[OpenSRF.git] / src / perlmods / OpenSRF / Transport / SlimJabber / XMPPReader.pm
index b0705ab..086a7a6 100644 (file)
@@ -136,8 +136,10 @@ sub connect {
 
 sub disconnect {
     my $self = shift;
-    $self->send(JABBER_DISCONNECT); 
-    shutdown($self->socket, 2);
+    if($self->tcp_connected) {
+        $self->send(JABBER_DISCONNECT); 
+        shutdown($self->socket, 2);
+    }
     close($self->socket);
 }