Permalink
Browse files

Finally, a chance to use an if statement

  • Loading branch information...
1 parent d47a9a1 commit 51060cce67aec42f2379a96547bd48c44763eba4 @msantos committed Dec 29, 2010
Showing with 5 additions and 4 deletions.
  1. +5 −4 src/seds_proxy.erl
View
@@ -102,14 +102,15 @@ handle_sync_event(_Event, _From, StateName, State) ->
% From server
handle_info({tcp, Socket, Data}, proxy, #state{s = Socket, data = Buf} = State) ->
- case iolist_size(Buf) of
- N when N < ?MAXBUFSZ ->
+ N = iolist_size(Buf),
+ if
+ N < ?MAXBUFSZ ->
{next_state, proxy, State#state{data = [Data|Buf]}, ?PROXY_TIMEOUT};
- N when N < ?MAXBUFSZ*3 ->
+ N < ?MAXBUFSZ*3 ->
error_logger:info_report([{buffer_disabled, N}]),
ok = inet:setopts(Socket, [{active, false}]),
{next_state, proxy, State#state{data = [Data|Buf]}, ?PROXY_TIMEOUT};
- _ ->
+ true ->
{stop, enobufs, State}
end;

0 comments on commit 51060cc

Please sign in to comment.