Skip to content

Commit

Permalink
Use queue:peek/1 - more efficient than hd(queue:to_list(Queue))
Browse files Browse the repository at this point in the history
  • Loading branch information
fdmanana committed May 15, 2011
1 parent 5be7075 commit ee06a43
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ibrowse_http_client.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1366,10 +1366,10 @@ reset_state(State) ->
}.

set_cur_request(#state{reqs = Reqs, socket = Socket} = State) ->
case queue:to_list(Reqs) of
[] ->
case queue:peek(Reqs) of
empty ->
State#state{cur_req = undefined};
[#request{caller_controls_socket = Ccs} = NextReq | _] ->
{value, #request{caller_controls_socket = Ccs} = NextReq} ->
case Ccs of
true ->
do_setopts(Socket, [{active, once}], State);
Expand Down

0 comments on commit ee06a43

Please sign in to comment.