Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Receiver ¶
type Receiver struct {
OnTimeout chan struct{}
// contains filtered or unexported fields
}
Receiver is a healthcheck receiver It will listen for heartbeat and check if the heartbeat is not received in a certain time If the heartbeat is not received in a certain time, it will send a timeout signal and stop to work The heartbeat timeout is a bit longer than the sender's healthcheck interval
func NewReceiver ¶
func NewReceiver() *Receiver
NewReceiver creates a new healthcheck receiver and start the timer in the background
type Sender ¶
type Sender struct {
// HealthCheck is a channel to send health check signal to the peer
HealthCheck chan struct{}
// Timeout is a channel to the health check signal is not received in a certain time
Timeout chan struct{}
// contains filtered or unexported fields
}
Sender is a healthcheck sender It will send healthcheck signal to the receiver If the receiver does not receive the signal in a certain time, it will send a timeout signal and stop to work It will also stop if the context is canceled
func (*Sender) OnHCResponse ¶
func (hc *Sender) OnHCResponse()
OnHCResponse sends an acknowledgment signal to the sender