* fixed xmlstream bugs with unexpected disconnect

This commit is contained in:
Nathan Fritz 2009-08-21 00:26:57 +00:00
parent 9cbc29149f
commit 00d46ee2b0

View file

@ -258,10 +258,11 @@ class XMLStream(object):
data = data.encode('utf-8') data = data.encode('utf-8')
try: try:
self.socket.send(data) self.socket.send(data)
except socket.error,(errno, strerror): #except socket.error,(errno, strerror):
except:
self.state.set('connected', False) self.state.set('connected', False)
if self.state.reconnect: if self.state.reconnect:
logging.error("Disconnected. Socket Error #%s: %s" % (errno,strerror)) logging.error("Disconnected. Socket Error.")
self.disconnect(reconnect=True) self.disconnect(reconnect=True)
return False return False
return True return True