feat(mosaic): add authenticated external lease broker #836

Merged
jason.woltje merged 12 commits from feat/828-lease-broker into main 2026-07-18 03:12:25 +00:00
Showing only changes of commit 57770e3443 - Show all commits

View File

@@ -358,7 +358,16 @@ def read_frame(connection: socket.socket, deadline: float) -> dict[str, object]:
if not chunk:
break
data.extend(chunk)
if len(data) > MAX_FRAME or not data.endswith(b"\n") or data.count(b"\n") != 1:
if len(data) > MAX_FRAME:
while True:
remaining = deadline - time.monotonic()
if remaining <= 0:
raise BrokerFailure("MALFORMED_REQUEST")
connection.settimeout(remaining)
if not connection.recv(4096):
break
raise BrokerFailure("MALFORMED_REQUEST")
if not data.endswith(b"\n") or data.count(b"\n") != 1:
raise BrokerFailure("MALFORMED_REQUEST")
try:
value = json.loads(data)