aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2019-04-26 15:26:24 +0200
committerLoïc Hoguin <[email protected]>2019-04-26 15:26:24 +0200
commit3c15d2c749b95032944d89738a4cf118dfb3115d (patch)
tree44e1a04a302727683ca5f829224e8bd3bae39eeb
parent719e45ec354e2b5c155aa5ffef3b5cfcf3a5d484 (diff)
downloadgun-3c15d2c749b95032944d89738a4cf118dfb3115d.tar.gz
gun-3c15d2c749b95032944d89738a4cf118dfb3115d.tar.bz2
gun-3c15d2c749b95032944d89738a4cf118dfb3115d.zip
Rename owner_gone into owner_down
-rw-r--r--src/gun.erl16
-rw-r--r--src/gun_ws.erl2
-rw-r--r--test/gun_SUITE.erl8
3 files changed, 13 insertions, 13 deletions
diff --git a/src/gun.erl b/src/gun.erl
index c2054e0..43a6bf9 100644
--- a/src/gun.erl
+++ b/src/gun.erl
@@ -880,19 +880,19 @@ connected(Type, Event, State) ->
handle_common(cast, {shutdown, Owner}, _, #state{owner=Owner}) ->
%% @todo Graceful shutdown.
stop;
-%% We stop when the owner is gone.
+%% We stop when the owner is down.
handle_common(info, {'DOWN', OwnerRef, process, Owner, Reason}, _, #state{
owner=Owner, owner_ref=OwnerRef, socket=Socket, transport=Transport,
protocol=Protocol, protocol_state=ProtoState}) ->
_ = case Protocol of
undefined -> ok;
- _ -> Protocol:close(owner_gone, ProtoState)
+ _ -> Protocol:close(owner_down, ProtoState)
end,
_ = case Socket of
undefined -> ok;
_ -> Transport:close(Socket)
end,
- owner_gone(Reason);
+ owner_down(Reason);
handle_common({call, From}, _, _, _) ->
{keep_state_and_data, {reply, From, {error, bad_call}}};
%% @todo The ReplyTo patch disabled the notowner behavior.
@@ -1008,8 +1008,8 @@ keepalive_cancel(State=#state{keepalive_ref=KeepaliveRef}) ->
end,
State#state{keepalive_ref=undefined}.
--spec owner_gone(_) -> stop | {stop, _}.
-owner_gone(normal) -> stop;
-owner_gone(shutdown) -> {stop, shutdown};
-owner_gone(Shutdown = {shutdown, _}) -> {stop, Shutdown};
-owner_gone(Reason) -> {stop, {shutdown, {owner_gone, Reason}}}.
+-spec owner_down(_) -> stop | {stop, _}.
+owner_down(normal) -> stop;
+owner_down(shutdown) -> {stop, shutdown};
+owner_down(Shutdown = {shutdown, _}) -> {stop, Shutdown};
+owner_down(Reason) -> {stop, {shutdown, {owner_down, Reason}}}.
diff --git a/src/gun_ws.erl b/src/gun_ws.erl
index cb3a45a..176ba3b 100644
--- a/src/gun_ws.erl
+++ b/src/gun_ws.erl
@@ -135,7 +135,7 @@ close(Reason, State) ->
case Reason of
normal ->
send({close, 1000, <<>>}, State);
- owner_gone ->
+ owner_down ->
send({close, 1001, <<>>}, State);
{error, badframe} ->
send({close, 1002, <<>>}, State);
diff --git a/test/gun_SUITE.erl b/test/gun_SUITE.erl
index 2c7b4b8..6afaaf5 100644
--- a/test/gun_SUITE.erl
+++ b/test/gun_SUITE.erl
@@ -74,7 +74,7 @@ connect_timeout_infinity(_) ->
error(timeout)
end.
-detect_owner_gone(_) ->
+detect_owner_down(_) ->
{ok, ListenSocket} = gen_tcp:listen(0, [binary, {active, false}]),
{ok, {_, Port}} = inet:sockname(ListenSocket),
Self = self(),
@@ -100,7 +100,7 @@ detect_owner_gone(_) ->
error(timeout)
end.
-detect_owner_gone_unexpected(_) ->
+detect_owner_down_unexpected(_) ->
{ok, ListenSocket} = gen_tcp:listen(0, [binary, {active, false}]),
{ok, {_, Port}} = inet:sockname(ListenSocket),
Self = self(),
@@ -120,14 +120,14 @@ detect_owner_gone_unexpected(_) ->
end,
Ref = monitor(process, Pid),
receive
- {'DOWN', Ref, process, Pid, {shutdown, {owner_gone, unexpected}}} ->
+ {'DOWN', Ref, process, Pid, {shutdown, {owner_down, unexpected}}} ->
ok
after 1000 ->
true = erlang:is_process_alive(Pid),
error(timeout)
end.
-detect_owner_gone_ws(_) ->
+detect_owner_down_ws(_) ->
Name = name(),
{ok, _} = cowboy:start_clear(Name, [], #{env => #{
dispatch => cowboy_router:compile([{'_', [{"/", ws_echo, []}]}])