From 5b4e78fac483c5eb277fec4ab7e8c6a62821bf4b Mon Sep 17 00:00:00 2001 From: juhlig Date: Thu, 6 Jun 2019 17:52:34 +0200 Subject: Make Cowboy compatible with upcoming Ranch 2.0 --- src/cowboy_http2.erl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/cowboy_http2.erl') 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} -> -- cgit v1.2.3