Compare commits
8 Commits
61a607c20e
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5dd208a100 | ||
| 18b7e10631 | |||
| 07106f1816 | |||
|
115deaab4b
|
|||
|
8d2b8f9519
|
|||
|
f365139e9f
|
|||
|
cc6b650f5c
|
|||
|
faf1f4eeee
|
30
CHANGELOG.md
30
CHANGELOG.md
@@ -2,6 +2,36 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [0.4.0] - 2025-11-30
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- [`115deaa`](https://github.com/pufereq/template-repo/commit/115deaab4b0aaa9f0d3577be56e64fa3bb03f76b) **backend_server.py**: use unused `packet_size` argument to `_receive_inbound()`
|
||||
- [`cc6b650`](https://github.com/pufereq/template-repo/commit/cc6b650f5cd1f3889c251fbe7b36c681be48b2a0) **backend_server.py**: import Any from typing
|
||||
- [`5024862`](https://github.com/pufereq/template-repo/commit/50248621650590c17fcf96c0cec9618a2b0dd07c) **backend_server.py**: add 1ms sleep to prevent 100% CPU usage in `_loop()`
|
||||
- [`f0eeeb7`](https://github.com/pufereq/template-repo/commit/f0eeeb79a188548c3f306f4bc875bacc6fd89588) **backend_server.py**: handle unregister exceptions
|
||||
|
||||
### Features
|
||||
|
||||
- [`6f5fa33`](https://github.com/pufereq/template-repo/commit/6f5fa33a122e9ebdf9df91628be67721cfc031e3) **backend_server.py**: handle all other client Exceptions in `_handle_connection()`
|
||||
|
||||
### Refactor
|
||||
|
||||
- [`8d2b8f9`](https://github.com/pufereq/template-repo/commit/8d2b8f9519bb809df45ba79ea53f12775c3097d4) **backend_server.py**: change log levels
|
||||
- [`faf1f4e`](https://github.com/pufereq/template-repo/commit/faf1f4eeee341f5f8d234dc7d93ae5c86e276217) **backend_server.py**: remove unused argument in `BackendServer._send_outbound()`
|
||||
- [`61a607c`](https://github.com/pufereq/template-repo/commit/61a607c20e205c18e60a9b26f6fb3c37a47d6a55) wip
|
||||
|
||||
### Styling
|
||||
|
||||
- [`f365139`](https://github.com/pufereq/template-repo/commit/f365139e9f064de309f655296b99868833ba7dce) **backend_server.py**: ignore type error in `_handle_connection()`
|
||||
|
||||
### Build
|
||||
|
||||
- [`fe7d78c`](https://github.com/pufereq/template-repo/commit/fe7d78c1c8cd1d0e13276ce82549ee97b896aff0) **uv.lock**: update judas_protocol to 0.5.0
|
||||
- [`cee3025`](https://github.com/pufereq/template-repo/commit/cee30251ddb87b1f3ca84d0f3c8cf40fb37debcc) **uv.lock**: update judas_protocol to 0.4.3
|
||||
- [`721ab87`](https://github.com/pufereq/template-repo/commit/721ab87e7156045703f55ecefc6ed3e15ffa36aa) **uv.lock**: update judas_protocol to 0.3.0
|
||||
- [`1211ca2`](https://github.com/pufereq/template-repo/commit/1211ca20294dcc3907dbadfee4b294cf7e24a8f9) **uv.lock**: update judas_protocol to 0.2.0
|
||||
|
||||
## [0.3.0] - 2025-09-19
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -4,7 +4,7 @@ build-backend = "uv_build"
|
||||
|
||||
[project]
|
||||
name = "judas_server"
|
||||
version = "0.3.0"
|
||||
version = "0.4.0"
|
||||
description = "The backbone of the remote PC fleet management system."
|
||||
readme = "README.md"
|
||||
authors = []
|
||||
|
||||
@@ -7,6 +7,8 @@ import socket
|
||||
import threading
|
||||
import time
|
||||
|
||||
from typing import Any
|
||||
|
||||
from judas_protocol import Category, ControlAction, Message
|
||||
|
||||
from judas_server.backend.client import Client
|
||||
@@ -68,7 +70,7 @@ class BackendServer:
|
||||
target_id (str): The id of the ACK'd message.
|
||||
"""
|
||||
ack: bytes = Message.ack(target_id=target_id).to_bytes()
|
||||
self.logger.debug(f"[>] Sending ACK to {client}")
|
||||
self.logger.info(f"[>] Sending ACK to {client}")
|
||||
client.outbound += ack
|
||||
|
||||
def _accept_connection(self, sock: socket.socket) -> None:
|
||||
@@ -103,14 +105,11 @@ class BackendServer:
|
||||
|
||||
client.disconnect()
|
||||
|
||||
def _send_outbound(
|
||||
self, sock: socket.socket, client: Client, data: bytes
|
||||
) -> None:
|
||||
def _send_outbound(self, sock: socket.socket, client: Client) -> None:
|
||||
"""Queue data to be sent to a client.
|
||||
|
||||
Args:
|
||||
client (Client): The client to send data to.
|
||||
data (bytes): The data to send.
|
||||
"""
|
||||
self.logger.debug(f"[>] Sending data to {client}: {client.outbound!r}")
|
||||
sent = sock.send(client.outbound)
|
||||
@@ -129,7 +128,7 @@ class BackendServer:
|
||||
Returns:
|
||||
bytes: The received data.
|
||||
"""
|
||||
recv_data = sock.recv(1024)
|
||||
recv_data = sock.recv(packet_size)
|
||||
if recv_data:
|
||||
self.logger.debug(
|
||||
f"[<] Received data from {client}: {recv_data!r}"
|
||||
@@ -196,9 +195,10 @@ class BackendServer:
|
||||
)
|
||||
self._disconnect(client)
|
||||
return
|
||||
|
||||
while b"\n" in client.inbound:
|
||||
line, client.inbound = client.inbound.split(b"\n", 1)
|
||||
self.logger.info(
|
||||
self.logger.debug(
|
||||
f"[<] Complete message from {client}: {line!r}"
|
||||
)
|
||||
try:
|
||||
@@ -219,7 +219,7 @@ class BackendServer:
|
||||
|
||||
if mask & selectors.EVENT_WRITE:
|
||||
if client.outbound:
|
||||
self._send_outbound(sock, client, client.outbound)
|
||||
self._send_outbound(sock, client)
|
||||
|
||||
except ConnectionResetError as e:
|
||||
self.logger.error(f"Connection reset by {client}, disconnect: {e}")
|
||||
@@ -243,7 +243,7 @@ class BackendServer:
|
||||
events = self.selector.select(timeout=1)
|
||||
for key, mask in events:
|
||||
if key.data is None:
|
||||
self._accept_connection(key.fileobj)
|
||||
self._accept_connection(key.fileobj) # type: ignore
|
||||
else:
|
||||
self._handle_connection(key, mask)
|
||||
time.sleep(0.001) # prevent 100% CPU usage
|
||||
|
||||
Reference in New Issue
Block a user