Make Mplex and SwarmConn not Service

After second thoughts, they seem not a good candidate of `Service`.
The shutdown logic becomes simpler by making them not `Service`.
This commit is contained in:
mhchia
2020-01-07 21:50:03 +08:00
parent eab59482c0
commit eef241e70e
7 changed files with 43 additions and 61 deletions

View File

@ -1,6 +1,8 @@
from abc import abstractmethod
from typing import Tuple
import trio
from libp2p.io.abc import Closer
from libp2p.network.stream.net_stream_interface import INetStream
from libp2p.stream_muxer.abc import IMuxedConn
@ -8,11 +10,12 @@ from libp2p.stream_muxer.abc import IMuxedConn
class INetConn(Closer):
muxed_conn: IMuxedConn
event_started: trio.Event
@abstractmethod
async def new_stream(self) -> INetStream:
...
@abstractmethod
async def get_streams(self) -> Tuple[INetStream, ...]:
def get_streams(self) -> Tuple[INetStream, ...]:
...