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())
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):
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()
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