]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
introducer_and_vdrive.py: use logpublisher too
authorBrian Warner <warner@allmydata.com>
Tue, 20 Nov 2007 21:22:26 +0000 (14:22 -0700)
committerBrian Warner <warner@allmydata.com>
Tue, 20 Nov 2007 21:22:26 +0000 (14:22 -0700)
src/allmydata/introducer.py
src/allmydata/node.py

index 86015e00c0e2b001557c4206f7220ca6775c63fe..7b6011403741214e5af704eececd03efefef02f8 100644 (file)
@@ -16,6 +16,24 @@ class IntroducerNode(node.Node):
     DEFAULT_K, DEFAULT_DESIRED, DEFAULT_N = 3, 7, 10
 
     def tub_ready(self):
+        i = Introducer()
+        r = self.add_service(i)
+        self.urls["introducer"] = self.tub.registerReference(r, "introducer")
+        self.log(" introducer is at %s" % self.urls["introducer"])
+        self.write_config("introducer.furl", self.urls["introducer"] + "\n")
+
+        vdrive_dir = os.path.join(self.basedir, self.VDRIVEDIR)
+        vds = self.add_service(VirtualDriveServer(vdrive_dir))
+        vds_furl = self.tub.registerReference(vds, "vdrive")
+        vds.set_furl(vds_furl)
+        self.urls["vdrive"] = vds_furl
+        self.log(" vdrive is at %s" % self.urls["vdrive"])
+        self.write_config("vdrive.furl", self.urls["vdrive"] + "\n")
+
+        encoding_parameters = self._read_encoding_parameters()
+        i.set_encoding_parameters(encoding_parameters)
+
+    def _read_encoding_parameters(self):
         k, desired, n = self.DEFAULT_K, self.DEFAULT_DESIRED, self.DEFAULT_N
         data = self.get_config("encoding_parameters")
         if data is not None:
@@ -85,7 +103,7 @@ class IntroducerClient(service.Service, Referenceable):
         self.introducer_reconnector = self.tub.connectTo(self.introducer_furl,
                                                          self._got_introducer)
         def connect_failed(failure):
-            self.log("\n\nInitial Introducer connection failed: "
+            self.log("\n\nInitial IntroducerAndVdrive connection failed: "
                      "perhaps it's down\n")
             self.log(str(failure))
         d = self.tub.getReference(self.introducer_furl)
index ff1345c26fba2144ebcfef8ca45fa892e22e2f83..6bf1e0284a26463a1a69282d14ecc0938f965c42 100644 (file)
@@ -286,6 +286,9 @@ class Node(service.MultiService):
 
     def tub_ready(self):
         # called when the Tub is available for registerReference
+        self.setup_log_publisher()
+
+    def setup_log_publisher(self):
         self.add_service(LogPublisher())
         log_gatherer_furl = self.get_config("log_gatherer.furl")
         if log_gatherer_furl: