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

dhtnode: add command b to ping a node

parent 4caa8ce1
Branches
Tags
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment