Skip to content

Commit

Permalink
Merge pull request #205 from lexmag/hibernate-properly
Browse files Browse the repository at this point in the history
Put stream processes in hibernate properly
  • Loading branch information
benoitc committed Jul 15, 2015
2 parents bc0513c + be6bf0d commit e0efcca
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/hackney_client/hackney_stream.erl
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ maybe_continue(Parent, Owner, Ref, #client{transport=Transport,
{Ref, resume} ->
stream_loop(Parent, Owner, Ref, Client);
{Ref, pause} ->
erlang:hibernate(?MODULE, maybe_continue, [Parent, Owner, Ref,
proc_lib:hibernate(?MODULE, maybe_continue, [Parent, Owner, Ref,
Client]);
{Ref, stop_async, From} ->
hackney_manager:store_state(Client#client{async=false}),
Expand Down Expand Up @@ -134,7 +134,7 @@ maybe_continue(Parent, Owner, Ref, #client{transport=Transport,
error_logger:error_msg("Unexpected message: ~w~n", [Else])
after 5000 ->

erlang:hibernate(?MODULE, maybe_continue, [Parent, Owner, Ref,
proc_lib:hibernate(?MODULE, maybe_continue, [Parent, Owner, Ref,
Client])

end.
Expand Down Expand Up @@ -234,8 +234,7 @@ async_recv(Parent, Owner, Ref,
{Ref, pause} ->
%% make sure that the proces won't be awoken by a tcp msg
Transport:setopts(Sock, [{active, false}]),
%% hibernate
erlang:hibernate(?MODULE, async_recv, [Parent, Owner, Ref,
proc_lib:hibernate(?MODULE, async_recv, [Parent, Owner, Ref,
Client, Buffer]);
{Ref, close} ->
Transport:close(Sock);
Expand Down

0 comments on commit e0efcca

Please sign in to comment.