Skip to content

Commit

Permalink
Merge pull request wooga#34 from talko/master
Browse files Browse the repository at this point in the history
Handle tcp_error
  • Loading branch information
knutin committed Jan 28, 2013
2 parents 4cf18a5 + 6b10992 commit aecf39a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/eredis_client.erl
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ handle_info({tcp, _Socket, Bs}, State) ->
inet:setopts(State#state.socket, [{active, once}]),
{noreply, handle_response(Bs, State)};

handle_info({tcp_error, _Socket, _Reason}, State) ->
%% This will be followed by a close
{noreply, State};

%% Socket got closed, for example by Redis terminating idle
%% clients. If desired, spawn of a new process which will try to reconnect and
%% notify us when Redis is ready. In the meantime, we can respond with
Expand Down
4 changes: 4 additions & 0 deletions src/eredis_sub_client.erl
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ handle_info({tcp, _Socket, Bs}, State) ->
{noreply, NewState}
end;

handle_info({tcp_error, _Socket, _Reason}, State) ->
%% This will be followed by a close
{noreply, State};

%% Socket got closed, for example by Redis terminating idle
%% clients. If desired, spawn of a new process which will try to reconnect and
%% notify us when Redis is ready. In the meantime, we can respond with
Expand Down

0 comments on commit aecf39a

Please sign in to comment.