From 55dfb697a448dbc7a46739dac52a2b1502f5f897 Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@allmydata.com>
Date: Wed, 23 Apr 2008 14:52:34 -0700
Subject: [PATCH] client: don't start the IntroducerClient until the Tub is
 ready, otherwise we will sometimes connect to the introducer (or other
 clients) before we've done Tub.setLocation, which loses some information on
 the introducer status page

---
 src/allmydata/client.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/allmydata/client.py b/src/allmydata/client.py
index e21ed6ff..87f77f48 100644
--- a/src/allmydata/client.py
+++ b/src/allmydata/client.py
@@ -101,9 +101,16 @@ class Client(node.Node, testutil.PollMixin):
                               str(allmydata.__version__),
                               str(self.OLDEST_SUPPORTED_VERSION))
         self.introducer_client = ic
-        ic.setServiceParent(self)
-        # nodes that want to upload and download will need storage servers
-        ic.subscribe_to("storage")
+        # hold off on starting the IntroducerClient until our tub has been
+        # started, so we'll have a useful address on our RemoteReference, so
+        # that the introducer's status page will show us.
+        d = self.when_tub_ready()
+        def _start_introducer_client(res):
+            ic.setServiceParent(self)
+            # nodes that want to upload and download will need storage servers
+            ic.subscribe_to("storage")
+        d.addCallback(_start_introducer_client)
+        d.addErrback(log.err, facility="tahoe.init", level=log.BAD)
 
     def init_stats_provider(self):
         gatherer_furl = self.get_config('stats_gatherer.furl')
-- 
2.45.2