Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultStopCheckTimeout = time.Duration(1 * time.Millisecond) DefaultTimeoutMultiplier = 100 // Default number of timeouts permitted before giving up and returning failed-to-stop error. DefaultVerbose = false // Default value for Verbose field of new StoppableListeners. StoppedError = errors.New("StoppableListener: listener stopped") ListenerWrapError = errors.New("StoppableListener: cannot wrap listener") NotStoppedError = errors.New("StoppableListener: listener failed to stop, listener port is still open after timeout") )
Functions ¶
This section is empty.
Types ¶
type StoppableListener ¶
type StoppableListener struct {
*net.TCPListener // Wrapped listener.
StopCheckTimeout time.Duration // TCP socket timeout value used when a stop-check is run.
TimeoutMultiplier int // How many times the StopCheckTimeout duration should the wait-loop allow.
Verbose bool // Activates verbose logging.
// contains filtered or unexported fields
}
func New ¶
func New(l net.Listener) (*StoppableListener, error)
New creates a new stoppable TCP listener.
func (*StoppableListener) Stop ¶
func (sl *StoppableListener) Stop() (err error)
func (*StoppableListener) StopSafely ¶
func (sl *StoppableListener) StopSafely() (err error)
StopSafely waits until the socket is longer reachable, or returns an error if the check times out.
Click to show internal directories.
Click to hide internal directories.