aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-14 22:38:14 +0200
committerMax Kellermann <max@duempel.org>2008-10-14 22:38:14 +0200
commita3e3d2c9506d17b3e19e205535ec263ee75178c9 (patch)
tree3e93ea6ae33dba8a8f5e12e34629366dcdd7fdb7 /src/main.c
parent30c86d8ae64ae46ba3bcb1c63e867789feab6dc4 (diff)
downloadmpd-a3e3d2c9506d17b3e19e205535ec263ee75178c9.tar.gz
mpd-a3e3d2c9506d17b3e19e205535ec263ee75178c9.tar.xz
mpd-a3e3d2c9506d17b3e19e205535ec263ee75178c9.zip
command: added command "idle"
"idle" waits until something noteworthy happens on the server, e.g. song change, playlist modified, database updated. This allows clients to keep up to date without polling.
Diffstat (limited to '')
-rw-r--r--src/main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index b4f821008..1a7e73254 100644
--- a/src/main.c
+++ b/src/main.c
@@ -17,6 +17,7 @@
*/
#include "client.h"
+#include "idle.h"
#include "command.h"
#include "playlist.h"
#include "database.h"
@@ -445,9 +446,17 @@ int main(int argc, char *argv[])
while (COMMAND_RETURN_KILL != client_manager_io() &&
COMMAND_RETURN_KILL != handlePendingSignals()) {
+ unsigned flags;
+
syncPlayerAndPlaylist();
client_manager_expire();
reap_update_task();
+
+ /* send "idle" notificaions to all subscribed
+ clients */
+ flags = idle_get();
+ if (flags != 0)
+ client_manager_idle_add(flags);
}
write_state_file();