Close starts shutting down the http2Server transport. TODO(zhaoq): Now the destruction is not blocked on any pending streams. This could cause some resource issue. Revisit this later.
(err error)
| 1279 | // TODO(zhaoq): Now the destruction is not blocked on any pending streams. This |
| 1280 | // could cause some resource issue. Revisit this later. |
| 1281 | func (t *http2Server) Close(err error) { |
| 1282 | t.mu.Lock() |
| 1283 | if t.state == closing { |
| 1284 | t.mu.Unlock() |
| 1285 | return |
| 1286 | } |
| 1287 | if t.logger.V(logLevel) { |
| 1288 | t.logger.Infof("Closing: %v", err) |
| 1289 | } |
| 1290 | t.state = closing |
| 1291 | streams := t.activeStreams |
| 1292 | t.activeStreams = nil |
| 1293 | t.mu.Unlock() |
| 1294 | t.controlBuf.finish() |
| 1295 | close(t.done) |
| 1296 | if err := t.conn.Close(); err != nil && t.logger.V(logLevel) { |
| 1297 | t.logger.Infof("Error closing underlying net.Conn during Close: %v", err) |
| 1298 | } |
| 1299 | channelz.RemoveEntry(t.channelz.ID) |
| 1300 | // Cancel all active streams. |
| 1301 | for _, s := range streams { |
| 1302 | s.cancel() |
| 1303 | } |
| 1304 | } |
| 1305 | |
| 1306 | // deleteStream deletes the stream s from transport's active streams. |
| 1307 | func (t *http2Server) deleteStream(s *ServerStream, eosReceived bool) { |