feat(backend_server.py): add send_close() method
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user