mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-02 19:26:44 +00:00
start developing Roster, track all active peers
This commit is contained in:
parent
cc86df067b
commit
158fc107c0
@ -12,7 +12,7 @@ reactor.installResolver(BlockingResolver())
|
|||||||
class Storage(service.MultiService, Referenceable):
|
class Storage(service.MultiService, Referenceable):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class Client(service.MultiService):
|
class Client(service.MultiService, Referenceable):
|
||||||
CERTFILE = "client.pem"
|
CERTFILE = "client.pem"
|
||||||
AUTHKEYSFILE = "authorized_keys"
|
AUTHKEYSFILE = "authorized_keys"
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ class Client(service.MultiService):
|
|||||||
log.msg("connected to queen")
|
log.msg("connected to queen")
|
||||||
self.queen = queen
|
self.queen = queen
|
||||||
queen.notifyOnDisconnect(self._lost_queen)
|
queen.notifyOnDisconnect(self._lost_queen)
|
||||||
queen.callRemote("hello", urls=self.urls)
|
queen.callRemote("hello", nodeid=self.tub.tubID, self=self, urls=self.urls)
|
||||||
|
|
||||||
def _lost_queen(self):
|
def _lost_queen(self):
|
||||||
log.msg("lost connection to queen")
|
log.msg("lost connection to queen")
|
||||||
|
@ -6,8 +6,19 @@ import os.path
|
|||||||
from allmydata.util.iputil import get_local_ip_for
|
from allmydata.util.iputil import get_local_ip_for
|
||||||
|
|
||||||
class Roster(service.MultiService, Referenceable):
|
class Roster(service.MultiService, Referenceable):
|
||||||
def remote_hello(self, urls):
|
def __init__(self):
|
||||||
print "contact from %s" % urls
|
service.MultiService.__init__(self)
|
||||||
|
self.active_peers = {}
|
||||||
|
|
||||||
|
def remote_hello(self, nodeid, node, urls):
|
||||||
|
log.msg("contact from %s" % nodeid)
|
||||||
|
self.active_peers[nodeid] = urls
|
||||||
|
node.notifyOnDisconnect(self._lost_node, nodeid)
|
||||||
|
|
||||||
|
def _lost_node(self, nodeid):
|
||||||
|
log.msg("lost contact with %s" % nodeid)
|
||||||
|
del self.active_peers[nodeid]
|
||||||
|
|
||||||
|
|
||||||
class Queen(service.MultiService):
|
class Queen(service.MultiService):
|
||||||
CERTFILE = "queen.pem"
|
CERTFILE = "queen.pem"
|
||||||
|
Loading…
Reference in New Issue
Block a user