From 132fe6669975208bfdc2cfb148119cb789173cf6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com>
Date: Fri, 29 Jul 2016 15:49:43 -0400
Subject: [PATCH] dhtnode: cleanup

---
 doc/dhtnode.1     | 14 ++++++++------
 tools/dhtnode.cpp | 14 +++-----------
 2 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/doc/dhtnode.1 b/doc/dhtnode.1
index 2aca2c67..a1b02638 100644
--- a/doc/dhtnode.1
+++ b/doc/dhtnode.1
@@ -45,8 +45,12 @@ interactive shell:
 Prints some help.
 
 .TP
-\fB-v\fP[\fIlogfile\fP]
-Enable the verbose mode. Optionally provide a log file.
+\fB-v\fP
+Enable the verbose mode (log to stdout by default)
+
+.TP
+\fB-l\fP \fIlog_file\fP
+Write log to file instead of stdout
 
 .TP
 \fB-i\fP
@@ -66,11 +70,9 @@ the merge of two different networks (available since OpenDHT v0.6.1).
 Use port \fIlocal_port\fP for the program to bind to.
 
 .TP
-\fB-b\fP[\fIbootstrap_host\fP[:\fIport\fP]]
+\fB-b\fP \fIbootstrap_host\fP[:\fIport\fP]
 The program needs to be given a node to connect to the network. You use this
-option to provide the ip address of that node. If no argument is provided, the
-node runs in \fBbootstrap mode\fP, i.e. it will especially serve as entry point
-in the network.
+option to provide the ip address of that node.
 
 .SH AUTHORS
 .TP
diff --git a/tools/dhtnode.cpp b/tools/dhtnode.cpp
index 656ed305..0a66f681 100644
--- a/tools/dhtnode.cpp
+++ b/tools/dhtnode.cpp
@@ -162,9 +162,6 @@ void cmd_loop(DhtRunner& dht, dht_params& params)
         if (op == "g") {
             std::string rem;
             std::getline(iss, rem);
-            dht::Where w {std::move(rem)};
-            dht::Query q {{}, w};
-            std::cout << q << std::endl;
             dht.get(id, [start](std::shared_ptr<Value> value) {
                 auto now = std::chrono::high_resolution_clock::now();
                 std::cout << "Get: found value (after " << print_dt(now-start) << "s)" << std::endl;
@@ -173,13 +170,11 @@ void cmd_loop(DhtRunner& dht, dht_params& params)
             }, [start](bool ok) {
                 auto end = std::chrono::high_resolution_clock::now();
                 std::cout << "Get: " << (ok ? "completed" : "failure") << " (took " << print_dt(end-start) << "s)" << std::endl;
-            }, {}, std::move(w));
+            }, {}, dht::Where {std::move(rem)});
         }
         else if (op == "q") {
             std::string rem;
             std::getline(iss, rem);
-            dht::Query q {std::move(rem)};
-            std::cout << q << std::endl;
             dht.query(id, [start](const std::vector<std::shared_ptr<FieldValueIndex>>& field_value_indexes) {
                 auto now = std::chrono::high_resolution_clock::now();
                 for (auto& index : field_value_indexes) {
@@ -190,19 +185,16 @@ void cmd_loop(DhtRunner& dht, dht_params& params)
             }, [start](bool ok) {
                 auto end = std::chrono::high_resolution_clock::now();
                 std::cout << "Query: " << (ok ? "completed" : "failure") << " (took " << print_dt(end-start) << "s)" << std::endl;
-            }, std::move(q));
+            }, dht::Query {std::move(rem)});
         }
         else if (op == "l") {
             std::string rem;
             std::getline(iss, rem);
-            dht::Where w {std::move(rem)};
-            dht::Query q {{}, w};
-            std::cout << q << std::endl;
             dht.listen(id, [](std::shared_ptr<Value> value) {
                 std::cout << "Listen: found value:" << std::endl;
                 std::cout << "\t" << *value << std::endl;
                 return true;
-            }, {}, std::move(w));
+            }, {}, dht::Where {std::move(rem)});
         }
         else if (op == "p") {
             std::string v;
-- 
GitLab