()
| 416 | } |
| 417 | |
| 418 | func (s *sharedBackendConn) Release() { |
| 419 | if s == nil { |
| 420 | return |
| 421 | } |
| 422 | if s.refcnt <= 0 { |
| 423 | log.Panicf("shared backend conn has been closed, close too many times") |
| 424 | } else { |
| 425 | s.refcnt-- |
| 426 | } |
| 427 | if s.refcnt != 0 { |
| 428 | return |
| 429 | } |
| 430 | for _, parallel := range s.conns { |
| 431 | for _, bc := range parallel { |
| 432 | bc.Close() |
| 433 | } |
| 434 | } |
| 435 | delete(s.owner.pool, s.addr) |
| 436 | } |
| 437 | |
| 438 | func (s *sharedBackendConn) Retain() *sharedBackendConn { |
| 439 | if s == nil { |