Remove async/await syntax, channels will be sync

This commit is contained in:
Luke Murphy 2020-08-03 21:56:44 +02:00
parent 90330b9c0c
commit 08446a05c3
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
1 changed files with 4 additions and 4 deletions

View File

@ -11,7 +11,7 @@ __all__ = ["SimpleMessageChannel"]
class SimpleMessageChannel:
"""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.
:param channel: the message channel identifier
@ -22,17 +22,17 @@ class SimpleMessageChannel:
length = len(message) + encoding_length(header)
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.
:param messages: Several data messages
"""
payload = b""
for (channel, type, message) in messages:
payload += await self.send(channel, type, message)
payload += self.send(channel, type, message)
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.
:param data: the message data