Close immediately closes all active listeners and all active connections. Close returns any error returned from closing the Server's underlying Listener(s).
()
| 190 | // Close returns any error returned from closing the Server's |
| 191 | // underlying Listener(s). |
| 192 | func (srv *Server) Close() error { |
| 193 | srv.mu.Lock() |
| 194 | defer srv.mu.Unlock() |
| 195 | |
| 196 | srv.closeDoneChanLocked() |
| 197 | err := srv.closeListenersLocked() |
| 198 | for c := range srv.conns { |
| 199 | c.Close() |
| 200 | delete(srv.conns, c) |
| 201 | } |
| 202 | return err |
| 203 | } |
| 204 | |
| 205 | // Shutdown gracefully shuts down the server without interrupting any |
| 206 | // active connections. Shutdown works by first closing all open |