Mercurial > dovecot > core-2.2
changeset 22993:962bbc45c99c
lib-master: ipc-client: Split code to ipc_client_abort_commands()
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Thu, 05 Jul 2018 14:35:51 +0300 |
parents | 9baff92c7a84 |
children | ed789b38da96 |
files | src/lib-master/ipc-client.c |
diffstat | 1 files changed, 11 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-master/ipc-client.c Thu Jul 05 14:25:46 2018 +0300 +++ b/src/lib-master/ipc-client.c Thu Jul 05 14:35:51 2018 +0300 @@ -101,21 +101,26 @@ return 0; } -static void ipc_client_disconnect(struct ipc_client *client) +static void ipc_client_abort_commands(struct ipc_client *client, + const char *reason) { struct ipc_client_cmd *cmd, *next; - if (client->fd == -1) - return; - cmd = client->cmds_head; client->cmds_head = client->cmds_tail = NULL; for (; cmd != NULL; cmd = next) { - cmd->callback(IPC_CLIENT_CMD_STATE_ERROR, - "Disconnected", cmd->context); + cmd->callback(IPC_CLIENT_CMD_STATE_ERROR, reason, cmd->context); next = cmd->next; i_free(cmd); } +} + +static void ipc_client_disconnect(struct ipc_client *client) +{ + if (client->fd == -1) + return; + + ipc_client_abort_commands(client, "Disconnected"); io_remove(&client->io); i_stream_destroy(&client->input);