summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-01-20 00:18:53 +0100
committerMax Kellermann <max@musicpd.org>2018-01-20 00:22:30 +0100
commitdb89e5ec285ea8a30a5d72c8a1bd0d734e66a2db (patch)
treeb20634629da859924c09740af8ca32d90a5504d3 /src/client
parentd096f75fb84a2d8674d284691b75ee0e5ff19219 (diff)
client/Idle: move code to WriteIdleResponse()
Diffstat (limited to 'src/client')
-rw-r--r--src/client/ClientIdle.cxx22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/client/ClientIdle.cxx b/src/client/ClientIdle.cxx
index 4546af91f..11713346e 100644
--- a/src/client/ClientIdle.cxx
+++ b/src/client/ClientIdle.cxx
@@ -23,6 +23,19 @@
#include <assert.h>
+static void
+WriteIdleResponse(Client &client, unsigned flags) noexcept
+{
+ const char *const*idle_names = idle_get_names();
+ for (unsigned i = 0; idle_names[i]; ++i) {
+ if (flags & (1 << i))
+ client_printf(client, "changed: %s\n",
+ idle_names[i]);
+ }
+
+ client.Write("OK\n");
+}
+
void
Client::IdleNotify() noexcept
{
@@ -32,14 +45,7 @@ Client::IdleNotify() noexcept
unsigned flags = std::exchange(idle_flags, 0) & idle_subscriptions;
idle_waiting = false;
- const char *const*idle_names = idle_get_names();
- for (unsigned i = 0; idle_names[i]; ++i) {
- if (flags & (1 << i))
- client_printf(*this, "changed: %s\n",
- idle_names[i]);
- }
-
- Write("OK\n");
+ WriteIdleResponse(*this, flags);
timeout_event.Schedule(client_timeout);
}