Просмотр исходного кода

fix(quic): handle timeout event in data stream

William Yang 3 лет назад
Родитель
Сommit
d8fa65ea09
2 измененных файлов с 8 добавлено и 1 удалено
  1. 3 0
      apps/emqx/src/emqx_quic_connection.erl
  2. 5 1
      apps/emqx/src/emqx_quic_data_stream.erl

+ 3 - 0
apps/emqx/src/emqx_quic_connection.erl

@@ -280,6 +280,9 @@ handle_info({'EXIT', Pid, Reason}, #{streams := Streams} = S) ->
                 Reason =:= killed
                 Reason =:= killed
         ->
         ->
             {ok, S};
             {ok, S};
+        true ->
+            ?SLOG(info, #{message => "Data stream unexpected exit", reason => Reason}),
+            {ok, S};
         false ->
         false ->
             {stop, unknown_pid_down, S}
             {stop, unknown_pid_down, S}
     end.
     end.

+ 5 - 1
apps/emqx/src/emqx_quic_data_stream.erl

@@ -233,7 +233,11 @@ do_handle_appl_msg({event, updated}, S) ->
 
 
 handle_info(Deliver = {deliver, _, _}, S) ->
 handle_info(Deliver = {deliver, _, _}, S) ->
     Delivers = [Deliver],
     Delivers = [Deliver],
-    with_channel(handle_deliver, [Delivers], S).
+    with_channel(handle_deliver, [Delivers], S);
+handle_info({timeout, Ref, Msg}, S) ->
+    with_channel(handle_timeout, [Ref, Msg], S);
+handle_info(Info, State) ->
+    with_channel(handle_info, [Info], State).
 
 
 with_channel(Fun, Args, #{channel := Channel, task_queue := Q} = S) when
 with_channel(Fun, Args, #{channel := Channel, task_queue := Q} = S) when
     Channel =/= undefined
     Channel =/= undefined