static void log_writer_io_check_eof(gpointer s) { LogWriter *self = (LogWriter *) s; msg_error("EOF occurred while idle", evt_tag_int("fd", log_proto_client_get_fd(self->proto))); log_writer_broken(self, NC_CLOSE); }
static void log_writer_error_suspend_elapsed(gpointer s) { LogWriter *self = (LogWriter *) s; self->suspended = FALSE; msg_notice("Error suspend timeout has elapsed, attempting to write again", evt_tag_int("fd", log_proto_client_get_fd(self->proto))); log_writer_start_watches(self); }
static void log_writer_work_finished(gpointer s) { LogWriter *self = (LogWriter *) s; main_loop_assert_main_thread(); self->flush_waiting_for_timeout = FALSE; if (self->pending_proto_present) { /* pending proto is only set in the main thread, so no need to * lock it before coming here. After we're syncing with the * log_writer_reopen() call, quite possibly coming from a * non-main thread. */ g_static_mutex_lock(&self->pending_proto_lock); if (self->proto) log_proto_client_free(self->proto); self->proto = self->pending_proto; self->pending_proto = NULL; self->pending_proto_present = FALSE; g_cond_signal(self->pending_proto_cond); g_static_mutex_unlock(&self->pending_proto_lock); } if (!self->work_result) { log_writer_broken(self, NC_WRITE_ERROR); if (self->proto) { log_writer_suspend(self); msg_notice("Suspending write operation because of an I/O error", evt_tag_int("fd", log_proto_client_get_fd(self->proto)), evt_tag_int("time_reopen", self->options->time_reopen), NULL); } goto exit; } if ((self->super.flags & PIF_INITIALIZED) && self->proto) { /* reenable polling the source, but only if we're still initialized */ log_writer_start_watches(self); } exit: log_pipe_unref(&self->super); }
static void log_writer_io_error(gpointer s) { LogWriter *self = (LogWriter *) s; if (self->fd_watch.handler_out == NULL && self->fd_watch.handler_in == NULL) { msg_debug("POLLERR occurred while idle", evt_tag_int("fd", log_proto_client_get_fd(self->proto))); log_writer_broken(self, NC_WRITE_ERROR); return; } else { /* in case we have an error state but we also asked for read/write * polling, the error should be handled by the I/O callback. But we * need not call that explicitly as ivykis does that for us. */ } log_writer_update_watches(self); }