def __handleDisconnect(self, reason, description): g_messengerEvents.onPluginDisconnected(PROTO_TYPE.XMPP) client = self.client() if not client: return g_logOutput.debug(CLIENT_LOG_AREA.CONNECTION, 'Client is disconnected') self.__cancelReconnectCallback() self.__cancelReqTokenCallback() if reason == DISCONNECT_REASON.AUTHENTICATION: self.__tokenRequester.clear() if self.isInGameServer() and reason != DISCONNECT_REASON.BY_REQUEST: delay = self.__connectionsInfo.getNextDelay() self.__reconnectCallbackID = BigWorld.callback(delay, self.__doNextConnect) g_logOutput.debug(CLIENT_LOG_AREA.CONNECTION, 'Will try to reconnect after {0} seconds'.format(delay), description) host, port = self.__connectionsInfo.getLastAddress() tries = self.__connectionsInfo.getTries() g_messengerEvents.onPluginConnectFailed(PROTO_TYPE.XMPP, (host, port), tries) sendEventToServer(XMPP_EVENT_LOG.DISCONNECT, host, port, reason, description, tries)
def __invokeConnectFailedEvent(self, tries): host, port = self.__connectionsInfo.getLastAddress() g_messengerEvents.onPluginConnectFailed(PROTO_TYPE.XMPP, (host, port), tries)