Skip to content

Commit

Permalink
[CPP-RPC] Fix command line argument capture (#11801)
Browse files Browse the repository at this point in the history
There are a couple of instances where command line options use a "-",
however when capturing these values a "_" is used, meaning they
don't get captured and the default value is used instead. Fixing
this by renaming instances of "_" -> "-".

Change-Id: I9e083e25c5cc273298cd15df85a5862ee5f6722c
  • Loading branch information
lhutton1 authored Jun 22, 2022
1 parent 6ed3ab3 commit 1e0e954
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apps/cpp_rpc/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,10 @@ void ParseCmdArgs(int argc, char* argv[], struct RpcServerArgs& args) {
args.port = stoi(port);
}

const string port_end = GetCmdOption(argc, argv, "--port_end=");
const string port_end = GetCmdOption(argc, argv, "--port-end=");
if (!port_end.empty()) {
if (!IsNumber(port_end) || stoi(port_end) > 65535) {
LOG(WARNING) << "Wrong port_end number.";
LOG(WARNING) << "Wrong port-end number.";
LOG(INFO) << kUsage;
exit(1);
}
Expand All @@ -226,7 +226,7 @@ void ParseCmdArgs(int argc, char* argv[], struct RpcServerArgs& args) {
args.key = key;
}

const string custom_addr = GetCmdOption(argc, argv, "--custom_addr=");
const string custom_addr = GetCmdOption(argc, argv, "--custom-addr=");
if (!custom_addr.empty()) {
if (!ValidateIP(custom_addr)) {
LOG(WARNING) << "Wrong custom address format.";
Expand Down

0 comments on commit 1e0e954

Please sign in to comment.