Remove async/await syntax, channels will be sync
This commit is contained in:
parent
90330b9c0c
commit
08446a05c3
@ -11,7 +11,7 @@ __all__ = ["SimpleMessageChannel"]
|
|||||||
class SimpleMessageChannel:
|
class SimpleMessageChannel:
|
||||||
"""A simple message channel."""
|
"""A simple message channel."""
|
||||||
|
|
||||||
async def send(self, channel: int, type: int, message: bytes) -> bytes:
|
def send(self, channel: int, type: int, message: bytes) -> bytes:
|
||||||
"""Encode a channel, type and message data to be sent.
|
"""Encode a channel, type and message data to be sent.
|
||||||
|
|
||||||
:param channel: the message channel identifier
|
:param channel: the message channel identifier
|
||||||
@ -22,17 +22,17 @@ class SimpleMessageChannel:
|
|||||||
length = len(message) + encoding_length(header)
|
length = len(message) + encoding_length(header)
|
||||||
return encode(length) + encode(header) + message
|
return encode(length) + encode(header) + message
|
||||||
|
|
||||||
async def send_batch(self, messages: List[Tuple[int, int, bytes]]) -> bytes:
|
def send_batch(self, messages: List[Tuple[int, int, bytes]]) -> bytes:
|
||||||
"""Encodes a series of messages into a single payload of bytes.
|
"""Encodes a series of messages into a single payload of bytes.
|
||||||
|
|
||||||
:param messages: Several data messages
|
:param messages: Several data messages
|
||||||
"""
|
"""
|
||||||
payload = b""
|
payload = b""
|
||||||
for (channel, type, message) in messages:
|
for (channel, type, message) in messages:
|
||||||
payload += await self.send(channel, type, message)
|
payload += self.send(channel, type, message)
|
||||||
return payload
|
return payload
|
||||||
|
|
||||||
async def recv(self, data: bytes) -> Tuple[int, int, bytes]:
|
def recv(self, data: bytes) -> Tuple[int, int, bytes]:
|
||||||
"""Encode a channel, type, message to be sent.
|
"""Encode a channel, type, message to be sent.
|
||||||
|
|
||||||
:param data: the message data
|
:param data: the message data
|
||||||
|
Loading…
Reference in New Issue
Block a user