Skip to content

Commit

Permalink
Calling close on all the open connections when receiving an EOF in Cl…
Browse files Browse the repository at this point in the history
…ient.response to reset the client
  • Loading branch information
StabbyCutyou committed Jan 25, 2015
1 parent 2b5ed88 commit d8045b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,12 @@ func (c *Client) response(conn *net.TCPConn, response proto.Message) (err error)
// Read the response from Riak
msgbuf, err := c.read(conn, 5)
if err != nil {
c.releaseConn(conn)
if err == io.EOF {
// Connection was closed, try to re-open the connection so subsequent
// i/o can succeed. Does report the error for this response.
conn, _ = net.DialTCP("tcp", nil, c.tcpaddr)
c.Close()
}
c.releaseConn(conn)
return err
}
defer c.releaseConn(conn)
Expand Down

0 comments on commit d8045b5

Please sign in to comment.