basho/riak-python-client — pull request #104 by armon (2012-02-14 21:09:16+00:00)
Title: Make the Protocol Buffer transport more robust to connection problems

We were running into some issues with the PBC transport when connecting to HAProxy, specifically the connection would be closed by HAProxy after a timeout or restart of the proxy. To handle this, we've modified the socket wrapper and send_pkt to better detect errors that indicate a socket has been closed or is otherwise not serviceable, and either perform a retry or just close the socket. The change should not affect the current behavior, but allows a higher max_attempts to be specified to allow some retries to take place.