Tested against subscriptions and publish

This commit is contained in:
mhchia
2019-09-02 23:21:57 +08:00
parent 3717dc9adf
commit 194b494057
6 changed files with 46 additions and 43 deletions

View File

@ -217,6 +217,10 @@ class Swarm(INetwork):
"fail to upgrade the connection to a secured connection"
) from error
peer_id = secured_conn.get_remote_peer()
peer_ip, peer_port = writer.get_extra_info("peername")
peer_maddr = Multiaddr(f"/ip4/{peer_ip}/tcp/{peer_port}")
# TODO: Fix the ttl
self.peerstore.add_addr(peer_id, peer_maddr, 12345678)
try:
muxed_conn = await self.upgrader.upgrade_connection(
secured_conn, self.generic_protocol_handler, peer_id