limitlistener

package
v2.7.3 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package limitlistener provides a Listener that accepts at most n simultaneous.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LimitListener

type LimitListener struct {
	net.Listener
	// contains filtered or unexported fields
}

LimitListener is the Listener to limit connections.

func NewLimitListener

func NewLimitListener(l net.Listener, n uint32) *LimitListener

NewLimitListener returns a Listener that accepts at most n simultaneous connections from the provided Listener.

func (*LimitListener) Accept

func (l *LimitListener) Accept() (net.Conn, error)

Accept accepts one connection.

func (*LimitListener) Close

func (l *LimitListener) Close() error

Close closes LimitListener.

func (*LimitListener) SetMaxConnection

func (l *LimitListener) SetMaxConnection(n uint32)

SetMaxConnection sets max connection.

Jump to

Keyboard shortcuts

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