From 147493754368becdfb938a641277cbd8441ba540 Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Thu, 1 Aug 2024 16:17:51 -0400 Subject: [PATCH] Only call send_eof on supported types --- jumpstarter/common/streams.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jumpstarter/common/streams.py b/jumpstarter/common/streams.py index b1f039d6..95e3c932 100644 --- a/jumpstarter/common/streams.py +++ b/jumpstarter/common/streams.py @@ -2,6 +2,7 @@ import grpc from anyio import BrokenResourceError, ClosedResourceError, create_memory_object_stream, create_task_group +from anyio.abc import ByteStream, ObjectStream from anyio.streams.stapled import StapledObjectStream from jumpstarter.v1 import router_pb2, router_pb2_grpc @@ -24,7 +25,8 @@ async def decapsulate_stream(tx, rx, tg): case router_pb2.FRAME_TYPE_DATA: await tx.send(frame.payload) case router_pb2.FRAME_TYPE_GOAWAY: - await tx.send_eof() + if isinstance(tx, ObjectStream) or isinstance(tx, ByteStream): + await tx.send_eof() case _: pass # ignore peer disconnet