From f2e8d103dd7827251fa726c42e307e42cef8a3dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 7 Oct 2020 16:35:17 +0200 Subject: Propagate timeouts to the right layer in HTTP/2 tunnels This temporarily depends on Cowlib master. --- src/gun_tunnel.erl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/gun_tunnel.erl') 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, -- cgit v1.2.3