Skip to content
Permalink
Browse files

tools: use default port from network utils

  • Loading branch information...
aberaud committed Aug 2, 2019
1 parent 25c9375 commit c1f805e6e2bb2809fac8b6e3b9e53261a2018dab
Showing with 3 additions and 4 deletions.
  1. +1 −1 tools/dhtnode.cpp
  2. +2 −3 tools/tools_common.h
@@ -196,7 +196,7 @@ void cmd_loop(std::shared_ptr<DhtRunner>& node, dht_params& params
try {
auto addr = splitPort(idstr);
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());
} catch (const std::exception& e) {
std::cerr << e.what() << std::endl;
@@ -24,6 +24,7 @@
#include <opendht.h>
#include <opendht/log.h>
#include <opendht/crypto.h>
#include <opendht/network_utils.h>
#ifndef WIN32_NATIVE
#include <getopt.h>
#include <readline/readline.h>
@@ -106,8 +107,6 @@ loadFile(const std::string& path)
return buffer;
}

static const constexpr in_port_t DHT_DEFAULT_PORT = 4222;

struct dht_params {
bool help {false}; // print help and exit
bool version {false};
@@ -200,7 +199,7 @@ parseArgs(int argc, char **argv) {
case 'b':
params.bootstrap = dht::splitPort((optarg[0] == '=') ? optarg+1 : optarg);
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;
case 'V':

0 comments on commit c1f805e

Please sign in to comment.
You can’t perform that action at this time.