updated to not require peerstore
This commit is contained in:
parent
f51f975533
commit
08b37ee7cd
@ -3,13 +3,11 @@ import asyncio
|
|||||||
|
|
||||||
class Stream(IStream):
|
class Stream(IStream):
|
||||||
|
|
||||||
def __init__(self, peer_id):
|
def __init__(self, peer_id, maddr):
|
||||||
self.peer_id = peer_id
|
self.peer_id = peer_id
|
||||||
|
|
||||||
peer_store = context.peer_store
|
ip = maddr.get_protocol_value("ip4")
|
||||||
peer_addr = peer_store.get(peer_id)
|
port = maddr.get_protocol_value("tcp")
|
||||||
ip = peer_addr.get_protocol("ip4")
|
|
||||||
port = peer_addr.get_protocol("tcp")
|
|
||||||
|
|
||||||
# look up peer_id -> multiaddr in peer store
|
# look up peer_id -> multiaddr in peer store
|
||||||
# parse multiaddr and set_protocol based on it
|
# parse multiaddr and set_protocol based on it
|
||||||
|
@ -2,8 +2,9 @@ from abc import ABC, abstractmethod
|
|||||||
|
|
||||||
class IStream(ABC):
|
class IStream(ABC):
|
||||||
|
|
||||||
def __init__(self, peer_id):
|
def __init__(self, peer_id, maddr):
|
||||||
self.peer_id = peer_id
|
self.peer_id = peer_id
|
||||||
|
self.maddr = maddr
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def protocol(self):
|
def protocol(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user