Skip to content

Commit 0f708af

Browse files
committed
fix: prevent potential goroutine leak on blocked incoming channel
1 parent 78a66a4 commit 0f708af

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

mcp/streamable.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,12 @@ func (s *streamableClientConn) handleSSE(resp *http.Response) {
760760
// TODO: surface this error; possibly break the stream
761761
return
762762
}
763-
s.incoming <- evt.data
763+
764+
select {
765+
case s.incoming <- evt.data:
766+
case <-s.done:
767+
return
768+
}
764769
}
765770
}()
766771

0 commit comments

Comments
 (0)