MCPcopy Create free account
hub / github.com/dadgar/onecache / releaseConn

Method releaseConn

onecache/pool.go:291–296  ·  view source on GitHub ↗

releaseConn is invoked when we are done with a conn to reduce the ref count

(conn *conn)

Source from the content-addressed store, hash-verified

289
290// releaseConn is invoked when we are done with a conn to reduce the ref count
291func (p *connPool) releaseConn(conn *conn) {
292 refCount := atomic.AddInt32(&conn.refCount, -1)
293 if refCount == 0 && atomic.LoadInt32(&conn.shouldClose) == 1 {
294 conn.Close()
295 }
296}
297
298// getClient is used to get a usable client for an address.
299func (p *connPool) getClient(addr net.Addr) (*conn, *streamClient, error) {

Callers 2

getClientMethod · 0.95
RPCMethod · 0.95

Calls 1

CloseMethod · 0.45

Tested by

no test coverage detected