core (disco): added a timeout to get items
This commit is contained in:
parent
3a983b17db
commit
85b3c92376
1 changed files with 6 additions and 1 deletions
|
|
@ -24,6 +24,7 @@ log = getLogger(__name__)
|
|||
from twisted.words.protocols.jabber import jid
|
||||
from twisted.words.protocols.jabber.error import StanzaError
|
||||
from twisted.internet import defer
|
||||
from twisted.internet import reactor
|
||||
from sat.core.constants import Const as C
|
||||
from wokkel import disco
|
||||
from base64 import b64encode
|
||||
|
|
@ -33,6 +34,7 @@ from hashlib import sha1
|
|||
PRESENCE = '/presence'
|
||||
NS_ENTITY_CAPABILITY = 'http://jabber.org/protocol/caps'
|
||||
CAPABILITY_UPDATE = PRESENCE + '/c[@xmlns="' + NS_ENTITY_CAPABILITY + '"]'
|
||||
TIMEOUT = 15
|
||||
|
||||
class HashGenerationError(Exception):
|
||||
pass
|
||||
|
|
@ -169,6 +171,7 @@ class Discovery(object):
|
|||
d = self.getItems(jid_, profile_key)
|
||||
d.addCallback(gotItems)
|
||||
d.addCallback(lambda dummy: found_entities)
|
||||
reactor.callLater(TIMEOUT, d.cancel) # FIXME: one bad service make a general timeout
|
||||
return d
|
||||
|
||||
def findFeaturesSet(self, features, category=None, type_=None, jid_=None, profile_key=C.PROF_KEY_NONE):
|
||||
|
|
@ -213,6 +216,7 @@ class Discovery(object):
|
|||
d = self.getItems(jid_, profile_key)
|
||||
d.addCallback(gotItems)
|
||||
d.addCallback(lambda dummy: found_entities)
|
||||
reactor.callLater(TIMEOUT, d.cancel) # FIXME: one bad service make a general timeout
|
||||
return d
|
||||
|
||||
def generateHash(self, services):
|
||||
|
|
|
|||
Loading…
Reference in a new issue