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