releaseConn is invoked when we are done with a conn to reduce the ref count
(conn *conn)
| 289 | |
| 290 | // releaseConn is invoked when we are done with a conn to reduce the ref count |
| 291 | func (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. |
| 299 | func (p *connPool) getClient(addr net.Addr) (*conn, *streamClient, error) { |