saser / strecku

0 stars 0 forks source link

Use the net.ErrClosed error once Go 1.16 is released #5

Open saser opened 3 years ago

saser commented 3 years ago

See https://tip.golang.org/doc/go1.16#net for more details.

The use case is for binaries that serve a gRPC server on a listener, where both a deferred function and grpc.(*Server).GracefulStop will close the listener:

$ go doc google.golang.org/grpc Server.GracefulStop
package grpc // import "google.golang.org/grpc"

func (s *Server) GracefulStop()
    GracefulStop stops the gRPC server gracefully. It stops the server from
    accepting new connections and RPCs and blocks until all the pending RPCs are
    finished.