refactor: make connector use queues #4

Merged
pufereq merged 12 commits from refactor/make-connector-use-queues into develop 2025-11-30 17:35:33 +00:00
2 changed files with 151 additions and 144 deletions
Showing only changes of commit bc62dbed66 - Show all commits

View File

@@ -106,14 +106,16 @@ class Connector:
def send_hello(self) -> None:
"""Send a HELLO message to the server."""
self.logger.debug("[*] Sending HELLO message...")
hello_message: bytes = Message.hello(self.mac_address).to_bytes()
self.outbound_buffer += hello_message
self._send_outbound()
hello_message: Message = Message.hello(self.mac_address)
self.send(hello_message)
def close(self) -> None:
"""Close the connection and clean up resources."""
self.logger.debug("[*] Closing connection...")
try:
self.selector.unregister(self.socket)
except Exception as e:
self.logger.error(f"[!] Error unregistering socket: {e}")
self.socket.close()
self.logger.debug("[.] Connection closed.")