mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
Merge pull request #277 from ralexstokes/add-io-abstractions
Introduces IO abstractions and classes for `msgio` IO
This commit is contained in:
@ -20,11 +20,12 @@ class InMemoryConnection(IRawConnection):
|
||||
|
||||
self.closed = False
|
||||
|
||||
async def write(self, data: bytes) -> None:
|
||||
async def write(self, data: bytes) -> int:
|
||||
if self.closed:
|
||||
raise Exception("InMemoryConnection is closed for writing")
|
||||
|
||||
await self.send_queue.put(data)
|
||||
return len(data)
|
||||
|
||||
async def read(self, n: int = -1) -> bytes:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user