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

fix(quic): handle fast_close while handshake fail

William Yang 3 лет назад
Родитель
Сommit
9b52beaee9
1 измененных файлов с 5 добавлено и 1 удалено
  1. 5 1
      apps/emqx/src/emqx_quic_stream.erl

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

@@ -159,9 +159,13 @@ getopts(_Socket, _Opts) ->
         {buffer, 80000}
         {buffer, 80000}
     ]}.
     ]}.
 
 
+%% @TODO supply some App Error Code
+fast_close({ConnOwner, Conn, _ConnInfo}) when is_pid(ConnOwner) ->
+    %% handshake aborted.
+    quicer:async_shutdown_connection(Conn, ?QUIC_CONNECTION_SHUTDOWN_FLAG_NONE, 0),
+    ok;
 fast_close({quic, Conn, _Stream, _Info}) ->
 fast_close({quic, Conn, _Stream, _Info}) ->
     %% Since we shutdown the control stream, we shutdown the connection as well
     %% Since we shutdown the control stream, we shutdown the connection as well
-    %% @TODO supply some App Error Code
     quicer:async_shutdown_connection(Conn, ?QUIC_CONNECTION_SHUTDOWN_FLAG_NONE, 0),
     quicer:async_shutdown_connection(Conn, ?QUIC_CONNECTION_SHUTDOWN_FLAG_NONE, 0),
     ok.
     ok.