From 450390a068caae553e4366c76a424604355698d4 Mon Sep 17 00:00:00 2001 From: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com> Date: Tue, 16 Feb 2016 19:03:14 -0500 Subject: [PATCH] ringaccount: fix non-handled exception RingAccount::handlePendingCall may throw exception and was not catched by the handlePendingCallList loop. This leds to non-handled pending calls (all after the failing one). This patch fixes that by catch all exception and drop bad guys. Change-Id: Ic62e115bf32b467e04a19f2ae077d8256a69d90e Tuleap: #106 --- src/ringdht/ringaccount.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ringdht/ringaccount.cpp b/src/ringdht/ringaccount.cpp index 86a9d7d9b1..5bbf7a2c07 100644 --- a/src/ringdht/ringaccount.cpp +++ b/src/ringdht/ringaccount.cpp @@ -584,8 +584,16 @@ RingAccount::handlePendingCallList() auto pc_iter = std::begin(pending_calls); while (pc_iter != std::end(pending_calls)) { bool incoming = pc_iter->call_key == invalid_hash; // do it now, handlePendingCall may invalidate pc data + bool handled; - if (handlePendingCall(*pc_iter, incoming)) { + try { + handled = handlePendingCall(*pc_iter, incoming); + } catch (const std::exception& e) { + RING_ERR("[DHT] exception during pending call handling: %s", e.what()); + handled = true; // drop from pending list + } + + if (handled) { // Cancel pending listen (outgoing call) if (not incoming) dht_.cancelListen(pc_iter->call_key, pc_iter->listen_key.get()); -- GitLab