Skip to content

Commit

Permalink
Only call send_eof on supported types
Browse files Browse the repository at this point in the history
  • Loading branch information
NickCao committed Aug 1, 2024
1 parent e150fa6 commit 1474937
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion jumpstarter/common/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Check warning on line 32 in jumpstarter/common/streams.py

View workflow job for this annotation

GitHub Actions / typos

"disconnet" should be "disconnect".
Expand Down

0 comments on commit 1474937

Please sign in to comment.