fix: Make MuxRPCAPI.__await__ a sync method
This commit is contained in:
parent
740762b149
commit
9ca68307f0
@ -134,15 +134,22 @@ class MuxRPCAPI:
|
|||||||
self.handlers = {}
|
self.handlers = {}
|
||||||
self.connection = None
|
self.connection = None
|
||||||
|
|
||||||
async def __await__(self):
|
def __aiter__(self):
|
||||||
async for req_message in self.connection:
|
return self
|
||||||
if req_message is None:
|
|
||||||
return
|
|
||||||
|
|
||||||
body = req_message.body
|
async def __anext__(self):
|
||||||
|
req_message = await self.connection.__anext__()
|
||||||
|
|
||||||
if isinstance(body, dict) and body.get("name"):
|
if req_message is None:
|
||||||
self.process(self.connection, MuxRPCRequest.from_message(req_message))
|
raise StopAsyncIteration()
|
||||||
|
|
||||||
|
body = req_message.body
|
||||||
|
|
||||||
|
if isinstance(body, dict) and body.get("name"):
|
||||||
|
self.process(self.connection, MuxRPCRequest.from_message(req_message))
|
||||||
|
|
||||||
|
def __await__(self):
|
||||||
|
yield from self.__anext__().__await__()
|
||||||
|
|
||||||
def add_connection(self, connection):
|
def add_connection(self, connection):
|
||||||
"""Set the packet stream connection of this RPC API"""
|
"""Set the packet stream connection of this RPC API"""
|
||||||
|
Loading…
Reference in New Issue
Block a user