Permalink
Browse files

exit if memcached connection is closed

  • Loading branch information...
1 parent add5100 commit cfe8eaffe6dff400f049aed702977b9badf51914 Jacob Vorreuter committed Jun 4, 2009
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/mcerlang.erl
View
@@ -390,7 +390,10 @@ decode_response_body(Bin, ExtrasSize, KeySize, Resp) ->
recv_bytes(_, 0) -> <<>>;
recv_bytes(Socket, NumBytes) ->
- {ok, Bin} = gen_tcp:recv(Socket, NumBytes), Bin.
+ case gen_tcp:recv(Socket, NumBytes) of
+ {ok, Bin} -> Bin;
+ {error, closed} -> exit({error, memcached_connection_closed})
+ end.
package_key(Key) when is_atom(Key) ->
atom_to_list(Key);

0 comments on commit cfe8eaf

Please sign in to comment.