Skip to content

Commit

Permalink
Do not set KeepAlive for non-TCP connections
Browse files Browse the repository at this point in the history
  • Loading branch information
riton authored and vbatoufflet committed Jun 28, 2018
1 parent 5814896 commit 2c303ee
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ func (c *Client) Exec(r Request) (*Response, error) {
}

if r.keepAlive() {
c.conn.(*net.TCPConn).SetKeepAlive(true)
switch c.network {
case "tcp":
c.conn.(*net.TCPConn).SetKeepAlive(true)
}
} else {
defer c.Close()
}
Expand Down

0 comments on commit 2c303ee

Please sign in to comment.