fix(gateway): fanout transport uses the shared serialization guard too

Third json.dumps twin of the same class (multi-client fanout of one session):
route through transport.serialize_frame so every peer gets the -32603 frame
instead of the writer raising.
This commit is contained in:
teknium1
2026-09-16 14:37:49 -07:00
committed by Teknium
parent 1ccd1b3e41
commit 532608db63

View File

@@ -237,8 +237,9 @@ class FanoutTransport:
return
def write(self, obj: dict) -> bool:
# Freeze the queued frame so a caller cannot mutate it after admission.
encoded = json.dumps(obj, ensure_ascii=False)
# Freeze the queued frame so a caller cannot mutate it after admission. Same serialization
# guard as the single-peer transports: an unserializable frame reaches every peer as -32603.
encoded = serialize_frame(obj, "fanout", logger)
size = len(encoded.encode("utf-8", errors="surrogatepass"))
frame = json.loads(encoded)
with self._lock: