From e695ead581ef5f06f1abc9cb8ea976a9589f278e Mon Sep 17 00:00:00 2001 From: Kevin Baron Date: Fri, 6 Nov 2015 13:07:41 +0100 Subject: [PATCH 3/3] Patch: dtnping. Enabled the option to interrupt dtnping in case it was called with the argument --no-wait. --- ibrdtn/tools/src/dtnping.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ibrdtn/tools/src/dtnping.cpp b/ibrdtn/tools/src/dtnping.cpp index 1746213..bb7e49a 100644 --- a/ibrdtn/tools/src/dtnping.cpp +++ b/ibrdtn/tools/src/dtnping.cpp @@ -430,6 +430,25 @@ int main(int argc, char *argv[]) } } } + else{ + try{ + // Added this from the (wait_for_reply) part, because you weren't + // able to stop the dtnping while using --nowait without + // this. + if (interval_pause > 0) + { + ibrcommon::MutexLock l(__pause); + __pause.wait(interval_pause); + } + } catch (const ibrcommon::Conditional::ConditionalAbortException &e) { + if (e.reason == ibrcommon::Conditional::ConditionalAbortException::COND_TIMEOUT) + { + continue; + } + // aborted + break; + } + } } } catch (const dtn::api::ConnectionException&) { std::cerr << "Disconnected." << std::endl; -- 2.1.4