link and flake cleanup

This commit is contained in:
2026-02-08 16:05:03 -05:00
parent 087a264e97
commit 5e6dfc75ad
24 changed files with 393 additions and 186 deletions
+6 -5
View File
@@ -1,14 +1,14 @@
"""UDP listener and datagram processing."""
import asyncio
import zlib
import logging
logger = logging.getLogger(__name__)
from .proto import stodict, oldmtodict
from hbd.utils import dur
logger = logging.getLogger(__name__)
class EchoServerProtocol(asyncio.DatagramProtocol):
def __init__(self, config=None, handler=None):
@@ -44,6 +44,7 @@ def parse_message(data: bytes):
msg = oldmtodict(data)
return msg
def dicttos(ID, d, compress=False):
s = []
for k in d:
@@ -61,6 +62,7 @@ def dicttos(ID, d, compress=False):
opk = ID + ":" + zpk
return opk
def handle_datagram(msg: dict, addr, transport, ctx: dict):
"""Handle a parsed datagram message.
@@ -87,6 +89,7 @@ def handle_datagram(msg: dict, addr, transport, ctx: dict):
ip = addr[0] if isinstance(addr, (list, tuple)) else addr
name = msg.get("name", "unknown")
from hbd.utils import shortname
uname = shortname(name)
if uname not in hbdcls.Host.hosts:
@@ -215,5 +218,3 @@ def handle_datagram(msg: dict, addr, transport, ctx: dict):
msg_to_websockets("host", host.stateinfo())
except Exception:
pass