From a298c2065c49c5cd1a22795c72946a00af5d1c41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com> Date: Sun, 18 Oct 2015 00:47:55 -0400 Subject: [PATCH] dhtnode: add command b to ping a node --- tools/dhtnode.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/dhtnode.cpp b/tools/dhtnode.cpp index 440db3bf..f9fc37ee 100644 --- a/tools/dhtnode.cpp +++ b/tools/dhtnode.cpp @@ -70,6 +70,7 @@ void print_help() { << " lr Print the full current routing table of this node" << std::endl; std::cout << std::endl << "Operations on the DHT:" << std::endl + << " b ip:port Ping potential node at given IP address/port." << std::endl << " g [key] Get values at [key]." << std::endl << " l [key] Listen for value changes at [key]." << std::endl << " p [key] [str] Put string value at [key]." << std::endl @@ -155,6 +156,16 @@ main(int argc, char **argv) for (const auto& addr : addrs) std::cout << addr << std::endl; continue; + } else if (op == "b") { + try { + auto addr = splitPort(idstr); + if (not addr.first.empty() and addr.second.empty()) + addr.second = std::to_string(DHT_DEFAULT_PORT); + dht.bootstrap(addr.first.c_str(), addr.second.c_str()); + } catch (const std::exception& e) { + std::cout << e.what() << std::endl; + } + continue; } else if (op == "log") { params.log = !params.log; if (params.log) -- GitLab