pinger

package
v0.0.0-...-c5633df Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NoopPinger

type NoopPinger struct {
	// contains filtered or unexported fields
}

NoopPinger implements the pinger interface, does nothing but waits for heat death of the universe.

func NewNoopPinger

func NewNoopPinger() *NoopPinger

NewNoopPinger returns a new NoopPinger instance.

func (*NoopPinger) Kill

func (p *NoopPinger) Kill()

Kill implements the worker.Worker interface.

func (*NoopPinger) Ping

func (*NoopPinger) Ping()

Ping implements the pinger.Pinger interface.

func (*NoopPinger) Wait

func (p *NoopPinger) Wait() error

Wait implements the worker.Worker interface.

type Pinger

type Pinger struct {
	worker.Worker
	// contains filtered or unexported fields
}

Pinger listens for pings and will call the passed action in case of a timeout. This way broken or inactive connections can be closed.

func NewPinger

func NewPinger(action func(), clock clock.Clock, timeout time.Duration) *Pinger

NewPinger returns a new Pinger instance that invokes the given action asynchronously if there is more than the given timeout interval between calls to its Ping method.

func (*Pinger) Kill

func (pt *Pinger) Kill()

Kill implements the worker.Worker interface.

func (*Pinger) Ping

func (pt *Pinger) Ping()

Ping is used by the client heartbeat monitor and resets the killer.

func (*Pinger) Wait

func (pt *Pinger) Wait() error

Wait implements the worker.Worker interface.

Jump to

Keyboard shortcuts

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