diff options
| author | Dennis Brentjes <d.brentjes@gmail.com> | 2016-10-05 15:17:47 +0200 |
|---|---|---|
| committer | Dennis Brentjes <d.brentjes@gmail.com> | 2016-10-05 15:17:47 +0200 |
| commit | fa35c9c3c71243a7f8537e5a81f7a09fa05a382e (patch) | |
| tree | f87c7a051901bab904d9c9691b79240e1a16da99 | |
| parent | 88c5130eccd06e63ffca732626c0fb59426743a7 (diff) | |
| download | cmix-fa35c9c3c71243a7f8537e5a81f7a09fa05a382e.tar.gz cmix-fa35c9c3c71243a7f8537e5a81f7a09fa05a382e.tar.bz2 cmix-fa35c9c3c71243a7f8537e5a81f7a09fa05a382e.zip | |
Fixes some bugs in parsing the program_options.
| -rw-r--r-- | libcmix-network/server.cpp | 2 | ||||
| -rw-r--r-- | node/main.cpp | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/libcmix-network/server.cpp b/libcmix-network/server.cpp index 8dabecb..34e3183 100644 --- a/libcmix-network/server.cpp +++ b/libcmix-network/server.cpp @@ -19,7 +19,7 @@ Server::Server(io_service& io_service, const ListenSettings& listen_settings) if(bind_v4_any && bind_v6_any) { v6_acceptor.listen_v6_and_v4_any(); - } else if(bind_v4_any || bind_v6_any) { + } else if((bind_v4_any ^ bind_v6_any) && listen_settings.enable_ipv4 && listen_settings.enable_ipv6) { throw std::runtime_error("Cannot bind an INADDR_ANY and a non INADDR_ANY address on ipv4 and ipv6"); } else { if(listen_settings.enable_ipv4) { diff --git a/node/main.cpp b/node/main.cpp index 031e0d0..85b0ca5 100644 --- a/node/main.cpp +++ b/node/main.cpp @@ -22,7 +22,7 @@ int main(int argc, char* argv[]) { ("interface4,4", po::value<std::string>()->default_value("0.0.0.0"), "Set the ipv4 address to listen on.") ("enable_v6", po::value<bool>()->default_value(true), "Enable/disable ipv6 accept support.") ("interface6,6", po::value<std::string>()->default_value("::"), "Set the ipv6 address to listen on.") - ("next_node,n", po::value<std::string>()->required(), "The address of the next node in the network") + ("next_node,n", po::value<std::string>(), "The address of the next node in the network") ("first,f", "This is the first node and will be the communication point for the clients.") ; @@ -44,7 +44,13 @@ int main(int argc, char* argv[]) { ListenSettings lsettings{en4, if4, en6, if6, port}; bool is_first = bool(vm.count("first")); - std::string next_node = vm["next_node"].as<std::string>(); + std::string next_node; + if(vm.count("next_node")) { + next_node = vm["next_node"].as<std::string>(); + } else { + std::cerr << "next_node option is required." << std::endl; + return -1; + } Uri uri = parse_uri(next_node); |
