summaryrefslogtreecommitdiff
path: root/sleekxmpp
diff options
context:
space:
mode:
Diffstat (limited to 'sleekxmpp')
-rw-r--r--sleekxmpp/__init__.py2
-rw-r--r--sleekxmpp/basexmpp.py2
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py34
3 files changed, 26 insertions, 12 deletions
diff --git a/sleekxmpp/__init__.py b/sleekxmpp/__init__.py
index 8436e031..8e664a7f 100644
--- a/sleekxmpp/__init__.py
+++ b/sleekxmpp/__init__.py
@@ -150,8 +150,6 @@ class ClientXMPP(basexmpp, XMLStream):
XMLStream.reconnect(self)
def disconnect(self, init=True, close=False, reconnect=False):
- print "** Called -- disconnected"
- # raise TypeError
self.event("disconnected")
XMLStream.disconnect(self, reconnect)
diff --git a/sleekxmpp/basexmpp.py b/sleekxmpp/basexmpp.py
index 1f074910..0b819c7a 100644
--- a/sleekxmpp/basexmpp.py
+++ b/sleekxmpp/basexmpp.py
@@ -138,7 +138,7 @@ class basexmpp(object):
return self.getId()
def add_handler(self, mask, pointer, disposable=False, threaded=False, filter=False):
- logging.warning("Deprecated add_handler used for %s: %s." % (mask, pointer))
+ #logging.warning("Deprecated add_handler used for %s: %s." % (mask, pointer))
self.registerHandler(XMLCallback('add_handler_%s' % self.getNewId(), MatchXMLMask(mask), pointer, threaded, disposable))
def getId(self):
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py
index e5d5f583..1c47d9ae 100644
--- a/sleekxmpp/xmlstream/xmlstream.py
+++ b/sleekxmpp/xmlstream/xmlstream.py
@@ -196,13 +196,25 @@ class XMLStream(object):
self.state.set('processing', False)
self.state.set('reconnect', False)
self.disconnect()
- raise
+ return
except CloseStream:
- break
+ return
+ except SystemExit:
+ return
+ except socket.EBADF:
+ if not self.state.reconnect:
+ return
+ else:
+ self.state.set('processing', False)
+ traceback.print_exc()
+ self.disconnect(reconnect=True)
except:
- self.state.set('processing', False)
- traceback.print_exc()
- self.disconnect(reconnect=True)
+ if not self.state.reconnect:
+ return
+ else:
+ self.state.set('processing', False)
+ traceback.print_exc()
+ self.disconnect(reconnect=True)
if self.state['reconnect']:
self.reconnect()
self.state.set('processing', False)
@@ -247,9 +259,10 @@ class XMLStream(object):
try:
self.socket.send(data)
except socket.error,(errno, strerror):
- logging.error("Disconnected. Socket Error #%s: %s" % (errno,strerror))
self.state.set('connected', False)
- self.disconnect(reconnect=True)
+ if self.state.reconnect:
+ logging.error("Disconnected. Socket Error #%s: %s" % (errno,strerror))
+ self.disconnect(reconnect=True)
return False
return True
@@ -264,9 +277,12 @@ class XMLStream(object):
self.filesocket.close()
self.socket.shutdown(socket.SHUT_RDWR)
except socket.error,(errno,strerror):
- logging.warning("Error while disconnecting. Socket Error #%s: %s" % (errno, strerror))
+ #logging.warning("Error while disconnecting. Socket Error #%s: %s" % (errno, strerror))
+ #thread.exit_thread()
+ pass
if self.state['processing']:
- raise CloseStream
+ #raise CloseStream
+ pass
def reconnect(self):
self.state.set('tls',False)