Phase 1: IPC-Verbindungsschicht + Build-first-Strategie (ADR-0008)

- ADR-0008: Build-first, gesammelte Windows-Validierung (Auftraggeber-Freigabe)
- ADR-0004 vorläufig: Rust auf GStreamer-D3D11-Elementpfad
- ADR-0005 vorläufig: Nuitka Onefolder
- hms_protocol: IpcServer/IpcClient mit Handshake (hello/welcome),
  Capabilities-Austausch, Heartbeat 500 ms bidirektional, Snapshot/Delta,
  Loopback-only-Enforcement, Re-Sync nach Reconnect, Version-Mismatch-Fehler
- 9 Integrationstests: echter TCP-Loopback, kein Mock
This commit is contained in:
HMS MediaEngine Agent
2026-09-11 00:50:03 +02:00
parent b0599d8b86
commit 9536e08748
11 changed files with 753 additions and 27 deletions
+11
View File
@@ -6,6 +6,7 @@ schützt vor unkontrollierten Queues/Resourcenerschöpfung (§6.2, §33).
from __future__ import annotations
import asyncio
import socket
import struct
@@ -46,6 +47,16 @@ def read_frame(sock: socket.socket) -> dict:
return msgpack.unpackb(body, raw=False)
async def read_frame_async(reader: asyncio.StreamReader) -> dict:
"""Liest einen Frame von einem asyncio-StreamReader (IPC-Server/Client)."""
header = await reader.readexactly(_LENGTH.size)
(length,) = _LENGTH.unpack(header)
if length > MAX_PAYLOAD_SIZE:
raise ValueError(f"declared length {length} exceeds limit")
body = await reader.readexactly(length)
return msgpack.unpackb(body, raw=False)
def write_frame(sock: socket.socket, payload: dict) -> None:
"""Schreibt einen Frame auf einen verbundenen Socket."""
sock.sendall(encode_frame(payload))