refactor: improve backend server #11
@@ -70,7 +70,7 @@ class BackendServer:
|
|||||||
target_id (str): The id of the ACK'd message.
|
target_id (str): The id of the ACK'd message.
|
||||||
"""
|
"""
|
||||||
ack: bytes = Message.ack(target_id=target_id).to_bytes()
|
ack: bytes = Message.ack(target_id=target_id).to_bytes()
|
||||||
self.logger.debug(f"[>] Sending ACK to {client}")
|
self.logger.info(f"[>] Sending ACK to {client}")
|
||||||
client.outbound += ack
|
client.outbound += ack
|
||||||
|
|
||||||
def _accept_connection(self, sock: socket.socket) -> None:
|
def _accept_connection(self, sock: socket.socket) -> None:
|
||||||
@@ -195,9 +195,10 @@ class BackendServer:
|
|||||||
)
|
)
|
||||||
self._disconnect(client)
|
self._disconnect(client)
|
||||||
return
|
return
|
||||||
|
|
||||||
while b"\n" in client.inbound:
|
while b"\n" in client.inbound:
|
||||||
line, client.inbound = client.inbound.split(b"\n", 1)
|
line, client.inbound = client.inbound.split(b"\n", 1)
|
||||||
self.logger.info(
|
self.logger.debug(
|
||||||
f"[<] Complete message from {client}: {line!r}"
|
f"[<] Complete message from {client}: {line!r}"
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user