From: Brian Warner <warner@allmydata.com>
Date: Thu, 7 Dec 2006 19:47:40 +0000 (-0700)
Subject: allow webfront to use a strports port specification
X-Git-Tag: tahoe_v0.1.0-0-UNSTABLE~442
X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/uri/%22file:/FOOURL?a=commitdiff_plain;h=2a5e4f3ef6c1a36092300ef540fa1d7f7ab3ccb8;p=tahoe-lafs%2Ftahoe-lafs.git

allow webfront to use a strports port specification
---

diff --git a/allmydata/client.py b/allmydata/client.py
index 122166c3..360cdc93 100644
--- a/allmydata/client.py
+++ b/allmydata/client.py
@@ -37,7 +37,7 @@ class Client(node.Node, Referenceable):
         WEBPORTFILE = os.path.join(self.basedir, self.WEBPORTFILE)
         if os.path.exists(WEBPORTFILE):
             f = open(WEBPORTFILE, "r")
-            webport = int(f.read())
+            webport = f.read() # strports string
             f.close()
             self.add_service(WebishServer(webport))
         self.queen_pburl = None
diff --git a/allmydata/webish.py b/allmydata/webish.py
index 2346e0f9..7dcb332e 100644
--- a/allmydata/webish.py
+++ b/allmydata/webish.py
@@ -1,5 +1,5 @@
 
-from twisted.application import service, internet
+from twisted.application import service, strports
 from twisted.web import static, resource, server
 from twisted.python import util, log
 from nevow import inevow, rend, loaders, appserver, url, tags as T
@@ -18,7 +18,6 @@ class IClient(Interface):
 
 class WebishServer(service.MultiService):
     name = "webish"
-    WEBPORTFILE = "webport"
 
     def __init__(self, webport):
         service.MultiService.__init__(self)
@@ -28,7 +27,9 @@ class WebishServer(service.MultiService):
         root.putChild("vdrive",
                       static.Data("sorry, still initializing", "text/plain"))
         self.site = site = appserver.NevowSite(root)
-        internet.TCPServer(webport, site).setServiceParent(self)
+        s = strports.service(webport, site)
+        s.setServiceParent(self)
+        self.listener = s # stash it so the tests can query for the portnum
 
     def startService(self):
         service.MultiService.startService(self)