Skip to content

Commit d5b5a20

Browse files
committed
Add missing continue after stream failure
After the send status is called, a stream will be closed and cannot do more processing on the stream, including further send status. This also fixes a panic when a streamid sent to the server is not found, the send status will return and then panic attempting to convert nil to a stream handler. Signed-off-by: Derek McGowan <derek@mcg.dev>
1 parent eeb849b commit d5b5a20

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

server.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ func (c *serverConn) run(sctx context.Context) {
413413
if !sendStatus(mh.StreamID, status.Newf(codes.InvalidArgument, "StreamID is no longer active")) {
414414
return
415415
}
416+
continue
416417
}
417418
sh := i.(*streamHandler)
418419
if mh.Flags&flagNoData != flagNoData {
@@ -426,6 +427,7 @@ func (c *serverConn) run(sctx context.Context) {
426427
if !sendStatus(mh.StreamID, status.Newf(codes.InvalidArgument, "data handling error: %v", err)) {
427428
return
428429
}
430+
continue
429431
}
430432
}
431433

@@ -435,6 +437,7 @@ func (c *serverConn) run(sctx context.Context) {
435437
if !sendStatus(mh.StreamID, status.Newf(codes.InvalidArgument, "data close message cannot include data")) {
436438
return
437439
}
440+
continue
438441
}
439442
}
440443
} else if mh.Type == messageTypeRequest {

0 commit comments

Comments
 (0)