diff options
author | Viktor Söderqvist <[email protected]> | 2022-03-08 11:59:31 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2022-03-08 12:32:22 +0100 |
commit | b52a570377837fcee617114feb24aba8af4f24cf (patch) | |
tree | ee96a42761d684ef9fd86933fb820388a5c84346 /src/gun_http.erl | |
parent | b85a3894f3b8f86e255668a3ca3b1722c5d9d94e (diff) | |
download | gun-b52a570377837fcee617114feb24aba8af4f24cf.tar.gz gun-b52a570377837fcee617114feb24aba8af4f24cf.tar.bz2 gun-b52a570377837fcee617114feb24aba8af4f24cf.zip |
Make the stream_error_* functions return 'ok'
This will make it more obvious what callbacks return.
Diffstat (limited to 'src/gun_http.erl')
-rw-r--r-- | src/gun_http.erl | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/gun_http.erl b/src/gun_http.erl index ec29b71..d928b18 100644 --- a/src/gun_http.erl +++ b/src/gun_http.erl @@ -677,10 +677,12 @@ scheme(#http_state{transport=Transport}) -> %% We are expecting a new stream. data(State=#http_state{out=head}, StreamRef, ReplyTo, _, _, _, EvHandlerState) -> - {error_stream_closed(State, StreamRef, ReplyTo), EvHandlerState}; + error_stream_closed(State, StreamRef, ReplyTo), + {[], EvHandlerState}; %% There are no active streams. data(State=#http_state{streams=[]}, StreamRef, ReplyTo, _, _, _, EvHandlerState) -> - {error_stream_not_found(State, StreamRef, ReplyTo), EvHandlerState}; + error_stream_not_found(State, StreamRef, ReplyTo), + {[], EvHandlerState}; %% We can only send data on the last created stream. data(State=#http_state{socket=Socket, transport=Transport, version=Version, out=Out, streams=Streams}, StreamRef, ReplyTo, IsFin, Data, @@ -727,7 +729,8 @@ data(State=#http_state{socket=Socket, transport=Transport, version=Version, {[], EvHandlerState0} end; _ -> - {error_stream_not_found(State, StreamRef, ReplyTo), EvHandlerState0} + error_stream_not_found(State, StreamRef, ReplyTo), + {[], EvHandlerState0} end. connect(State, StreamRef, ReplyTo, _, _, _, _, _, EvHandlerState) @@ -803,7 +806,8 @@ cancel(State0, StreamRef, ReplyTo, EvHandler, EvHandlerState0) -> }, EvHandlerState0), {{state, State}, EvHandlerState}; false -> - {error_stream_not_found(State0, StreamRef, ReplyTo), EvHandlerState0} + error_stream_not_found(State0, StreamRef, ReplyTo), + {[], EvHandlerState0} end. stream_info(#http_state{streams=Streams}, StreamRef) -> @@ -831,12 +835,12 @@ down(#http_state{streams=Streams}) -> error_stream_closed(State, StreamRef, ReplyTo) -> ReplyTo ! {gun_error, self(), stream_ref(State, StreamRef), {badstate, "The stream has already been closed."}}, - {state, State}. + ok. error_stream_not_found(State, StreamRef, ReplyTo) -> ReplyTo ! {gun_error, self(), stream_ref(State, StreamRef), {badstate, "The stream cannot be found."}}, - {state, State}. + ok. %% Headers information retrieval. |