set default timeout of xmpp to 45 instead of 25
This commit is contained in:
parent
e3000663fc
commit
0f41e49758
|
@ -520,6 +520,7 @@ class Connection:
|
||||||
con = common.xmpp.Client(hostname, debug = [])
|
con = common.xmpp.Client(hostname, debug = [])
|
||||||
#debug = [common.jabber.DBG_ALWAYS], log = sys.stderr, \
|
#debug = [common.jabber.DBG_ALWAYS], log = sys.stderr, \
|
||||||
#connection=common.xmlstream.TCP_SSL, port=5223, proxy = proxy)
|
#connection=common.xmlstream.TCP_SSL, port=5223, proxy = proxy)
|
||||||
|
common.xmpp.dispatcher.DefaultTimeout = 45
|
||||||
con.UnregisterDisconnectHandler(con.DisconnectHandler)
|
con.UnregisterDisconnectHandler(con.DisconnectHandler)
|
||||||
con.RegisterDisconnectHandler(self._disconnectedCB)
|
con.RegisterDisconnectHandler(self._disconnectedCB)
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -289,11 +289,12 @@ class Dispatcher(PlugIn):
|
||||||
user=0
|
user=0
|
||||||
if user and self._defaultHandler: self._defaultHandler(session,stanza)
|
if user and self._defaultHandler: self._defaultHandler(session,stanza)
|
||||||
|
|
||||||
def WaitForResponse(self, ID, timeout=DefaultTimeout):
|
def WaitForResponse(self, ID, timeout=None):
|
||||||
""" Block and wait until stanza with specific "id" attribute will come.
|
""" Block and wait until stanza with specific "id" attribute will come.
|
||||||
If no such stanza is arrived within timeout, return None.
|
If no such stanza is arrived within timeout, return None.
|
||||||
If operation failed for some reason then owner's attributes
|
If operation failed for some reason then owner's attributes
|
||||||
lastErrNode, lastErr and lastErrCode are set accordingly. """
|
lastErrNode, lastErr and lastErrCode are set accordingly. """
|
||||||
|
if timeout is None: timeout=DefaultTimeout
|
||||||
self._expected[ID]=None
|
self._expected[ID]=None
|
||||||
has_timed_out=0
|
has_timed_out=0
|
||||||
abort_time=time.time() + timeout
|
abort_time=time.time() + timeout
|
||||||
|
@ -313,8 +314,9 @@ class Dispatcher(PlugIn):
|
||||||
self._owner.lastErrCode=response.getErrorCode()
|
self._owner.lastErrCode=response.getErrorCode()
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def SendAndWaitForResponse(self, stanza, timeout=DefaultTimeout):
|
def SendAndWaitForResponse(self, stanza, timeout=None):
|
||||||
""" Put stanza on the wire and wait for recipient's response to it. """
|
""" Put stanza on the wire and wait for recipient's response to it. """
|
||||||
|
if timeout is None: timeout=DefaultTimeout
|
||||||
return self.WaitForResponse(self.send(stanza),timeout)
|
return self.WaitForResponse(self.send(stanza),timeout)
|
||||||
|
|
||||||
def SendAndCallForResponse(self, stanza, func, args={}):
|
def SendAndCallForResponse(self, stanza, func, args={}):
|
||||||
|
|
Loading…
Reference in New Issue