From: Brian Warner <warner@allmydata.com>
Date: Sat, 2 Feb 2008 03:07:08 +0000 (-0700)
Subject: client.py: touch BASEDIR/no_storage to not publish a storage server. Addresses #271
X-Git-Url: https://git.rkrishnan.org/%5B/frontends/flags/%22file:/webapi.txt?a=commitdiff_plain;h=054f25581cee55bfac24092772e2df5de0d6393a;p=tahoe-lafs%2Ftahoe-lafs.git

client.py: touch BASEDIR/no_storage to not publish a storage server. Addresses #271
---

diff --git a/src/allmydata/client.py b/src/allmydata/client.py
index 92ea6fa2..f18e8ea0 100644
--- a/src/allmydata/client.py
+++ b/src/allmydata/client.py
@@ -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)