diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2018-10-27 23:21:27 +0200 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2018-10-27 23:21:27 +0200 |
commit | e241d4e3c74a7414a01c0a4f8bfd2f80a3853545 (patch) | |
tree | f484ab4126de2b8abae33e104ba694d096893e69 | |
parent | bd22a41a783615f415f9f5f6f530b8b2ba226952 (diff) | |
download | slixmpp-e241d4e3c74a7414a01c0a4f8bfd2f80a3853545.tar.gz slixmpp-e241d4e3c74a7414a01c0a4f8bfd2f80a3853545.tar.bz2 slixmpp-e241d4e3c74a7414a01c0a4f8bfd2f80a3853545.tar.xz slixmpp-e241d4e3c74a7414a01c0a4f8bfd2f80a3853545.zip |
XEP-0030: Don’t call the timeout_callback on each domain which doesn’t reply to disco#info.
-rw-r--r-- | slixmpp/plugins/xep_0030/disco.py | 10 | ||||
-rw-r--r-- | slixmpp/plugins/xep_0363/http_upload.py | 11 |
2 files changed, 10 insertions, 11 deletions
diff --git a/slixmpp/plugins/xep_0030/disco.py b/slixmpp/plugins/xep_0030/disco.py index 460a9134..59b1e0cc 100644 --- a/slixmpp/plugins/xep_0030/disco.py +++ b/slixmpp/plugins/xep_0030/disco.py @@ -299,18 +299,18 @@ class XEP_0030(BasePlugin): return self.api['has_identity'](jid, node, ifrom, data) async def get_info_from_domain(self, domain=None, timeout=None, - cached=True, callback=None, **kwargs): + cached=True, callback=None): if domain is None: domain = self.xmpp.boundjid.domain if not cached or domain not in self.domain_infos: infos = [self.get_info( - domain, timeout=timeout, **kwargs)] + domain, timeout=timeout)] iq_items = await self.get_items( - domain, timeout=timeout, **kwargs) + domain, timeout=timeout) items = iq_items['disco_items']['items'] infos += [ - self.get_info(item[0], timeout=timeout, **kwargs) + self.get_info(item[0], timeout=timeout) for item in items] info_futures, _ = await asyncio.wait( infos, @@ -319,7 +319,7 @@ class XEP_0030(BasePlugin): ) self.domain_infos[domain] = [ - future.result() for future in info_futures] + future.result() for future in info_futures if not future.exception()] results = self.domain_infos[domain] diff --git a/slixmpp/plugins/xep_0363/http_upload.py b/slixmpp/plugins/xep_0363/http_upload.py index 77ccfc01..2228ca8b 100644 --- a/slixmpp/plugins/xep_0363/http_upload.py +++ b/slixmpp/plugins/xep_0363/http_upload.py @@ -67,10 +67,9 @@ class XEP_0363(BasePlugin): def _handle_request(self, iq): self.xmpp.event('http_upload_request', iq) - async def find_upload_service(self, domain=None, timeout=None, timeout_callback=None): + async def find_upload_service(self, domain=None, timeout=None): results = await self.xmpp['xep_0030'].get_info_from_domain( - domain=domain, - timeout=timeout, timeout_callback=timeout_callback) + domain=domain, timeout=timeout) candidates = [] for info in results: @@ -101,8 +100,7 @@ class XEP_0363(BasePlugin): ''' Helper function which does all of the uploading process. ''' if self.upload_service is None: info_iq = await self.find_upload_service( - domain=domain, - timeout=timeout, timeout_callback=timeout_callback) + domain=domain, timeout=timeout) if info_iq is None: raise UploadServiceNotFound() self.upload_service = info_iq['from'] @@ -133,7 +131,8 @@ class XEP_0363(BasePlugin): basename = os.path.basename(filename) slot_iq = await self.request_slot(self.upload_service, basename, size, - content_type, ifrom, timeout) + content_type, ifrom, timeout, + timeout_callback=timeout_callback) slot = slot_iq['http_upload_slot'] headers = { |