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

View File

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