From de01c81a92dbff7c7ab7686cd6796bf808cf6df0 Mon Sep 17 00:00:00 2001 From: Davide Pesavento Date: Wed, 24 Jul 2019 23:46:09 -0400 Subject: [PATCH] poke: wait indefinitely if --timeout is not specified Change-Id: I0051e65d27780d8b58a0c0febf3572b0c6a23e8c --- tools/peek/ndnpoke/ndnpoke.cpp | 10 ++++++---- tools/peek/ndnpoke/ndnpoke.hpp | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) 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 @@ NdnPoke::start() 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 @@ struct PokeOptions // program behavior options bool wantForceData = false; - time::milliseconds timeout = 10_s; + optional timeout; }; class NdnPoke : boost::noncopyable