MCPcopy
hub / github.com/grpc/grpc-go / deleteStream

Method deleteStream

internal/transport/http2_server.go:1307–1325  ·  view source on GitHub ↗

deleteStream deletes the stream s from transport's active streams.

(s *ServerStream, eosReceived bool)

Source from the content-addressed store, hash-verified

1305
1306// deleteStream deletes the stream s from transport's active streams.
1307func (t *http2Server) deleteStream(s *ServerStream, eosReceived bool) {
1308 t.mu.Lock()
1309 _, isActive := t.activeStreams[s.id]
1310 if isActive {
1311 delete(t.activeStreams, s.id)
1312 if len(t.activeStreams) == 0 {
1313 t.idle = time.Now()
1314 }
1315 }
1316 t.mu.Unlock()
1317
1318 if isActive && channelz.IsOn() {
1319 if eosReceived {
1320 t.channelz.SocketMetrics.StreamsSucceeded.Add(1)
1321 } else {
1322 t.channelz.SocketMetrics.StreamsFailed.Add(1)
1323 }
1324 }
1325}
1326
1327// finishStream closes the stream and puts the trailing headerFrame into controlbuf.
1328func (t *http2Server) finishStream(s *ServerStream, rst bool, rstCode http2.ErrCode, hdr *headerFrame, eosReceived bool) {

Callers 3

finishStreamMethod · 0.95
closeStreamMethod · 0.95

Calls 5

IsOnFunction · 0.92
NowMethod · 0.80
AddMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45