Compare commits
2 Commits
448ffa443d
...
ac5521618b
| Author | SHA1 | Date | |
|---|---|---|---|
|
ac5521618b
|
|||
|
64866079d7
|
@@ -4,6 +4,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging as lg
|
||||
import os
|
||||
import uuid
|
||||
|
||||
from judas_protocol import Message
|
||||
@@ -29,7 +30,14 @@ class Client:
|
||||
self.server_host: str = server_host
|
||||
self.server_port: int = server_port
|
||||
|
||||
self.mac_address: str = self._get_mac_address()
|
||||
if "JUDAS_ID" in os.environ:
|
||||
self.mac_address: str = os.environ["JUDAS_ID"]
|
||||
self.logger.debug(
|
||||
f"Using MAC address from environment variable JUDAS_ID: {self.mac_address}"
|
||||
)
|
||||
else:
|
||||
self.mac_address = self._get_mac_address()
|
||||
|
||||
self.logger.debug(f"MAC address: {self.mac_address}")
|
||||
|
||||
self.connector: Connector = Connector(
|
||||
|
||||
@@ -174,8 +174,17 @@ class Connector:
|
||||
)
|
||||
try:
|
||||
message: Message = Message.from_bytes(message_bytes)
|
||||
# handle incoming ACKs
|
||||
if (
|
||||
message.category == Category.CONTROL
|
||||
and message.action == ControlAction.CLOSE
|
||||
):
|
||||
self.logger.warning(
|
||||
"[!] Received CLOSE command from server, shutting down."
|
||||
)
|
||||
self.running = False
|
||||
break
|
||||
# handle incoming ACKs
|
||||
elif (
|
||||
message.category == Category.CONTROL
|
||||
and message.action == ControlAction.ACK
|
||||
):
|
||||
|
||||
Reference in New Issue
Block a user