aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_http2.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/cowboy_http2.erl')
-rw-r--r--src/cowboy_http2.erl8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cowboy_http2.erl b/src/cowboy_http2.erl
index 36aea0c..3f45670 100644
--- a/src/cowboy_http2.erl
+++ b/src/cowboy_http2.erl
@@ -169,15 +169,15 @@ loop(State=#state{parent=Parent, socket=Socket, transport=Transport,
opts=Opts, timer=TimerRef, children=Children}, Buffer) ->
%% @todo This should only be called when data was read.
Transport:setopts(Socket, [{active, once}]),
- {OK, Closed, Error} = Transport:messages(),
+ Messages = Transport:messages(),
InactivityTimeout = maps:get(inactivity_timeout, Opts, 300000),
receive
%% Socket messages.
- {OK, Socket, Data} ->
+ {OK, Socket, Data} when OK =:= element(1, Messages) ->
parse(set_timeout(State), << Buffer/binary, Data/binary >>);
- {Closed, Socket} ->
+ {Closed, Socket} when Closed =:= element(2, Messages) ->
terminate(State, {socket_error, closed, 'The socket has been closed.'});
- {Error, Socket, Reason} ->
+ {Error, Socket, Reason} when Error =:= element(3, Messages) ->
terminate(State, {socket_error, Reason, 'An error has occurred on the socket.'});
%% System messages.
{'EXIT', Parent, Reason} ->