bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2013-2018 Dovecot authors, see the included COPYING file */
6a3c23e577be41f7521995c5dae19abb2fb4ffb6Timo Sirainenstatic void doveadm_connection_destroy(struct doveadm_connection **_conn);
6a3c23e577be41f7521995c5dae19abb2fb4ffb6Timo Sirainenstatic int doveadm_connection_send_errors(struct doveadm_connection *conn)
6a3c23e577be41f7521995c5dae19abb2fb4ffb6Timo Sirainen iter = log_error_buffer_iter_init(conn->errorbuf);
6a3c23e577be41f7521995c5dae19abb2fb4ffb6Timo Sirainen while ((error = log_error_buffer_iter_next(iter)) != NULL) {
6a3c23e577be41f7521995c5dae19abb2fb4ffb6Timo Sirainenstatic int doveadm_output(struct doveadm_connection *conn)
6a3c23e577be41f7521995c5dae19abb2fb4ffb6Timo Sirainen if ((ret = o_stream_flush(conn->output)) != 0) {
6a3c23e577be41f7521995c5dae19abb2fb4ffb6Timo Sirainen /* error / finished */
6a3c23e577be41f7521995c5dae19abb2fb4ffb6Timo Sirainenvoid doveadm_connection_create(struct log_error_buffer *errorbuf, int fd)
e93184a9055c2530366dfe617e07199603c399ddMartti Rannanjärvi conn->output = o_stream_create_fd(conn->fd, (size_t)-1);
6a3c23e577be41f7521995c5dae19abb2fb4ffb6Timo Sirainen o_stream_set_flush_callback(conn->output, doveadm_output, conn);
6a3c23e577be41f7521995c5dae19abb2fb4ffb6Timo Sirainen o_stream_set_flush_pending(conn->output, TRUE);
6a3c23e577be41f7521995c5dae19abb2fb4ffb6Timo Sirainenstatic void doveadm_connection_destroy(struct doveadm_connection **_conn)
6a3c23e577be41f7521995c5dae19abb2fb4ffb6Timo Sirainen i_error("close(doveadm connection) failed: %m");