Skip to content

Commit

Permalink
Force command line argument value
Browse files Browse the repository at this point in the history
  • Loading branch information
ibc committed Aug 12, 2024
1 parent db2252c commit 669ddca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 38 deletions.
2 changes: 1 addition & 1 deletion node/src/Worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ export class Worker<
}

if (disableLiburing) {
spawnArgs.push(`--disableLiburing`);
spawnArgs.push(`--disableLiburing=true`);
}

logger.debug(
Expand Down
49 changes: 12 additions & 37 deletions worker/src/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);

Expand All @@ -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);

Expand All @@ -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<uint16_t>(std::stoi(optarg));
Expand All @@ -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<uint16_t>(std::stoi(optarg));
Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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)
Expand All @@ -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;
}
Expand Down

0 comments on commit 669ddca

Please sign in to comment.