From ad428fa6292e15a80a3fa592f8520a1a886f6b5a Mon Sep 17 00:00:00 2001 From: Michael van der Werve Date: Thu, 15 Oct 2020 10:07:24 +0200 Subject: [PATCH] fix the remnant 'waiting' on the channel after error --- src/throttle.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/throttle.cpp b/src/throttle.cpp index 419e161..a0f2599 100644 --- a/src/throttle.cpp +++ b/src/throttle.cpp @@ -98,8 +98,15 @@ bool Throttle::send(uint64_t id, const Frame &frame) */ void Throttle::reportError(const char *message) { - // assign empty queue - _queue = {}; + // pop all elements from the queue (older compilers dont support reassign) + while (_queue.size()) _queue.pop(); + + // we can also forget all open messages, won't hear from them any more + _open.clear(); + + // reset tracking, since channel is fully broken + _last = 0; + _current = 1; // if a callback is set, call the handler with the message if (_errorCallback) _errorCallback(message);