Skip to content

Commit 0d272df

Browse files
committed
dhtnode: allow to trigger connectivity change
1 parent 4dceb1f commit 0d272df

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tools/dhtnode.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ void print_help() {
8989
<< " pp <key> <str> Put string value at <key> (persistent version)." << std::endl
9090
<< " cpp <key> <id> Cancel persistent put operation for <key> and value <id>." << std::endl
9191
<< " s <key> <str> Put string value at <key>, signed with our generated private key." << std::endl
92-
<< " e <key> <dest> <str> Put string value at <key>, encrypted for <dest> with its public key (if found)." << std::endl;
92+
<< " e <key> <dest> <str> Put string value at <key>, encrypted for <dest> with its public key (if found)." << std::endl
93+
<< " cc Trigger connectivity changed signal." << std::endl;
9394

9495
#ifdef OPENDHT_INDEXATION
9596
std::cout << std::endl << "Indexation operations on the DHT:" << std::endl
@@ -179,11 +180,8 @@ void cmd_loop(std::shared_ptr<DhtRunner>& dht, dht_params& params
179180
iss >> idstr;
180181
try {
181182
auto addr = splitPort(idstr);
182-
if (not addr.first.empty() and addr.second.empty()){
183-
std::stringstream ss;
184-
ss << DHT_DEFAULT_PORT;
185-
addr.second = ss.str();
186-
}
183+
if (not addr.first.empty() and addr.second.empty())
184+
addr.second = std::to_string(DHT_DEFAULT_PORT);
187185
dht->bootstrap(addr.first.c_str(), addr.second.c_str());
188186
} catch (const std::exception& e) {
189187
std::cerr << e.what() << std::endl;
@@ -199,6 +197,8 @@ void cmd_loop(std::shared_ptr<DhtRunner>& dht, dht_params& params
199197
log::disableLogging(*dht);
200198
dht->setLogFilter(filter);
201199
continue;
200+
} else if (op == "cc") {
201+
dht->connectivityChanged();
202202
}
203203
#if OPENDHT_PROXY_SERVER
204204
else if (op == "pst") {

0 commit comments

Comments
 (0)