mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-13 13:05:37 +00:00
Use the deferred returned by getPage in test_listen_port.
This commit is contained in:
parent
22a982430c
commit
a8c79d1954
@ -774,16 +774,13 @@ class Core(component.Component):
|
||||
|
||||
"""
|
||||
from twisted.web.client import getPage
|
||||
d = defer.Deferred()
|
||||
|
||||
gp = getPage("http://deluge-torrent.org/test_port.php?port=%s" % self.get_listen_port())
|
||||
d = getPage("http://deluge-torrent.org/test_port.php?port=%s" % self.get_listen_port())
|
||||
|
||||
def on_get_page(result):
|
||||
d.callback(bool(int(result)))
|
||||
def on_get_page_failure(result):
|
||||
d.errback(result)
|
||||
return bool(int(result))
|
||||
|
||||
gp.addCallbacks(on_get_page, on_get_page_failure)
|
||||
d.addCallback(on_get_page)
|
||||
|
||||
return d
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user