Skip to content
Snippets Groups Projects
Commit c1f805e6 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

tools: use default port from network utils

parent 25c9375d
No related branches found
No related tags found
No related merge requests found
...@@ -196,7 +196,7 @@ void cmd_loop(std::shared_ptr<DhtRunner>& node, dht_params& params ...@@ -196,7 +196,7 @@ void cmd_loop(std::shared_ptr<DhtRunner>& node, dht_params& params
try { try {
auto addr = splitPort(idstr); auto addr = splitPort(idstr);
if (not addr.first.empty() and addr.second.empty()) if (not addr.first.empty() and addr.second.empty())
addr.second = std::to_string(DHT_DEFAULT_PORT); addr.second = std::to_string(dht::net::DHT_DEFAULT_PORT);
node->bootstrap(addr.first.c_str(), addr.second.c_str()); node->bootstrap(addr.first.c_str(), addr.second.c_str());
} catch (const std::exception& e) { } catch (const std::exception& e) {
std::cerr << e.what() << std::endl; std::cerr << e.what() << std::endl;
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <opendht.h> #include <opendht.h>
#include <opendht/log.h> #include <opendht/log.h>
#include <opendht/crypto.h> #include <opendht/crypto.h>
#include <opendht/network_utils.h>
#ifndef WIN32_NATIVE #ifndef WIN32_NATIVE
#include <getopt.h> #include <getopt.h>
#include <readline/readline.h> #include <readline/readline.h>
...@@ -106,8 +107,6 @@ loadFile(const std::string& path) ...@@ -106,8 +107,6 @@ loadFile(const std::string& path)
return buffer; return buffer;
} }
static const constexpr in_port_t DHT_DEFAULT_PORT = 4222;
struct dht_params { struct dht_params {
bool help {false}; // print help and exit bool help {false}; // print help and exit
bool version {false}; bool version {false};
...@@ -200,7 +199,7 @@ parseArgs(int argc, char **argv) { ...@@ -200,7 +199,7 @@ parseArgs(int argc, char **argv) {
case 'b': case 'b':
params.bootstrap = dht::splitPort((optarg[0] == '=') ? optarg+1 : optarg); params.bootstrap = dht::splitPort((optarg[0] == '=') ? optarg+1 : optarg);
if (not params.bootstrap.first.empty() and params.bootstrap.second.empty()) { if (not params.bootstrap.first.empty() and params.bootstrap.second.empty()) {
params.bootstrap.second = std::to_string(DHT_DEFAULT_PORT); params.bootstrap.second = std::to_string(dht::net::DHT_DEFAULT_PORT);
} }
break; break;
case 'V': case 'V':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment