From ad6302f51092009de5b1d4481ef2bfcd4091a257 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20S=C3=B6derqvist?= Date: Thu, 25 Aug 2022 14:29:35 +0200 Subject: Make Protocol:init/4 return an ok-tuple This is a preparation for allowing init/4 to return an ok or an error tuple. --- src/gun_http2.erl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/gun_http2.erl') diff --git a/src/gun_http2.erl b/src/gun_http2.erl index e681963..e3ff130 100644 --- a/src/gun_http2.erl +++ b/src/gun_http2.erl @@ -186,7 +186,7 @@ init(ReplyTo, Socket, Transport, Opts0) -> opts=Opts, base_stream_ref=BaseStreamRef, tunnel_transport=TunnelTransport, content_handlers=Handlers, http2_machine=HTTP2Machine}, Transport:send(Socket, Preface), - {connected, State}. + {ok, connected, State}. switch_transport(Transport, Socket, State) -> State#http2_state{socket=Socket, transport=Transport}. @@ -609,7 +609,8 @@ headers_frame_connect_websocket(State, Stream=#stream{ref=StreamRef, reply_to=Re handler => Handler, opts => WsOpts }, - {connected_ws_only, ProtoState} = Proto:init( + %% @todo Handle error result from Proto:init/4 + {ok, connected_ws_only, ProtoState} = Proto:init( ReplyTo, OriginSocket, gun_tcp_proxy, ProtoOpts), {store_stream(State, Stream#stream{tunnel=Tunnel#tunnel{state=established, protocol=Proto, protocol_state=ProtoState}}), -- cgit v1.2.3