From: Brian Warner Date: Tue, 16 Jan 2007 22:12:49 +0000 (-0700) Subject: now that foolscap-0.0.7 accepts connect-to-self, allow peers to know about themselves... X-Git-Tag: tahoe_v0.1.0-0-UNSTABLE~372 X-Git-Url: https://git.rkrishnan.org/architecture.txt?a=commitdiff_plain;h=56cf2dbd7e10643037952d13cb7478a3fbd83429;p=tahoe-lafs%2Ftahoe-lafs.git now that foolscap-0.0.7 accepts connect-to-self, allow peers to know about themselves. We now require foolscap-0.0.7 --- diff --git a/src/allmydata/client.py b/src/allmydata/client.py index 203961ec..0fe2c7e6 100644 --- a/src/allmydata/client.py +++ b/src/allmydata/client.py @@ -100,8 +100,6 @@ class Client(node.Node, Referenceable): def remote_add_peers(self, new_peers): for nodeid, pburl in new_peers: - if nodeid == self.nodeid: - continue self.log("adding peer %s" % idlib.b2a(nodeid)) if nodeid in self.all_peers: self.log("weird, I already had an entry for them") diff --git a/src/allmydata/queen.py b/src/allmydata/queen.py index cb459612..c49f384f 100644 --- a/src/allmydata/queen.py +++ b/src/allmydata/queen.py @@ -32,12 +32,12 @@ class Roster(service.MultiService, Referenceable): def remote_hello(self, nodeid, node, pburl): log.msg("roster: contact from %s" % idlib.b2a(nodeid)) + self.phonebook[nodeid] = pburl + self.connections[nodeid] = node eventually(self._educate_the_new_peer, nodeid, node, list(self.phonebook.items())) eventually(self._announce_new_peer, nodeid, pburl, list(self.connections.values())) - self.phonebook[nodeid] = pburl - self.connections[nodeid] = node node.notifyOnDisconnect(self._lost_node, nodeid) return self.gvd_root diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py index f3956146..f2f53126 100644 --- a/src/allmydata/test/test_system.py +++ b/src/allmydata/test/test_system.py @@ -81,7 +81,7 @@ class SystemTest(unittest.TestCase): def wait_for_connections(self, ignored=None): for c in self.clients: - if len(c.connections) != self.numclients - 1: + if len(c.connections) != self.numclients: d = defer.Deferred() d.addCallback(self.wait_for_connections) reactor.callLater(0.05, d.callback, None) @@ -92,17 +92,17 @@ class SystemTest(unittest.TestCase): d = self.set_up_nodes() d.addCallback(lambda res: self.add_extra_node(5)) def _check(extra_node): + self.extra_node = extra_node for c in self.clients: - self.failUnlessEqual(len(c.connections), 5) - return extra_node + self.failUnlessEqual(len(c.connections), 6) d.addCallback(_check) - def _shutdown_extra_node(extra_node): - d1 = extra_node.stopService() + def _shutdown_extra_node(res): + d1 = self.extra_node.stopService() d2 = defer.Deferred() - reactor.callLater(self.DISCONNECT_DELAY, d2.callback, None) - d1.addCallback(lambda res: d2) + reactor.callLater(self.DISCONNECT_DELAY, d2.callback, res) + d1.addCallback(lambda ignored: d2) return d1 - d.addCallback(_shutdown_extra_node) + d.addBoth(_shutdown_extra_node) return d test_connections.timeout = 20 @@ -161,7 +161,7 @@ class SystemTest(unittest.TestCase): base = self.webish_url d = getPage(base) def _got_welcome(page): - expected = "Connected Peers: %d" % (self.numclients-1) + expected = "Connected Peers: %d" % (self.numclients) self.failUnless(expected in page, "I didn't see the right 'connected peers' message " "in: %s" % page