From c66dcbed17a6b29c10a3cd5b059d75a5aaaa4e7c Mon Sep 17 00:00:00 2001 From: Codex Date: Sun, 29 Nov 2026 12:33:08 +0000 Subject: [PATCH] fix-towercore-bulk-read-guard --- towercore/guard.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/towercore/guard.py b/towercore/guard.py index 154c420..4ba8717 100755 --- a/towercore/guard.py +++ b/towercore/guard.py @@ -6,6 +6,7 @@ import os HEADER_SIZE = 16 READ_OPCODE = 0x21 +BULK_READ_OPCODE = 0x23 SUBSCRIBER_TAG = 0x0B BACKEND_HOST = os.environ.get("BACKEND_HOST", "towercore") BACKEND_PORT = int(os.environ.get("BACKEND_PORT", "7250")) @@ -36,7 +37,10 @@ def should_block(frame: bytes) -> bool: raise ValueError("invalid frame length") tags = tlv_tags(frame[HEADER_SIZE:]) opcode = frame[3] - return opcode == READ_OPCODE and tags.count(SUBSCRIBER_TAG) > 1 + return ( + (opcode == BULK_READ_OPCODE and SUBSCRIBER_TAG in tags) + or (opcode == READ_OPCODE and tags.count(SUBSCRIBER_TAG) > 1) + ) async def client_frames(reader: asyncio.StreamReader, writer: asyncio.StreamWriter) -> None: