Skip to content

Commit

Permalink
Merge pull request #91 from Tapjoy/feature/reset_connection_on_eof
Browse files Browse the repository at this point in the history
Calling close on the connection when receiving an EOF in Client.response...
  • Loading branch information
MJDSys committed Jan 25, 2015
2 parents 2b5ed88 + d8045b5 commit 482a877
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 482a877

Please sign in to comment.