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

feat(quic): reload quicer lib before start listener

William Yang 4 лет назад
Родитель
Сommit
e062be2b0e

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

@@ -49,9 +49,6 @@ start(_Type, _Args) ->
     ok = emqx_plugins:init(),
     _ = emqx_plugins:load(),
     _ = start_ce_modules(),
-    %% @fixme unsure why we need this.
-    quicer_nif:open_lib(),
-    quicer_nif:reg_open(),
     emqx_boot:is_enabled(listeners) andalso (ok = emqx_listeners:start()),
     register(emqx, self()),
     ok = emqx_alarm_handler:load(),

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

@@ -143,6 +143,9 @@ start_listener(Proto, ListenOn, Options) when Proto == https; Proto == wss ->
 
 %% Start MQTT/QUIC listener
 start_listener(quic, ListenOn, Options) ->
+    %% @fixme unsure why we need reopen lib and reopen config.
+    quicer_nif:open_lib(),
+    quicer_nif:reg_open(),
     SSLOpts = proplists:get_value(ssl_options, Options),
     ListenOpts = [ {cert, proplists:get_value(certfile, SSLOpts)}
                  , {key, proplists:get_value(keyfile, SSLOpts)}

+ 1 - 0
apps/emqx/test/emqx_listeners_SUITE.erl

@@ -28,6 +28,7 @@ all() -> emqx_ct:all(?MODULE).
 init_per_suite(Config) ->
     NewConfig = generate_config(),
     application:ensure_all_started(esockd),
+    application:ensure_all_started(quicer),
     application:ensure_all_started(cowboy),
     lists:foreach(fun set_app_env/1, NewConfig),
     Config.