return err
}
- serveDone := make(chan struct{})
- defer close(serveDone)
-
if !srv.trackListener(&l, true) {
return ErrServerClosed
}
if s.shuttingDown() {
return false
}
- // If the *Server is being reused after a previous
- // Close or Shutdown, reset its doneChan:
- if len(s.listeners) == 0 && len(s.activeConn) == 0 {
- s.doneChan = nil
- }
s.listeners[ln] = struct{}{}
} else {
delete(s.listeners, ln)
// Close idle HTTP/1 conns:
srv.closeIdleConns()
- // Close HTTP/2 conns, as soon as they become idle, but reset
- // the chan so future conns (if the listener is still active)
- // still work and don't get a GOAWAY immediately, before their
- // first request:
- srv.mu.Lock()
- defer srv.mu.Unlock()
- srv.closeDoneChanLocked() // closes http2 conns
- srv.doneChan = nil
+ // TODO: Issue 26303: close HTTP/2 conns as soon as they become idle.
}
func (s *Server) logf(format string, args ...interface{}) {