fix the remnant 'waiting' on the channel after error

This commit is contained in:
Michael van der Werve 2020-10-15 10:07:24 +02:00
parent ed62771667
commit ad428fa629
1 changed files with 9 additions and 2 deletions

View File

@ -98,8 +98,15 @@ bool Throttle::send(uint64_t id, const Frame &frame)
*/ */
void Throttle::reportError(const char *message) void Throttle::reportError(const char *message)
{ {
// assign empty queue // pop all elements from the queue (older compilers dont support reassign)
_queue = {}; 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 a callback is set, call the handler with the message
if (_errorCallback) _errorCallback(message); if (_errorCallback) _errorCallback(message);