InfoHash: use bool operator where relevent

This commit is contained in:
Adrien Beraud committed 2017-11-01 16:28:17 -04:00
1 parent dc99919338
commit 834d62e6e9
4 files changed
+10 -16

No files matched your search

+6 -8
View File
@@ -116,20 +116,18 @@ void cmd_loop(std::shared_ptr<DhtRunner>& dht, dht_params& params)
} else if (op == "ld") {
iss >> idstr;
InfoHash filter(idstr);
if (filter == InfoHash{})
std::cout << dht->getStorageLog() << std::endl;
else
if (filter)
std::cout << dht->getStorageLog(filter) << std::endl;
else
std::cout << dht->getStorageLog() << std::endl;
continue;
} else if (op == "ls") {
iss >> idstr;
InfoHash filter(idstr);
if (filter == InfoHash{}) {
std::cout << "Searches:" << std::endl;
std::cout << dht->getSearchesLog() << std::endl;
} else {
if (filter)
std::cout << dht->getSearchLog(filter) << std::endl;
}
else
std::cout << dht->getSearchesLog() << std::endl;
continue;
} else if (op == "la") {
std::cout << "Reported public addresses:" << std::endl;