return 0;
}
+/** del the output file descriptor event for listening */
+static void dtio_del_output_event(struct dt_io_thread* dtio)
+{
+ if(!dtio->event_added)
+ return;
+ ub_event_del(dtio->event);
+ dtio->event_added = 0;
+}
+
/** close and stop the output file descriptor event */
static void dtio_close_output(struct dt_io_thread* dtio)
{
log_err("dnstap io: failed writev: %s",
wsa_strerror(WSAGetLastError()));
#endif
- return -1;
+ /* close the channel */
+ dtio_del_output_event(dtio);
+ dtio_close_output(dtio);
+ return 0;
}
/* written r bytes */
dtio->cur_msg_len_done += r;
sizeof(sendlen)-dtio->cur_msg_len_done);
if(r == -1) {
/* close the channel */
+ dtio_del_output_event(dtio);
dtio_close_output(dtio);
return 0;
} else if(r == 0) {
dtio->cur_msg_len - dtio->cur_msg_done);
if(r == -1) {
/* close the channel */
+ dtio_del_output_event(dtio);
dtio_close_output(dtio);
return 0;
} else if(r == 0) {
}
}
-/** del the output file descriptor event for listening */
-static void dtio_del_output_event(struct dt_io_thread* dtio)
-{
- if(!dtio->event_added)
- return;
- ub_event_del(dtio->event);
- dtio->event_added = 0;
-}
-
/**
* structure to keep track of information during stop flush
*/