| 1270 | } |
| 1271 | |
| 1272 | func (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 | |
| 1299 | func (t *http2Client) handleSettings(f *http2.SettingsFrame, isFirst bool) { |
| 1300 | if f.IsAck() { |