diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index cdfde3c..eb4aeee 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -103,7 +103,7 @@ jobs: brew install curl zip unzip gnu-sed kerl unixodbc freetds echo "/usr/local/bin" >> $GITHUB_PATH git config --global credential.helper store - - uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 + - uses: actions/cache@v4 id: cache with: path: ~/.kerl diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index ab5d490..505f3cd 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -143,7 +143,7 @@ jobs: brew install curl zip unzip gnu-sed kerl unixodbc freetds echo "/usr/local/bin" >> $GITHUB_PATH git config --global credential.helper store - - uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 + - uses: actions/cache@v4 id: cache with: path: ~/.kerl diff --git a/src/emqtt_bench.erl b/src/emqtt_bench.erl index a804e10..7d69672 100644 --- a/src/emqtt_bench.erl +++ b/src/emqtt_bench.erl @@ -538,7 +538,6 @@ connect(Parent, N, PubSub, Opts) -> Prometheus = lists:member(prometheus, Opts), GoSignalPid = proplists:get_value(publish_signal_pid, Opts), SendGoSignal = proplists:get_value(send_go_signal, Opts), - IsQuic = is_quic(Opts), MRef = case is_pid(GoSignalPid) of true -> monitor(process, GoSignalPid); _ -> undefined @@ -578,7 +577,7 @@ connect(Parent, N, PubSub, Opts) -> case ConnRet of {ok, _Props} -> inc_counter(Prometheus, connect_succ), - (not IsQuic) andalso maybe_record_keylogfile(Client), + _ = maybe_record_keylogfile(Client, Opts), Res = case PubSub of conn -> @@ -995,10 +994,8 @@ ssl_opts([{sslversion, Vsn} | Opts], Acc) -> ssl_opts(Opts, [{versions, [Vsn]} | Acc]); ssl_opts([{ssl, IsSSL} | Opts], Acc) when is_boolean(IsSSL) -> ssl_opts(Opts, Acc); -ssl_opts([{nst_dets_file, DetsFile}| Opts], Acc) -> - ok = prepare_nst(DetsFile), - io:format("enable session_tickets~n"), - ssl_opts(Opts, [{session_tickets, manual}|Acc]); +ssl_opts([{nst_dets_file, _DetsFile}| Opts], Acc) -> + ssl_opts(Opts, [{session_tickets, manual} | Acc]); ssl_opts([{ciphers, Ciphers}| Opts], Acc) -> CipherList = [ssl:str_to_suite(X) || X <- string:tokens(Ciphers, ",")], ssl_opts(Opts, [{ciphers, CipherList} | Acc]); @@ -1552,6 +1549,10 @@ maybe_prefix_payload(Payload, ClientOpts) -> is_quic(Opts) -> proplists:get_value(quic, Opts) =/= false. +-spec is_tls(proplists:proplist()) -> boolean(). +is_tls(Opts) -> + proplists:get_bool(ssl, Opts). + quic_opts_from_arg(Opts)-> case proplists:get_value(quic, Opts) of V when is_boolean(V) -> @@ -1584,11 +1585,13 @@ prepare_quicer(Opts) -> end. %% @doc write SSL keylog file, for Wireshark TLS decryption. -%% SSL only, doesn't work for other transport +%% SSL only, doesn't work for other transports %% @end --spec maybe_record_keylogfile(emqtt:client()) -> ok. -maybe_record_keylogfile(Client) when is_pid(Client) -> - do_write_keylogfile(persistent_term:get(sslkeylogfile, false), Client). +-spec maybe_record_keylogfile(emqtt:client(), proplists:proplist()) -> _. +maybe_record_keylogfile(Client, Opts) when is_pid(Client) -> + is_tls(Opts) andalso + not is_quic(Opts) andalso + do_write_keylogfile(persistent_term:get(sslkeylogfile, false), Client). do_write_keylogfile(false, _Client) -> ok; do_write_keylogfile(Keylogpath, Client) ->