chore(release): 0.5.0 #13

Merged
pufereq merged 33 commits from release/0.5.0 into main 2026-02-28 22:48:50 +00:00
13 changed files with 643 additions and 396 deletions
Showing only changes of commit b1656cdfa9 - Show all commits

View File

@@ -6,11 +6,16 @@ from __future__ import annotations
import logging as lg import logging as lg
import socket import socket
from enum import Enum from enum import Enum
import time
class ClientStatus(str, Enum): class ClientStatus(str, Enum):
CONNECTED = "connected" """Enumeration of client connection statuses."""
DISCONNECTED = "disconnected"
ONLINE = "online"
PENDING = "pending"
OFFLINE = "offline"
STALE = "stale"
class Client: class Client:
@@ -34,7 +39,7 @@ class Client:
self.id: str | None = id self.id: str | None = id
self.last_seen: float = 0.0 # unix timestanp of last inbound message self.last_seen: float = 0.0 # unix timestanp of last inbound message
self.status: ClientStatus = ClientStatus.CONNECTED self.status: ClientStatus = ClientStatus.PENDING
self.socket: socket.socket = socket self.socket: socket.socket = socket
self.addr: tuple[str, int] = addr self.addr: tuple[str, int] = addr
@@ -54,5 +59,7 @@ class Client:
self.socket.close() self.socket.close()
except Exception as e: except Exception as e:
self.logger.error(f"Error closing socket for Client {self}: {e}") self.logger.error(f"Error closing socket for Client {self}: {e}")
self.status = ClientStatus.DISCONNECTED self.status = ClientStatus.OFFLINE
self.last_seen = time.time()
self.logger.info(f"Client {self} disconnected.") self.logger.info(f"Client {self} disconnected.")