Make restart
IPC command send a reply once restart completed (!) (#3743)
This is achieved by retaining the IPC connection which is sending the restart command across the restart. This is the cleaner fix for https://github.com/i3/go-i3/issues/3 fixes #3565
This commit is contained in:
committed by
GitHub
parent
1eabe1b2b1
commit
e4ecc6e4a1
@ -22,6 +22,10 @@ struct CommandResultIR {
|
||||
/* The JSON generator to append a reply to (may be NULL). */
|
||||
yajl_gen json_gen;
|
||||
|
||||
/* The IPC client connection which sent this command (may be NULL, e.g. for
|
||||
key bindings). */
|
||||
ipc_client *client;
|
||||
|
||||
/* The next state to transition to. Passed to the function so that we can
|
||||
* determine the next state as a result of a function call, like
|
||||
* cfg_criteria_pop_state() does. */
|
||||
@ -61,7 +65,7 @@ char *parse_string(const char **walk, bool as_word);
|
||||
*
|
||||
* Free the returned CommandResult with command_result_free().
|
||||
*/
|
||||
CommandResult *parse_command(const char *input, yajl_gen gen);
|
||||
CommandResult *parse_command(const char *input, yajl_gen gen, ipc_client *client);
|
||||
|
||||
/**
|
||||
* Frees a CommandResult
|
||||
|
@ -72,6 +72,16 @@ typedef void (*handler_t)(ipc_client *, uint8_t *, int, uint32_t, uint32_t);
|
||||
*/
|
||||
void ipc_new_client(EV_P_ struct ev_io *w, int revents);
|
||||
|
||||
/**
|
||||
* ipc_new_client_on_fd() only sets up the event handler
|
||||
* for activity on the new connection and inserts the file descriptor into
|
||||
* the list of clients.
|
||||
*
|
||||
* This variant is useful for the inherited IPC connection when restarting.
|
||||
*
|
||||
*/
|
||||
ipc_client *ipc_new_client_on_fd(EV_P_ int fd);
|
||||
|
||||
/**
|
||||
* Creates the UNIX domain socket at the given path, sets it to non-blocking
|
||||
* mode, bind()s and listen()s on it.
|
||||
@ -95,10 +105,13 @@ typedef enum {
|
||||
} shutdown_reason_t;
|
||||
|
||||
/**
|
||||
* Calls shutdown() on each socket and closes it.
|
||||
* Calls shutdown() on each socket and closes it. This function is to be called
|
||||
* when exiting or restarting only!
|
||||
*
|
||||
* exempt_fd is never closed. Set to -1 to close all fds.
|
||||
*
|
||||
*/
|
||||
void ipc_shutdown(shutdown_reason_t reason);
|
||||
void ipc_shutdown(shutdown_reason_t reason, int exempt_fd);
|
||||
|
||||
void dump_node(yajl_gen gen, Con *con, bool inplace_restart);
|
||||
|
||||
@ -136,3 +149,8 @@ void ipc_send_binding_event(const char *event_type, Binding *bind);
|
||||
* socket.
|
||||
*/
|
||||
void ipc_set_kill_timeout(ev_tstamp new);
|
||||
|
||||
/**
|
||||
* Sends a restart reply to the IPC client on the specified fd.
|
||||
*/
|
||||
void ipc_confirm_restart(ipc_client *client);
|
||||
|
Reference in New Issue
Block a user