basic-host and remove context

This commit is contained in:
zixuanzh
2018-10-21 12:55:45 -04:00
parent 5fd7cbe0eb
commit 9e64202e5c
7 changed files with 19 additions and 29 deletions

View File

@ -2,8 +2,7 @@ from abc import ABC, abstractmethod
class INetwork(ABC):
def __init__(self, context, my_peer_id, peer_store):
self.context = context
def __init__(self, my_peer_id, peer_store):
self.my_peer_id = my_peer_id
self.peer_store = peer_store
@ -16,9 +15,8 @@ class INetwork(ABC):
pass
@abstractmethod
def new_stream(self, context, peer_id):
def new_stream(self, peer_id):
"""
:param context: context instance
:param peer_id: peer_id of destination
:return: stream instance
"""

View File

@ -2,8 +2,7 @@ from .stream_interface import IStream
class Stream(IStream):
def __init__(self, context, peer_id):
self.context = context
def __init__(self, peer_id):
self.peer_id = peer_id
def protocol(self):

View File

@ -2,8 +2,7 @@ from abc import ABC, abstractmethod
class IStream(ABC):
def __init__(self, context, peer_id):
self.context = context
def __init__(self, peer_id):
self.peer_id = peer_id
@abstractmethod

View File

@ -2,8 +2,7 @@ from .network_interface import INetwork
class Swarm(INetwork):
def __init__(self, context, my_peer_id, peer_store):
self.context = context
def __init__(self, my_peer_id, peer_store):
self.my_peer_id = my_peer_id
self.peer_store = peer_store
@ -14,9 +13,8 @@ class Swarm(INetwork):
"""
pass
def new_stream(self, context, peer_id):
def new_stream(self, peer_id):
"""
:param context: context instance
:param peer_id: peer_id of destination
:return: stream instance
"""