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.
This commit is contained in:
Max Kellermann
2008-10-14 22:38:14 +02:00
parent 30c86d8ae6
commit a3e3d2c950
14 changed files with 305 additions and 3 deletions

View File

@@ -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();