From ac1b7070f8c818aad813f77f05cf649318a9b887 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Tue, 4 Dec 2018 00:31:37 +0100 Subject: [PATCH] api: process multiple pending actions at once --- lib/api.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/api.cpp b/lib/api.cpp index 288618bf2..42e33d00f 100644 --- a/lib/api.cpp +++ b/lib/api.cpp @@ -88,14 +88,16 @@ void Api::run() return; /* Process pending actions */ - Session *s = pending.pop(); - if (s) { - /* Check that the session is still alive */ - auto it = std::find(sessions.begin(), sessions.end(), s); - if (it == sessions.end()) - return; + while (!pending.empty()) { + Session *s = pending.pop(); + if (s) { + /* Check that the session is still alive */ + auto it = std::find(sessions.begin(), sessions.end(), s); + if (it == sessions.end()) + return; - s->runPendingActions(); + s->runPendingActions(); + } } }