2018-11-04 20:06:29 +01:00
|
|
|
from lbrynet.p2p.Peer import Peer
|
2015-08-20 17:27:15 +02:00
|
|
|
|
|
|
|
|
2018-07-22 00:34:59 +02:00
|
|
|
class PeerManager:
|
2015-08-20 17:27:15 +02:00
|
|
|
def __init__(self):
|
|
|
|
self.peers = []
|
|
|
|
|
|
|
|
def get_peer(self, host, port):
|
|
|
|
for peer in self.peers:
|
|
|
|
if peer.host == host and peer.port == port:
|
|
|
|
return peer
|
|
|
|
peer = Peer(host, port)
|
|
|
|
self.peers.append(peer)
|
2016-12-14 00:16:12 +01:00
|
|
|
return peer
|