Documentation
¶
Index ¶
Constants ¶
View Source
const MaxDrainSize = 64 * 1024 // 64KB
Variables ¶
View Source
var CtxKeyConnectionState = struct{}{}
Functions ¶
This section is empty.
Types ¶
type ConnectionState ¶
type ConnectionState struct {
Reader *bufio.Reader
Writer *bufio.Writer
RemoteAddr string
ReadHandler appcontext.ReadHandler
CancelFunc context.CancelFunc
ReadTimeout time.Duration
Processing atomic.Bool
// contains filtered or unexported fields
}
func NewConnectionState ¶
func NewConnectionState(readTimeout time.Duration) *ConnectionState
func (*ConnectionState) Cancel ¶
func (s *ConnectionState) Cancel()
Cancel closes the done channel, simulating context cancellation.
func (*ConnectionState) Deadline ¶
func (s *ConnectionState) Deadline() (deadline time.Time, ok bool)
Deadline implements context.Context
func (*ConnectionState) Done ¶
func (s *ConnectionState) Done() <-chan struct{}
Done implements context.Context
func (*ConnectionState) Reset ¶
func (s *ConnectionState) Reset()
func (*ConnectionState) Value ¶
func (s *ConnectionState) Value(key any) any
Value implements context.Context
type Engine ¶
func (*Engine) AcquireConnectionState ¶
func (e *Engine) AcquireConnectionState(s *ConnectionState)
AcquireConnectionState increments the reference count. Must be called when entering a goroutine that uses the state.
func (*Engine) ReleaseConnectionState ¶
func (e *Engine) ReleaseConnectionState(s *ConnectionState)
ReleaseConnectionState decrements the reference count. If count reaches 0, resources are returned to the pool. Must be called when leaving a goroutine that uses the state.
Click to show internal directories.
Click to hide internal directories.