From 387ef513d6259e268976270ac2c658dcb3cc7823 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Fri, 1 Jun 2012 13:50:38 -0700 Subject: [PATCH] Check that the session is still alive before sending data. Fixes issue #168 --- sleekxmpp/xmlstream/xmlstream.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index 30bbaa5e..babe2f54 100644 --- a/sleekxmpp/xmlstream/xmlstream.py +++ b/sleekxmpp/xmlstream/xmlstream.py @@ -1612,7 +1612,8 @@ class XMLStream(object): tries = 0 try: with self.send_lock: - while sent < total and not self.stop.is_set(): + while sent < total and not self.stop.is_set() and + self.session_started_event.is_set(): try: sent += self.socket.send(enc_data[sent:]) count += 1