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

Method SetNetConn

internal/pool/conn.go:654–664  ·  view source on GitHub ↗
(netConn net.Conn)

Source from the content-addressed store, hash-verified

652}
653
654func (cn *Conn) SetNetConn(netConn net.Conn) {
655 // Store the new connection atomically first (lock-free)
656 cn.setNetConn(netConn)
657 // Protect reader reset operations to avoid data races
658 // Use write lock since we're modifying the reader state
659 cn.readerMu.Lock()
660 cn.rd.Reset(netConn)
661 cn.readerMu.Unlock()
662
663 cn.bw.Reset(netConn)
664}
665
666// GetNetConn safely returns the current network connection using atomic load (lock-free).
667// This method is used by the pool for health checks and provides better performance.

Callers 1

SetNetConnAndInitConnMethod · 0.95

Calls 2

setNetConnMethod · 0.95
ResetMethod · 0.45

Tested by

no test coverage detected