Skip to content

Commit

Permalink
Add missing keepalive on TCP connection
Browse files Browse the repository at this point in the history
  • Loading branch information
vbatoufflet committed Feb 26, 2018
1 parent 1e80afd commit 8a8d040
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ func (c *Client) Exec(r Request) (*Response, error) {
return nil, err
}

if !r.keepAlive() {
if r.keepAlive() {
c.conn.(*net.TCPConn).SetKeepAlive(true)
} else {
defer c.Close()
}
}
Expand Down

0 comments on commit 8a8d040

Please sign in to comment.