client.py: touch BASEDIR/no_storage to not publish a storage server. Addresses #271
authorBrian Warner <warner@allmydata.com>
Sat, 2 Feb 2008 03:07:08 +0000 (20:07 -0700)
committerBrian Warner <warner@allmydata.com>
Sat, 2 Feb 2008 03:07:08 +0000 (20:07 -0700)
src/allmydata/client.py

index 92ea6fa2dd51dc005835c4c0162a3b1b31cd85aa..f18e8ea072d50d142893a8a4acbb17fe91698d07 100644 (file)
@@ -148,18 +148,17 @@ class Client(node.Node, Referenceable, testutil.PollMixin):
         self.log("tub_ready")
         node.Node.tub_ready(self)
 
-        # we use separate get_config/write_config here because we want to
-        # update the connection hints each time.
-        my_old_name = None
-        my_old_furl = self.get_config("myself.furl")
-        if my_old_furl is not None:
-            sturdy = SturdyRef(my_old_furl)
-            my_old_name = sturdy.name
-
-        self.my_furl = self.tub.registerReference(self, my_old_name)
-        self.write_config("myself.furl", self.my_furl + "\n")
-
-        ic = IntroducerClient(self.tub, self.introducer_furl, self.my_furl)
+        furl_file = os.path.join(self.basedir, "myself.furl")
+        self.my_furl = self.tub.registerReference(self, furlFile=furl_file)
+
+        # should we publish ourselves as a server?
+        provide_storage = (self.get_config("no_storage") is None)
+        if provide_storage:
+            my_furl = self.my_furl
+        else:
+            my_furl = None
+
+        ic = IntroducerClient(self.tub, self.introducer_furl, my_furl)
         self.introducer_client = ic
         ic.setServiceParent(self)