(netConn net.Conn)
| 652 | } |
| 653 | |
| 654 | func (cn *Conn) SetNetConn(netConn net.Conn) { |
| 655 | // Store the new connection atomically first (lock-free) |
| 656 | cn.setNetConn(netConn) |
| 657 | // Protect reader reset operations to avoid data races |
| 658 | // Use write lock since we're modifying the reader state |
| 659 | cn.readerMu.Lock() |
| 660 | cn.rd.Reset(netConn) |
| 661 | cn.readerMu.Unlock() |
| 662 | |
| 663 | cn.bw.Reset(netConn) |
| 664 | } |
| 665 | |
| 666 | // GetNetConn safely returns the current network connection using atomic load (lock-free). |
| 667 | // This method is used by the pool for health checks and provides better performance. |
no test coverage detected