ipc: correctly shutdown IPC sockets when exiting/restarting

This commit is contained in:
Michael Stapelberg
2010-03-16 02:44:47 +01:00
parent fca826a6f9
commit f7a1a9fb20
5 changed files with 26 additions and 0 deletions

View File

@ -105,6 +105,19 @@ void ipc_send_event(const char *event, uint32_t message_type, const char *payloa
}
}
/*
* Calls shutdown() on each socket and closes it. This function to be called
* when exiting or restarting only!
*
*/
void ipc_shutdown() {
ipc_client *current;
TAILQ_FOREACH(current, &all_clients, clients) {
shutdown(current->fd, SHUT_RDWR);
close(current->fd);
}
}
/*
* Executes the command and returns whether it could be successfully parsed
* or not (at the moment, always returns true).