diff --git a/src/common/connection.py b/src/common/connection.py index f3e695530..886e1f4cf 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -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): diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py index 3ddd073dd..b02bf6229 100644 --- a/src/common/connection_handlers.py +++ b/src/common/connection_handlers.py @@ -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))