import "github.com/cockroachdb/cockroach/pkg/util/netutil"
FatalIfUnexpected calls Log.Fatal(err) unless err is nil, cmux.ErrListenerClosed, or the net package's errClosed.
IsClosedConnection returns true if err is cmux.ErrListenerClosed, grpc.ErrServerStopped, io.EOF, or the net package's errClosed.
func ListenAndServeGRPC( stopper *stop.Stopper, server *grpc.Server, addr net.Addr, ) (net.Listener, error)
ListenAndServeGRPC creates a listener and serves the specified grpc Server on it, closing the listener when signaled by the stopper.
SplitHostPort is like net.SplitHostPort however it supports addresses without a port number. In that case, the provided port number is used.
InitialHeartbeatFailedError indicates that while attempting a GRPC connection to a node, we aren't successful and have never seen a heartbeat over that connection before.
func NewInitialHeartBeatFailedError(cause error) *InitialHeartbeatFailedError
NewInitialHeartBeatFailedError creates a new InitialHeartbeatFailedError.
func (e *InitialHeartbeatFailedError) Cause() error
Cause implements causer.
func (e *InitialHeartbeatFailedError) Error() string
Error implements error.
func (e *InitialHeartbeatFailedError) Format(s fmt.State, verb rune)
Format implements fmt.Formatter.
func (e *InitialHeartbeatFailedError) FormatError(p errors.Printer) error
FormatError implements errors.FormatError.
Server is a thin wrapper around http.Server. See MakeServer for more detail.
MakeServer constructs a Server that tracks active connections, closing them when signaled by stopper.
It can serve two different purposes simultaneously:
- to serve as actual HTTP server, using the .Serve(net.Listener) method. - to serve as plain TCP server, using the .ServeWith(...) method.
The latter is used e.g. to accept SQL client connections.
When the HTTP facility is not used, the Go HTTP server object is still used internally to maintain/register the connections via the ConnState() method, for convenience.
func (s *Server) ServeWith( ctx context.Context, stopper *stop.Stopper, l net.Listener, serveConn func(net.Conn), ) error
ServeWith accepts connections on ln and serves them using serveConn.
Package netutil imports 16 packages (graph) and is imported by 151 packages. Updated 2021-01-26. Refresh now. Tools for package owners.