basho/riak-erlang-client — pull request #84 by seancribbs (2013-02-06 22:03:30+00:00)
Title: Correct some cases of badmatch with gen_tcp

In the new `loaded_upgrade` test from basho/riak_test#196, when Riak drops the connection or the socket is otherwise closed, we get an `{error, closed}` tuple returned from `gen_tcp:send/2` which results in a `badmatch` error. This patch changes it to pattern match on the result and takes appropriate action to trigger a reconnect or enqueue, and when appropriate returns an `{error, disconnected}` tuple to the caller.