fix losing-client-connection handler

This commit is contained in:
Brian Warner 2006-11-30 18:13:46 -07:00
parent 646f888bbd
commit f49a7a95c7

View File

@ -88,6 +88,7 @@ class Client(service.MultiService, Referenceable):
if nodeid not in self.connections: if nodeid not in self.connections:
d = self.tub.getReference(pburl) d = self.tub.getReference(pburl)
def _got_reference(ref): def _got_reference(ref):
log.msg("connected to %s" % nodeid)
if nodeid in self.all_peers: if nodeid in self.all_peers:
self.connections[nodeid] = ref self.connections[nodeid] = ref
d.addCallback(_got_reference) d.addCallback(_got_reference)
@ -96,7 +97,7 @@ class Client(service.MultiService, Referenceable):
for nodeid in lost_peers: for nodeid in lost_peers:
log.msg("lost peer %s" % nodeid) log.msg("lost peer %s" % nodeid)
if nodeid in self.all_peers: if nodeid in self.all_peers:
del self.all_peers[nodeid] self.all_peers.remove(nodeid)
else: else:
log.msg("weird, I didn't have an entry for them") log.msg("weird, I didn't have an entry for them")
if nodeid in self.connections: if nodeid in self.connections: