Use the deferred returned by getPage in test_listen_port.

This commit is contained in:
John Garland 2009-07-25 00:54:56 +00:00
parent 22a982430c
commit a8c79d1954
1 changed files with 3 additions and 6 deletions

View File

@ -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