MCPcopy
hub / github.com/redis/go-redis / ClearHandoffState

Method ClearHandoffState

internal/pool/conn.go:835–850  ·  view source on GitHub ↗

ClearHandoffState clears the handoff state after successful handoff. Makes the connection usable again.

()

Source from the content-addressed store, hash-verified

833// ClearHandoffState clears the handoff state after successful handoff.
834// Makes the connection usable again.
835func (cn *Conn) ClearHandoffState() {
836 // Clear handoff metadata
837 cn.handoffStateAtomic.Store(&HandoffState{
838 ShouldHandoff: false,
839 Endpoint: "",
840 SeqID: 0,
841 })
842
843 // Reset retry counter
844 cn.handoffRetriesAtomic.Store(0)
845
846 // Mark connection as usable again
847 // Use state machine directly instead of deprecated SetUsable
848 // probably done by initConn
849 cn.stateMachine.Transition(StateIdle)
850}
851
852// HasBufferedData safely checks if the connection has buffered data.
853// This method is used to avoid data races when checking for push notifications.

Callers 3

TestConnectionHookFunction · 0.95
closeConnFromRequestMethod · 0.80

Calls 1

TransitionMethod · 0.80

Tested by 1

TestConnectionHookFunction · 0.76