Remove some unneeded bits in the xmpp ping code. Add additional logging.

This commit is contained in:
Stephan Erb 2009-12-20 23:16:58 +01:00
parent dea4cdc073
commit 11c83109f4
2 changed files with 3 additions and 4 deletions

View File

@ -1309,7 +1309,7 @@ class Connection(CommonConnection, ConnectionHandlers):
def _on_xmpp_ping_answer(self, iq_obj): def _on_xmpp_ping_answer(self, iq_obj):
id_ = unicode(iq_obj.getAttr('id')) id_ = unicode(iq_obj.getAttr('id'))
if id_ == self.awaiting_xmpp_ping_id: assert id_ == self.awaiting_xmpp_ping_id
self.awaiting_xmpp_ping_id = None self.awaiting_xmpp_ping_id = None
def sendPing(self, pingTo=None): def sendPing(self, pingTo=None):
@ -2226,6 +2226,7 @@ class Connection(CommonConnection, ConnectionHandlers):
def check_pingalive(self): def check_pingalive(self):
if self.awaiting_xmpp_ping_id: if self.awaiting_xmpp_ping_id:
# We haven't got the pong in time, disco and reconnect # We haven't got the pong in time, disco and reconnect
log.warn("No reply received for keepalive ping. Reconnecting.")
self._disconnectedReconnCB() self._disconnectedReconnCB()
def _reconnect_alarm(self): def _reconnect_alarm(self):

View File

@ -981,8 +981,6 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream,
self.dispatch('ENTITY_TIME', (jid_stripped, resource, '')) self.dispatch('ENTITY_TIME', (jid_stripped, resource, ''))
self.entity_time_ids.remove(id_) self.entity_time_ids.remove(id_)
return return
if id_ == self.awaiting_xmpp_ping_id:
self.awaiting_xmpp_ping_id = None
errmsg = iq_obj.getErrorMsg() errmsg = iq_obj.getErrorMsg()
errcode = iq_obj.getErrorCode() errcode = iq_obj.getErrorCode()
self.dispatch('ERROR_ANSWER', (id_, jid_from, errmsg, errcode)) self.dispatch('ERROR_ANSWER', (id_, jid_from, errmsg, errcode))