From 669ddca8a394bb985f191311689557990369ced3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20Baz=20Castillo?= Date: Mon, 12 Aug 2024 12:00:23 +0200 Subject: [PATCH] Force command line argument value --- node/src/Worker.ts | 2 +- worker/src/Settings.cpp | 49 ++++++++++------------------------------- 2 files changed, 13 insertions(+), 38 deletions(-) diff --git a/node/src/Worker.ts b/node/src/Worker.ts index 2d5ab30bc2..73480a406d 100644 --- a/node/src/Worker.ts +++ b/node/src/Worker.ts @@ -345,7 +345,7 @@ export class Worker< } if (disableLiburing) { - spawnArgs.push(`--disableLiburing`); + spawnArgs.push(`--disableLiburing=true`); } logger.debug( diff --git a/worker/src/Settings.cpp b/worker/src/Settings.cpp index d3411b495a..e42c3bde94 100644 --- a/worker/src/Settings.cpp +++ b/worker/src/Settings.cpp @@ -60,7 +60,7 @@ void Settings::SetConfiguration(int argc, char* argv[]) { "dtlsCertificateFile", optional_argument, nullptr, 'c' }, { "dtlsPrivateKeyFile", optional_argument, nullptr, 'p' }, { "libwebrtcFieldTrials", optional_argument, nullptr, 'W' }, - { "disableLiburing", no_argument, nullptr, 'd' }, + { "disableLiburing", optional_argument, nullptr, 'd' }, { nullptr, 0, nullptr, 0 } }; // clang-format on @@ -77,15 +77,15 @@ void Settings::SetConfiguration(int argc, char* argv[]) while ((c = getopt_long_only(argc, argv, "", options, &optionIdx)) != -1) { + if (!optarg) + { + MS_THROW_TYPE_ERROR("missing value in command line argument: %s", optarg); + } + switch (c) { case 'l': { - if (!optarg) - { - MS_THROW_TYPE_ERROR("missing value in command line argument: %s", optarg); - } - stringValue = std::string(optarg); SetLogLevel(stringValue); @@ -94,11 +94,6 @@ void Settings::SetConfiguration(int argc, char* argv[]) case 't': { - if (!optarg) - { - MS_THROW_TYPE_ERROR("missing value in command line argument: %s", optarg); - } - stringValue = std::string(optarg); logTags.push_back(stringValue); @@ -107,11 +102,6 @@ void Settings::SetConfiguration(int argc, char* argv[]) case 'm': { - if (!optarg) - { - MS_THROW_TYPE_ERROR("missing value in command line argument: %s", optarg); - } - try { Settings::configuration.rtcMinPort = static_cast(std::stoi(optarg)); @@ -126,11 +116,6 @@ void Settings::SetConfiguration(int argc, char* argv[]) case 'M': { - if (!optarg) - { - MS_THROW_TYPE_ERROR("missing value in command line argument: %s", optarg); - } - try { Settings::configuration.rtcMaxPort = static_cast(std::stoi(optarg)); @@ -145,11 +130,6 @@ void Settings::SetConfiguration(int argc, char* argv[]) case 'c': { - if (!optarg) - { - MS_THROW_TYPE_ERROR("missing value in command line argument: %s", optarg); - } - stringValue = std::string(optarg); Settings::configuration.dtlsCertificateFile = stringValue; @@ -158,11 +138,6 @@ void Settings::SetConfiguration(int argc, char* argv[]) case 'p': { - if (!optarg) - { - MS_THROW_TYPE_ERROR("missing value in command line argument: %s", optarg); - } - stringValue = std::string(optarg); Settings::configuration.dtlsPrivateKeyFile = stringValue; @@ -171,11 +146,6 @@ void Settings::SetConfiguration(int argc, char* argv[]) case 'W': { - if (!optarg) - { - MS_THROW_TYPE_ERROR("missing value in command line argument: %s", optarg); - } - stringValue = std::string(optarg); if (stringValue != Settings::configuration.libwebrtcFieldTrials) @@ -192,7 +162,12 @@ void Settings::SetConfiguration(int argc, char* argv[]) case 'd': { - Settings::configuration.liburingDisabled = true; + stringValue = std::string(optarg); + + if (stringValue == "true") + { + Settings::configuration.liburingDisabled = true; + } break; }