inactivity

package
v3.3.3 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseConn

func CloseConn(cc Conn)

Types

type Conn

type Conn = interface {
	Context() context.Context
	Close() error
}

type KeepAlive

type KeepAlive[C Conn] struct {
	// contains filtered or unexported fields
}

func NewKeepAlive

func NewKeepAlive[C Conn](maxRetries uint32, onInactive OnInactiveFunc[C], sendPing func(cc C, receivePong func()) (func(), error)) *KeepAlive[C]

func (*KeepAlive[C]) OnInactive

func (m *KeepAlive[C]) OnInactive(cc C)

type Monitor

type Monitor[C Conn] struct {
	// contains filtered or unexported fields
}

func New

func New[C Conn](duration time.Duration, onInactive OnInactiveFunc[C]) *Monitor[C]

func (*Monitor[C]) CheckInactivity

func (m *Monitor[C]) CheckInactivity(now time.Time, cc C)

func (*Monitor[C]) LastActivity

func (m *Monitor[C]) LastActivity() time.Time

func (*Monitor[C]) Notify

func (m *Monitor[C]) Notify()

type NilMonitor

type NilMonitor[C Conn] struct{}

func NewNilMonitor

func NewNilMonitor[C Conn]() *NilMonitor[C]

func (*NilMonitor[C]) CheckInactivity

func (m *NilMonitor[C]) CheckInactivity(time.Time, C)

func (*NilMonitor[C]) Notify

func (m *NilMonitor[C]) Notify()

type OnInactiveFunc

type OnInactiveFunc[C Conn] func(cc C)

Jump to

Keyboard shortcuts

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