connstate

package
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnState

type ConnState uint32
const (
	// StateOK means the connection is normal.
	StateOK ConnState = iota
	// StateRemoteClosed means the remote side has closed the connection.
	StateRemoteClosed
	// StateClosed means the connection has been closed by local side.
	StateClosed
)

type ConnStater

type ConnStater interface {
	Close() error
	State() ConnState
}

ConnStater is the interface to get the ConnState of a connection. Must call Close to release it if you're going to close the connection.

func ListenConnState

func ListenConnState(conn net.Conn) (ConnStater, error)

ListenConnState returns a ConnStater for the given connection. It's generally used for availability checks when obtaining connections from a connection pool. Conn must be a syscall.Conn.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL