mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
Add call to wait_closed method of asyncio.StreamWriter
This commit is contained in:
@ -37,5 +37,6 @@ class RawConnection(IRawConnection):
|
||||
"""
|
||||
return await self.reader.read(n)
|
||||
|
||||
def close(self) -> None:
|
||||
async def close(self) -> None:
|
||||
self.writer.close()
|
||||
await self.writer.wait_closed()
|
||||
|
||||
@ -17,5 +17,5 @@ class IRawConnection(ABC):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def close(self) -> None:
|
||||
async def close(self) -> None:
|
||||
pass
|
||||
|
||||
@ -118,7 +118,7 @@ class Swarm(INetwork):
|
||||
)
|
||||
except SecurityUpgradeFailure as error:
|
||||
# TODO: Add logging to indicate the failure
|
||||
raw_conn.close()
|
||||
await raw_conn.close()
|
||||
raise SwarmException(
|
||||
f"fail to upgrade the connection to a secured connection from {peer_id}"
|
||||
) from error
|
||||
@ -128,7 +128,7 @@ class Swarm(INetwork):
|
||||
)
|
||||
except MuxerUpgradeFailure as error:
|
||||
# TODO: Add logging to indicate the failure
|
||||
secured_conn.close()
|
||||
await secured_conn.close()
|
||||
raise SwarmException(
|
||||
f"fail to upgrade the connection to a muxed connection from {peer_id}"
|
||||
) from error
|
||||
@ -215,7 +215,7 @@ class Swarm(INetwork):
|
||||
)
|
||||
except SecurityUpgradeFailure as error:
|
||||
# TODO: Add logging to indicate the failure
|
||||
raw_conn.close()
|
||||
await raw_conn.close()
|
||||
raise SwarmException(
|
||||
"fail to upgrade the connection to a secured connection"
|
||||
) from error
|
||||
@ -226,7 +226,7 @@ class Swarm(INetwork):
|
||||
)
|
||||
except MuxerUpgradeFailure as error:
|
||||
# TODO: Add logging to indicate the failure
|
||||
secured_conn.close()
|
||||
await secured_conn.close()
|
||||
raise SwarmException(
|
||||
f"fail to upgrade the connection to a muxed connection from {peer_id}"
|
||||
) from error
|
||||
|
||||
Reference in New Issue
Block a user