fix: Make MuxRPCAPI.__await__ a sync method
This commit is contained in:
parent
740762b149
commit
9ca68307f0
@ -134,16 +134,23 @@ class MuxRPCAPI:
|
||||
self.handlers = {}
|
||||
self.connection = None
|
||||
|
||||
async def __await__(self):
|
||||
async for req_message in self.connection:
|
||||
def __aiter__(self):
|
||||
return self
|
||||
|
||||
async def __anext__(self):
|
||||
req_message = await self.connection.__anext__()
|
||||
|
||||
if req_message is None:
|
||||
return
|
||||
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):
|
||||
"""Set the packet stream connection of this RPC API"""
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user