code: func (srv *Server) Shutdown(ctx context.Context) error {
  	srv.mu.Lock()
  	lnerr := srv.closeListenersLocked()
  	srv.closeDoneChanLocked()
  	srv.mu.Unlock()
  
  	finished := make(chan struct{}, 1)
  	go func() {
  		srv.listenerWg.Wait()
  		srv.connWg.Wait()
  		finished <- struct{}{}
  	}()
  
  	select {
  	case <-ctx.Done():
  		return ctx.Err()
  	case <-finished:
  		return lnerr
  	}
  }
docs: // Shutdown gracefully shuts down the server without interrupting any
  // active connections. Shutdown works by first closing all open
  // listeners, and then waiting indefinitely for connections to close.
  // If the provided context expires before the shutdown is complete,
  // then the context's error is returned.