diff options
author | juhlig <[email protected]> | 2019-06-06 17:52:34 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2019-07-16 15:35:45 +0200 |
commit | 5b4e78fac483c5eb277fec4ab7e8c6a62821bf4b (patch) | |
tree | bb06aa4e6b00901da26e44f546f97f447e995f18 /src/cowboy_http2.erl | |
parent | 7708fc77cd95768aef65bd0eb366ee300cc0515f (diff) | |
download | cowboy-5b4e78fac483c5eb277fec4ab7e8c6a62821bf4b.tar.gz cowboy-5b4e78fac483c5eb277fec4ab7e8c6a62821bf4b.tar.bz2 cowboy-5b4e78fac483c5eb277fec4ab7e8c6a62821bf4b.zip |
Make Cowboy compatible with upcoming Ranch 2.0
Diffstat (limited to 'src/cowboy_http2.erl')
-rw-r--r-- | src/cowboy_http2.erl | 8 |
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} -> |