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

Method getNetConn

internal/pool/conn.go:378–385  ·  internal/pool/conn.go::Conn.getNetConn

getNetConn returns the current network connection using atomic load (lock-free). This is the fast path for accessing netConn without mutex overhead.

()

Source from the content-addressed store, hash-verified

376// getNetConn returns the current network connection using atomic load (lock-free).
377// This is the fast path for accessing netConn without mutex overhead.
378func (cn *Conn) getNetConn() net.Conn {
379 if v := cn.netConnAtomic.Load(); v != nil {
380 if wrapper, ok := v.(*atomicNetConn); ok {
381 return wrapper.conn
382 }
383 }
384 return nil
385}
386
387// setNetConn stores the network connection atomically (lock-free).
388// This is used for the fast path of connection replacement.

Callers 9

GetNetConnMethod · 0.95
WriteMethod · 0.95
RemoteAddrMethod · 0.95
WithReaderMethod · 0.95
WithWriterMethod · 0.95
CloseMethod · 0.95
MaybeHasDataMethod · 0.95
NetConnMethod · 0.95
isHealthyConnMethod · 0.80

Calls 1

LoadMethod · 0.45

Tested by 1

NetConnMethod · 0.76