ipc: correctly shutdown IPC sockets when exiting/restarting
This commit is contained in:
13
src/ipc.c
13
src/ipc.c
@ -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).
|
||||
|
Reference in New Issue
Block a user