diff options
author | Loïc Hoguin <[email protected]> | 2013-08-26 18:57:34 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2013-08-26 18:57:34 +0200 |
commit | e176953cd095e8c65d56461f840a14d53c57a1c1 (patch) | |
tree | 08bd22a056adf94b1b8a44f3c03da6cf4ed48b29 | |
parent | 5388696cf95d6c9b4400952bfcf3fb9db215c63c (diff) | |
download | gun-e176953cd095e8c65d56461f840a14d53c57a1c1.tar.gz gun-e176953cd095e8c65d56461f840a14d53c57a1c1.tar.bz2 gun-e176953cd095e8c65d56461f840a14d53c57a1c1.zip |
Sync message signature with documentation
-rw-r--r-- | src/gun.erl | 10 | ||||
-rw-r--r-- | src/gun_spdy.erl | 14 | ||||
-rw-r--r-- | test/twitter_SUITE.erl | 6 |
3 files changed, 15 insertions, 15 deletions
diff --git a/src/gun.erl b/src/gun.erl index 21666ec..112ab07 100644 --- a/src/gun.erl +++ b/src/gun.erl @@ -193,7 +193,7 @@ init(Parent, Owner, Host, Port, Opts) -> keepalive=Keepalive, type=Type, retry=Retry, retry_timeout=RetryTimeout}, Retry) catch Class:Reason -> - Owner ! {gun, error, self(), {{Class, Reason, erlang:get_stacktrace()}, + Owner ! {gun_error, self(), {{Class, Reason, erlang:get_stacktrace()}, "An unexpected error occurred."}} end. @@ -301,15 +301,15 @@ loop(State=#state{parent=Parent, owner=Owner, host=Host, sys:handle_system_msg(Request, From, Parent, ?MODULE, [], {loop, [State]}); Any when is_tuple(Any), is_pid(element(2, Any)) -> - element(2, Any) ! {gun, error, self(), {notowner, + element(2, Any) ! {gun_error, self(), {notowner, "Operations are restricted to the owner of the connection."}}, loop(State); {ws_upgrade, _, _, _} -> - Owner ! {gun, error, self(), {badstate, + Owner ! {gun_error, self(), {badstate, "Websocket over SPDY isn't supported."}}, loop(State); {ws_send, _, _} -> - Owner ! {gun, error, self(), {badstate, + Owner ! {gun_error, self(), {badstate, "Connection needs to be upgraded to Websocket " "before the gun:ws_send/1 function can be used."}}, loop(State); @@ -344,7 +344,7 @@ ws_loop(State=#state{parent=Parent, owner=Owner, retry=Retry, socket=Socket, sys:handle_system_msg(Request, From, Parent, ?MODULE, [], {loop, [State]}); Any when is_tuple(Any), is_pid(element(2, Any)) -> - element(2, Any) ! {gun, error, self(), {notowner, + element(2, Any) ! {gun_error, self(), {notowner, "Operations are restricted to the owner of the connection."}}, loop(State); Any -> diff --git a/src/gun_spdy.erl b/src/gun_spdy.erl index 98c538f..441532e 100644 --- a/src/gun_spdy.erl +++ b/src/gun_spdy.erl @@ -68,10 +68,10 @@ handle_frame(Rest, State=#spdy_state{owner=Owner, cow_spdy:rst_stream(StreamID, stream_already_closed)), handle_loop(Rest, delete_stream(StreamID, State)); S = #stream{ref=StreamRef} when IsFin -> - Owner ! {gun, data, self(), StreamRef, fin, Data}, + Owner ! {gun_data, self(), StreamRef, fin, Data}, handle_loop(Rest, in_fin_stream(S, State)); #stream{ref=StreamRef} -> - Owner ! {gun, data, self(), StreamRef, nofin, Data}, + Owner ! {gun_data, self(), StreamRef, nofin, Data}, handle_loop(Rest, State); false -> Transport:send(Socket, @@ -116,7 +116,7 @@ handle_frame(Rest, State=#spdy_state{owner=Owner, cow_spdy:rst_stream(StreamID, stream_already_closed)), handle_loop(Rest, delete_stream(StreamID, State)); S = #stream{ref=StreamRef} -> - Owner ! {gun, response, self(), StreamRef, Status, Headers}, + Owner ! {gun_response, self(), StreamRef, Status, Headers}, if IsFin -> handle_loop(Rest, in_fin_stream(S, State)); true -> @@ -131,7 +131,7 @@ handle_frame(Rest, State=#spdy_state{owner=Owner}, {rst_stream, StreamID, Status}) -> case get_stream_by_id(StreamID, State) of #stream{} -> - Owner ! {gun, error, self(), StreamID, Status}, + Owner ! {gun_error, self(), StreamID, Status}, handle_loop(Rest, delete_stream(StreamID, State)); false -> handle_loop(Rest, State) @@ -162,7 +162,7 @@ handle_frame(Rest, State, {window_update, StreamID, DeltaWindowSize}) -> handle_loop(Rest, State); handle_frame(_, #spdy_state{owner=Owner, socket=Socket, transport=Transport}, {error, badprotocol}) -> - Owner ! {gun, error, self(), {badprotocol, + Owner ! {gun_error, self(), {badprotocol, "The remote endpoint sent invalid data."}}, %% @todo LastGoodStreamID Transport:send(Socket, cow_spdy:goaway(0, protocol_error)), @@ -222,12 +222,12 @@ cancel(State=#spdy_state{socket=Socket, transport=Transport}, end. error_stream_closed(State=#spdy_state{owner=Owner}) -> - Owner ! {gun, error, self(), {badstate, + Owner ! {gun_error, self(), {badstate, "The stream has already been closed."}}, State. error_stream_not_found(State=#spdy_state{owner=Owner}) -> - Owner ! {gun, error, self(), {badstate, + Owner ! {gun_error, self(), {badstate, "The stream cannot be found."}}, State. diff --git a/test/twitter_SUITE.erl b/test/twitter_SUITE.erl index 26afdc3..ba3f949 100644 --- a/test/twitter_SUITE.erl +++ b/test/twitter_SUITE.erl @@ -51,7 +51,7 @@ spdy(_) -> {ok, Pid} = gun:open("twitter.com", 443, []), Ref = gun:get(Pid, "/"), receive - {gun, response, Pid, Ref, Status, Headers} -> + {gun_response, Pid, Ref, Status, Headers} -> ct:print("response ~p ~p", [Status, Headers]), data_loop(Pid, Ref) after 5000 -> @@ -60,10 +60,10 @@ spdy(_) -> data_loop(Pid, Ref) -> receive - {gun, data, Pid, Ref, nofin, Data} -> + {gun_data, Pid, Ref, nofin, Data} -> ct:print("data ~p", [Data]), data_loop(Pid, Ref); - {gun, data, Pid, Ref, fin, Data} -> + {gun_data, Pid, Ref, fin, Data} -> ct:print("data ~p~nend", [Data]) after 5000 -> error(timeout) |