idle

package
v3.4.10 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tracker

type Tracker struct {
	// Duration is the API idle window
	Duration time.Duration
	// contains filtered or unexported fields
}

Tracker holds the state for the server's idle tracking

func NewTracker

func NewTracker(idle time.Duration) *Tracker

NewTracker creates and initializes a new Tracker object For best behavior, duration should be 2x http idle connection timeout

func (*Tracker) ActiveConnections

func (t *Tracker) ActiveConnections() int

ActiveConnections returns the number of current managed or StateHijacked connections

func (*Tracker) Close

func (t *Tracker) Close()

Close is used to update Tracker that a StateHijacked connection has been closed by handler (StateClosed)

func (*Tracker) ConnState

func (t *Tracker) ConnState(conn net.Conn, state http.ConnState)

ConnState is called on HTTP connection state changes.

  • Once StateHijacked, StateClose is _NOT_ called on that connection
  • There are two "idle" timeouts, the http idle connection (not to be confused with the TCP/IP idle socket timeout) and the API idle window. The caller should set the http idle timeout to 2x the time provided to NewTacker() which is the API idle window.

func (*Tracker) Done

func (t *Tracker) Done() <-chan time.Time

Done is called when idle timer has expired

func (*Tracker) TotalConnections

func (t *Tracker) TotalConnections() int

TotalConnections returns total number of connections made to this instance of the service

Jump to

Keyboard shortcuts

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