http3: rename Server.CloseGracefully to Shutdown (#4701)

This is more consistent with standard library naming for graceful
shutdown methods for HTTP/1 and HTTP/2.
This commit is contained in:
Marten Seemann
2024-10-15 04:14:47 -05:00
committed by GitHub
parent 4a9a81ca34
commit 6af2b1a478
3 changed files with 8 additions and 8 deletions

View File

@@ -747,10 +747,10 @@ func (s *Server) Close() error {
return err
}
// CloseGracefully shuts down the server gracefully.
// Shutdown shuts down the server gracefully.
// The server sends a GOAWAY frame first, then or for all running requests to complete.
// CloseGracefully in combination with ListenAndServe() (instead of Serve()) may race if it is called before a UDP socket is established.
func (s *Server) CloseGracefully(ctx context.Context) error {
// Shutdown in combination with ListenAndServe() (instead of Serve()) may race if it is called before a UDP socket is established.
func (s *Server) Shutdown(ctx context.Context) error {
s.mutex.Lock()
s.closed = true
// server is never used

View File

@@ -1200,7 +1200,7 @@ var _ = Describe("Server", func() {
})
It("closes gracefully", func() {
Expect(s.CloseGracefully(context.Background())).To(Succeed())
Expect(s.Shutdown(context.Background())).To(Succeed())
})
It("errors when listening fails", func() {