poke: wait indefinitely if --timeout is not specified
Change-Id: I0051e65d27780d8b58a0c0febf3572b0c6a23e8c
diff --git a/tools/peek/ndnpoke/ndnpoke.cpp b/tools/peek/ndnpoke/ndnpoke.cpp
index 0d04efa..43acfb6 100644
--- a/tools/peek/ndnpoke/ndnpoke.cpp
+++ b/tools/peek/ndnpoke/ndnpoke.cpp
@@ -60,10 +60,12 @@
m_registeredPrefix.cancel();
},
[this] (auto&&) {
- m_timeoutEvent = m_scheduler.schedule(m_options.timeout, [this] {
- m_result = Result::TIMEOUT;
- m_registeredPrefix.cancel();
- });
+ if (m_options.timeout) {
+ m_timeoutEvent = m_scheduler.schedule(*m_options.timeout, [this] {
+ m_result = Result::TIMEOUT;
+ m_registeredPrefix.cancel();
+ });
+ }
},
[this] (auto&&, const auto& reason) {
m_result = Result::PREFIX_REG_FAIL;
diff --git a/tools/peek/ndnpoke/ndnpoke.hpp b/tools/peek/ndnpoke/ndnpoke.hpp
index e47da81..6375512 100644
--- a/tools/peek/ndnpoke/ndnpoke.hpp
+++ b/tools/peek/ndnpoke/ndnpoke.hpp
@@ -48,7 +48,7 @@
// program behavior options
bool wantForceData = false;
- time::milliseconds timeout = 10_s;
+ optional<time::milliseconds> timeout;
};
class NdnPoke : boost::noncopyable