mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-01 00:45:52 +00:00
merge incomplete stuff with other patches
This commit is contained in:
parent
e48a8b8e66
commit
b58aa3c371
@ -29,9 +29,7 @@ class Client(node.Node, Referenceable):
|
|||||||
def __init__(self, basedir="."):
|
def __init__(self, basedir="."):
|
||||||
node.Node.__init__(self, basedir)
|
node.Node.__init__(self, basedir)
|
||||||
self.queen = None # self.queen is either None or a RemoteReference
|
self.queen = None # self.queen is either None or a RemoteReference
|
||||||
self.all_peers = set()
|
self.introducer_client = None
|
||||||
self.peer_pburls = {}
|
|
||||||
self.connections = {}
|
|
||||||
self.add_service(StorageServer(os.path.join(basedir, self.STOREDIR)))
|
self.add_service(StorageServer(os.path.join(basedir, self.STOREDIR)))
|
||||||
self.add_service(Uploader())
|
self.add_service(Uploader())
|
||||||
self.add_service(Downloader())
|
self.add_service(Downloader())
|
||||||
@ -52,6 +50,9 @@ class Client(node.Node, Referenceable):
|
|||||||
|
|
||||||
def tub_ready(self):
|
def tub_ready(self):
|
||||||
self.my_pburl = self.tub.registerReference(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()
|
self.maybe_connect_to_queen()
|
||||||
|
|
||||||
def set_queen_pburl(self, queen_pburl):
|
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.queen_connector = self.tub.connectTo(self.queen_pburl,
|
||||||
self._got_queen)
|
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):
|
def stopService(self):
|
||||||
if self.introducer_client:
|
if self.introducer_client:
|
||||||
self.introducer_client.stop()
|
self.introducer_client.stop()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
from zope.interface import Interface
|
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
|
from foolscap import RemoteInterface
|
||||||
|
|
||||||
Nodeid = StringConstraint(20) # binary format 20-byte SHA1 hash
|
Nodeid = StringConstraint(20) # binary format 20-byte SHA1 hash
|
||||||
|
Loading…
x
Reference in New Issue
Block a user