aboutsummaryrefslogtreecommitdiffstats
path: root/src/gun_tunnel.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2020-10-07 16:35:17 +0200
committerLoïc Hoguin <[email protected]>2020-10-07 16:35:17 +0200
commitf2e8d103dd7827251fa726c42e307e42cef8a3dc (patch)
tree5e36b552400569875f69278f1c84bacff1db53f3 /src/gun_tunnel.erl
parent4496f8e25702810a910fdc8d7a5edaf04bf54690 (diff)
downloadgun-f2e8d103dd7827251fa726c42e307e42cef8a3dc.tar.gz
gun-f2e8d103dd7827251fa726c42e307e42cef8a3dc.tar.bz2
gun-f2e8d103dd7827251fa726c42e307e42cef8a3dc.zip
Propagate timeouts to the right layer in HTTP/2 tunnels
This temporarily depends on Cowlib master.
Diffstat (limited to 'src/gun_tunnel.erl')
-rw-r--r--src/gun_tunnel.erl11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gun_tunnel.erl b/src/gun_tunnel.erl
index f7d0232..ca9d3aa 100644
--- a/src/gun_tunnel.erl
+++ b/src/gun_tunnel.erl
@@ -324,10 +324,13 @@ cancel(State=#tunnel_state{protocol=Proto, protocol_state=ProtoState},
{Commands, EvHandlerState} = Proto:cancel(ProtoState, StreamRef, ReplyTo, EvHandler, EvHandlerState0),
{{state, commands(Commands, State)}, EvHandlerState}.
-timeout(_State, {cow_http2_machine, _Name}, _TRef) ->
- %% @todo We currently have no way of routing timeout events to the right layer.
- %% We will need to update Cowlib to include routing information in the timeout message.
- [].
+timeout(State=#tunnel_state{protocol=Proto, protocol_state=ProtoState0}, Msg, TRef) ->
+ case Proto:timeout(ProtoState0, Msg, TRef) of
+ {state, ProtoState} ->
+ {state, State#tunnel_state{protocol_state=ProtoState}};
+ Other ->
+ Other
+ end.
stream_info(#tunnel_state{transport=Transport0, stream_ref=TunnelStreamRef, reply_to=ReplyTo,
tunnel_protocol=TunnelProtocol,