core, plugin misc_account: set XMPP connection max retries to 0 when checking if an external account exists
This commit is contained in:
parent
ffee469c3e
commit
f3a5cb2a96
1 changed files with 11 additions and 8 deletions
|
|
@ -251,12 +251,13 @@ class SAT(service.Service):
|
|||
profile = self.memory.getProfileName(profile_key)
|
||||
return self.asyncConnect(profile, password)
|
||||
|
||||
def asyncConnect(self, profile, password=''):
|
||||
def asyncConnect(self, profile, password='', max_retries=C.XMPP_MAX_RETRIES):
|
||||
"""Retrieve the individual parameters, authenticate the profile
|
||||
and initiate the connection to the associated XMPP server.
|
||||
|
||||
@param password (string): the SàT profile password
|
||||
@param profile: %(doc_profile)s
|
||||
@param password (string): the SàT profile password
|
||||
@param max_retries (int): max number of connection retries
|
||||
@return (D(bool)):
|
||||
- True if the XMPP connection was already established
|
||||
- False if the XMPP connection has been initiated (it may still fail)
|
||||
|
|
@ -266,7 +267,7 @@ class SAT(service.Service):
|
|||
if self.isConnected(profile):
|
||||
log.info(_("already connected !"))
|
||||
return True
|
||||
d = self._connectXMPPClient(profile)
|
||||
d = self._connectXMPPClient(profile, max_retries)
|
||||
return d.addCallback(lambda dummy: False)
|
||||
|
||||
d = self.memory.startSession(password, profile)
|
||||
|
|
@ -274,7 +275,7 @@ class SAT(service.Service):
|
|||
return d
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def _connectXMPPClient(self, profile):
|
||||
def _connectXMPPClient(self, profile, max_retries):
|
||||
"""This part is called from asyncConnect when we have loaded individual parameters from memory"""
|
||||
try:
|
||||
port = int(self.memory.getParamA(C.FORCE_PORT_PARAM, "Connection", profile_key=profile))
|
||||
|
|
@ -285,7 +286,8 @@ class SAT(service.Service):
|
|||
password = yield self.memory.asyncGetParamA("Password", "Connection", profile_key=profile)
|
||||
current = self.profiles[profile] = xmpp.SatXMPPClient(self, profile,
|
||||
jid.JID(self.memory.getParamA("JabberID", "Connection", profile_key=profile)),
|
||||
password, self.memory.getParamA(C.FORCE_SERVER_PARAM, "Connection", profile_key=profile), port)
|
||||
password, self.memory.getParamA(C.FORCE_SERVER_PARAM, "Connection", profile_key=profile),
|
||||
port, max_retries)
|
||||
|
||||
current.messageProt = xmpp.SatMessageProtocol(self)
|
||||
current.messageProt.setHandlerParent(current)
|
||||
|
|
|
|||
Loading…
Reference in a new issue