Skip to content

Commit ac8f7b3

Browse files
committed
docs(server_stream): document recvInitialRequest goroutine lifecycle
1 parent 0ee5a11 commit ac8f7b3

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

internal/xds/server_stream.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,11 @@ func (s *Server) recvInitialRequest(
374374

375375
resultCh := make(chan initialDiscoveryRequestResult, 1)
376376
go func() {
377+
// stream.Recv() blocks until the initial request arrives or the
378+
// stream context is cancelled. When shutdownCh fires first, the
379+
// goroutine remains blocked until StreamConfiguration returns and
380+
// the gRPC framework cancels the stream context, which unblocks
381+
// Recv() and allows the goroutine to exit.
377382
req, err := stream.Recv()
378383
resultCh <- initialDiscoveryRequestResult{req: req, err: err}
379384
}()

0 commit comments

Comments
 (0)