feat(backend_server.py): add send_close() method

This commit is contained in:
2026-02-28 20:34:16 +01:00
parent 1e02da1851
commit 3077a98d6f

View File

@@ -73,6 +73,16 @@ class BackendServer:
self.logger.info(f"[>] Sending ACK to {client}")
client.outbound += ack
def send_close(self, client: Client) -> None:
"""Send a CLOSE message to a client.
Args:
client (Client): The client to send the CLOSE message to.
"""
close_msg: bytes = Message.close().to_bytes()
self.logger.info(f"[>] Sending CLOSE to {client}")
client.outbound += close_msg
def _accept_connection(self, sock: socket.socket) -> None:
"""Accept a new client connection.
@@ -96,7 +106,6 @@ class BackendServer:
sock (socket.socket): The client socket to disconnect.
"""
self.logger.info(f"[-] Disconnecting {client}...")
self.logger.debug("[*] Sending DNR message...")
try:
self.selector.unregister(client.socket)