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

Method handleRSTStream

internal/transport/http2_client.go:1272–1297  ·  view source on GitHub ↗
(f *http2.RSTStreamFrame)

Source from the content-addressed store, hash-verified

1270}
1271
1272func (t *http2Client) handleRSTStream(f *http2.RSTStreamFrame) {
1273 s := t.getStream(f)
1274 if s == nil {
1275 return
1276 }
1277 if f.ErrCode == http2.ErrCodeRefusedStream {
1278 // The stream was unprocessed by the server.
1279 s.unprocessed.Store(true)
1280 }
1281 statusCode, ok := http2ErrConvTab[f.ErrCode]
1282 if !ok {
1283 if t.logger.V(logLevel) {
1284 t.logger.Infof("Received a RST_STREAM frame with code %q, but found no mapped gRPC status", f.ErrCode)
1285 }
1286 statusCode = codes.Unknown
1287 }
1288 if statusCode == codes.Canceled {
1289 if d, ok := s.ctx.Deadline(); ok && !d.After(time.Now()) {
1290 // Our deadline was already exceeded, and that was likely the cause
1291 // of this cancellation. Alter the status code accordingly.
1292 statusCode = codes.DeadlineExceeded
1293 }
1294 }
1295 st := status.Newf(statusCode, "stream terminated by RST_STREAM with error code: %v", f.ErrCode)
1296 t.closeStream(s, st.Err(), false, http2.ErrCodeNo, st, nil, false)
1297}
1298
1299func (t *http2Client) handleSettings(f *http2.SettingsFrame, isFirst bool) {
1300 if f.IsAck() {

Callers 1

readerMethod · 0.95

Calls 7

getStreamMethod · 0.95
closeStreamMethod · 0.95
NewfFunction · 0.92
NowMethod · 0.80
ErrMethod · 0.80
VMethod · 0.65
InfofMethod · 0.65

Tested by

no test coverage detected