code: func (s *Server) Shutdown(ctx context.Context) error {
  	// close listener to stop receiving new connections
  	err := s.Close()
  	s.Wait(ctx)
  	activeConnections := s.trackConnections(0)
  	if activeConnections == 0 {
  		return err
  	}
  	s.Infof("Shutdown: waiting for %v connections to finish.", activeConnections)
  	lastReport := time.Time{}
  	ticker := time.NewTicker(s.shutdownPollPeriod)
  	defer ticker.Stop()
  	for {
  		select {
  		case <-ticker.C:
  			activeConnections = s.trackConnections(0)
  			if activeConnections == 0 {
  				return err
  			}
  			if time.Now().Sub(lastReport) > 10*s.shutdownPollPeriod {
  				s.Infof("Shutdown: waiting for %v connections to finish.", activeConnections)
  				lastReport = time.Now()
  			}
  		case <-ctx.Done():
  			s.Infof("Context cancelled wait, returning.")
  			return trace.ConnectionProblem(err, "context cancelled")
  		}
  	}
  }
docs: // Shutdown initiates graceful shutdown - waiting until all active
  // connections will get closed