Skip to content

Commit

Permalink
doveadm: Simplify destroying ioloop using o_stream_switch_ioloop_to()
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen committed Jun 5, 2018
1 parent a952e17 commit 2a3b708
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 1 addition & 3 deletions src/doveadm/client-connection-http.c
Expand Up @@ -226,9 +226,7 @@ doveadm_http_server_command_execute(struct client_request_http *req)
cctx.cmd->cmd(&cctx);
client_connection_set_proctitle(&conn->conn, "");

io_loop_set_current(prev_ioloop);
o_stream_switch_ioloop(req->output);
io_loop_set_current(ioloop);
o_stream_switch_ioloop_to(req->output, prev_ioloop);
io_loop_destroy(&ioloop);

if ((cctx.cmd->flags & CMD_FLAG_NO_PRINT) == 0)
Expand Down
6 changes: 2 additions & 4 deletions src/doveadm/client-connection-tcp.c
Expand Up @@ -347,11 +347,9 @@ static int doveadm_cmd_handle(struct client_connection_tcp *conn,
else
doveadm_mail_cmd_server_run(conn, mctx);

io_loop_set_current(prev_ioloop);
o_stream_switch_ioloop(conn->output);
o_stream_switch_ioloop_to(conn->output, prev_ioloop);
if (conn->log_out != NULL)
o_stream_switch_ioloop(conn->log_out);
io_loop_set_current(conn->ioloop);
o_stream_switch_ioloop_to(conn->log_out, prev_ioloop);
io_loop_destroy(&conn->ioloop);

/* clear all headers */
Expand Down

0 comments on commit 2a3b708

Please sign in to comment.