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

Method Close

internal/pool/conn.go:946–964  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

944}
945
946func (cn *Conn) Close() error {
947 if cn.IsClosed() {
948 return nil
949 }
950 // Transition to CLOSED state
951 cn.stateMachine.Transition(StateClosed)
952
953 if cn.onClose != nil {
954 // ignore error
955 _ = cn.onClose()
956 cn.onClose = nil
957 }
958
959 // Lock-free netConn access for better performance
960 if netConn := cn.getNetConn(); netConn != nil {
961 return netConn.Close()
962 }
963 return nil
964}
965
966// MaybeHasData tries to peek at the next byte in the socket without consuming it
967// This is used to check if there are push notifications available

Calls 4

IsClosedMethod · 0.95
getNetConnMethod · 0.95
TransitionMethod · 0.80
CloseMethod · 0.65