aboutsummaryrefslogtreecommitdiffstats
path: root/src/gun_tunnel.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/gun_tunnel.erl')
-rw-r--r--src/gun_tunnel.erl9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gun_tunnel.erl b/src/gun_tunnel.erl
index 40addf6..169fd6f 100644
--- a/src/gun_tunnel.erl
+++ b/src/gun_tunnel.erl
@@ -113,7 +113,8 @@ init(ReplyTo, OriginSocket, OriginTransport, Opts=#{stream_ref := StreamRef, tun
%% Initialize the protocol.
#{new_protocol := NewProtocol} ->
{Proto, ProtoOpts} = gun_protocols:handler_and_opts(NewProtocol, Opts),
- {_, ProtoState} = Proto:init(ReplyTo, OriginSocket, OriginTransport,
+ %% @todo Handle error result from Proto:init/4
+ {ok, _, ProtoState} = Proto:init(ReplyTo, OriginSocket, OriginTransport,
ProtoOpts#{stream_ref => StreamRef, tunnel_transport => tcp}),
EvHandlerState = EvHandler:protocol_changed(#{
stream_ref => StreamRef,
@@ -195,7 +196,8 @@ handle_continue(ContinueStreamRef, {gun_tls_proxy, ProxyPid, {ok, Negotiated},
reply_to => ReplyTo,
stream_ref => StreamRef
},
- {_, ProtoState} = Proto:init(ReplyTo, OriginSocket, gun_tcp_proxy,
+ %% @todo Handle error result from Proto:init/4
+ {ok, _, ProtoState} = Proto:init(ReplyTo, OriginSocket, gun_tcp_proxy,
ProtoOpts#{stream_ref => StreamRef, tunnel_transport => tls}),
ReplyTo ! {gun_tunnel_up, self(), StreamRef, Proto:name()},
{{state, State#tunnel_state{protocol=Proto, protocol_state=ProtoState}},
@@ -476,7 +478,8 @@ commands([{switch_protocol, NewProtocol, ReplyTo}|Tail],
EvHandler, EvHandlerState0) ->
{Proto, ProtoOpts} = gun_protocols:handler_and_opts(NewProtocol, Opts),
%% This should only apply to Websocket for the time being.
- {connected_ws_only, ProtoState} = Proto:init(ReplyTo, Socket, Transport, ProtoOpts),
+ %% @todo Handle error result from Proto:init/4
+ {ok, connected_ws_only, ProtoState} = Proto:init(ReplyTo, Socket, Transport, ProtoOpts),
#{stream_ref := StreamRef} = ProtoOpts,
EvHandlerState = EvHandler:protocol_changed(#{
stream_ref => StreamRef,