Skip to content

Commit

Permalink
avoid empty pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
YanKawaYu authored and erikdubbelboer committed Nov 23, 2018
1 parent c7d1f2a commit 4570d12
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1355,8 +1355,10 @@ var clientConnPool sync.Pool
func (c *HostClient) releaseConn(cc *clientConn) {
cc.lastUseTime = time.Now()
//reset read and write deadline for reuse
cc.c.SetReadDeadline(time.Time{})
cc.c.SetWriteDeadline(time.Time{})
if cc.c != nil {
cc.c.SetReadDeadline(time.Time{})
cc.c.SetWriteDeadline(time.Time{})
}

c.connsLock.Lock()
c.conns = append(c.conns, cc)
Expand Down

0 comments on commit 4570d12

Please sign in to comment.