From: Zooko O'Whielacronx Date: Fri, 23 Mar 2007 23:20:26 +0000 (-0700) Subject: merge incomplete stuff with other patches X-Git-Url: https://git.rkrishnan.org/CLI.txt?a=commitdiff_plain;h=b58aa3c371abe94b9480090541462ab7c9cc539a;p=tahoe-lafs%2Ftahoe-lafs.git merge incomplete stuff with other patches --- diff --git a/src/allmydata/client.py b/src/allmydata/client.py index d628026b..b063805e 100644 --- a/src/allmydata/client.py +++ b/src/allmydata/client.py @@ -29,9 +29,7 @@ class Client(node.Node, Referenceable): def __init__(self, basedir="."): node.Node.__init__(self, basedir) self.queen = None # self.queen is either None or a RemoteReference - self.all_peers = set() - self.peer_pburls = {} - self.connections = {} + self.introducer_client = None self.add_service(StorageServer(os.path.join(basedir, self.STOREDIR))) self.add_service(Uploader()) self.add_service(Downloader()) @@ -52,6 +50,9 @@ class Client(node.Node, Referenceable): def tub_ready(self): self.my_pburl = self.tub.registerReference(self) + if self.queen_pburl: + self.introducer_client = IntroducerClient(self.tub, self.queen_pburl, self.my_pburl) + self.register_control() self.maybe_connect_to_queen() def set_queen_pburl(self, queen_pburl): @@ -71,6 +72,15 @@ class Client(node.Node, Referenceable): self.queen_connector = self.tub.connectTo(self.queen_pburl, self._got_queen) + def register_control(self): + c = ControlServer() + c.setServiceParent(self) + control_url = self.tub.registerReference(c) + f = open("control.pburl", "w") + f.write(control_url + "\n") + f.close() + os.chmod("control.pburl", 0600) + def stopService(self): if self.introducer_client: self.introducer_client.stop() diff --git a/src/allmydata/interfaces.py b/src/allmydata/interfaces.py index f33888f5..67bf189e 100644 --- a/src/allmydata/interfaces.py +++ b/src/allmydata/interfaces.py @@ -1,6 +1,6 @@ from zope.interface import Interface -from foolscap.schema import StringConstraint, ListOf, TupleOf, Any +from foolscap.schema import StringConstraint, ListOf, SetOf, TupleOf, Any from foolscap import RemoteInterface Nodeid = StringConstraint(20) # binary format 20-byte SHA1 hash