mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-10 15:10:54 +00:00
Refine Mplex.close and SwarmConn.close
Ensure `close` cleans up things and cancel the service finally.
This commit is contained in:
@ -91,7 +91,9 @@ class Mplex(IMuxedConn, Service):
|
||||
await self.secured_conn.close()
|
||||
# Blocked until `close` is finally set.
|
||||
await self.event_closed.wait()
|
||||
await self.manager.stop()
|
||||
|
||||
@property
|
||||
def is_closed(self) -> bool:
|
||||
"""
|
||||
check connection is fully closed.
|
||||
@ -213,10 +215,6 @@ class Mplex(IMuxedConn, Service):
|
||||
|
||||
return channel_id, flag, message
|
||||
|
||||
@property
|
||||
def _id(self) -> int:
|
||||
return 0 if self.is_initiator else 1
|
||||
|
||||
async def _handle_incoming_message(self) -> None:
|
||||
"""
|
||||
Read and handle a new incoming message.
|
||||
|
||||
Reference in New Issue
Block a user