Add the ipc shutdown event (#2652)
This event is triggered when the connection to the ipc is about to shutdown because of a user action such as with a `restart` or `exit` command. The `change` field indicates why the ipc is shutting down. It can be either "restart" or "exit". fixes #2318
This commit is contained in:
committed by
Michael Stapelberg
parent
564945bc14
commit
04dcf42397
@ -91,3 +91,6 @@ typedef struct i3_ipc_header {
|
||||
|
||||
/** The binding event will be triggered when bindings run */
|
||||
#define I3_IPC_EVENT_BINDING (I3_IPC_EVENT_MASK | 5)
|
||||
|
||||
/** The shutdown event will be triggered when the ipc shuts down */
|
||||
#define I3_IPC_EVENT_SHUTDOWN (I3_IPC_EVENT_MASK | 6)
|
||||
|
@ -77,11 +77,18 @@ int ipc_create_socket(const char *filename);
|
||||
void ipc_send_event(const char *event, uint32_t message_type, const char *payload);
|
||||
|
||||
/**
|
||||
* Calls shutdown() on each socket and closes it. This function to be called
|
||||
* when exiting or restarting only!
|
||||
* Calls to ipc_shutdown() should provide a reason for the shutdown.
|
||||
*/
|
||||
typedef enum {
|
||||
SHUTDOWN_REASON_RESTART,
|
||||
SHUTDOWN_REASON_EXIT
|
||||
} shutdown_reason_t;
|
||||
|
||||
/**
|
||||
* Calls shutdown() on each socket and closes it.
|
||||
*
|
||||
*/
|
||||
void ipc_shutdown(void);
|
||||
void ipc_shutdown(shutdown_reason_t reason);
|
||||
|
||||
void dump_node(yajl_gen gen, Con *con, bool inplace_restart);
|
||||
|
||||
|
Reference in New Issue
Block a user