From cf5aa85f2932d2a4c6a197fa564b32fb1f079bbb Mon Sep 17 00:00:00 2001 From: "W.C.A. Wijngaards" Date: Thu, 23 Jan 2020 16:51:57 +0100 Subject: [PATCH] dnstap io, nicer layout for wouldblock calls. --- dnstap/dtstream.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/dnstap/dtstream.c b/dnstap/dtstream.c index 8a4eefbf2..a62de0a63 100644 --- a/dnstap/dtstream.c +++ b/dnstap/dtstream.c @@ -506,7 +506,8 @@ static int dtio_check_nb_connect(struct dt_io_thread* dtio) if(error == WSAEINPROGRESS) { return 0; /* try again later */ } else if(error == WSAEWOULDBLOCK) { - ub_winsock_tcp_wouldblock((dtio->stop_flush_event?dtio->stop_flush_event:dtio->event), UB_EV_WRITE); + ub_winsock_tcp_wouldblock((dtio->stop_flush_event? + dtio->stop_flush_event:dtio->event), UB_EV_WRITE); return 0; /* try again later */ } #endif @@ -555,7 +556,9 @@ static int dtio_write_buf(struct dt_io_thread* dtio, uint8_t* buf, if(WSAGetLastError() == WSAEINPROGRESS) return 0; if(WSAGetLastError() == WSAEWOULDBLOCK) { - ub_winsock_tcp_wouldblock((dtio->stop_flush_event?dtio->stop_flush_event:dtio->event), UB_EV_WRITE); + ub_winsock_tcp_wouldblock((dtio->stop_flush_event? + dtio->stop_flush_event:dtio->event), + UB_EV_WRITE); return 0; } log_err("dnstap io: failed send: %s", @@ -600,7 +603,9 @@ static int dtio_write_with_writev(struct dt_io_thread* dtio) if(WSAGetLastError() == WSAEINPROGRESS) return 0; if(WSAGetLastError() == WSAEWOULDBLOCK) { - ub_winsock_tcp_wouldblock((dtio->stop_flush_event?dtio->stop_flush_event:dtio->event), UB_EV_WRITE); + ub_winsock_tcp_wouldblock((dtio->stop_flush_event? + dtio->stop_flush_event:dtio->event), + UB_EV_WRITE); return 0; } log_err("dnstap io: failed writev: %s", @@ -720,7 +725,10 @@ static int dtio_check_close(struct dt_io_thread* dtio) if(WSAGetLastError() == WSAEINPROGRESS) { return 1; /* try later */ } else if(WSAGetLastError() == WSAEWOULDBLOCK) { - ub_winsock_tcp_wouldblock((dtio->stop_flush_event?dtio->stop_flush_event:dtio->event), UB_EV_READ); + ub_winsock_tcp_wouldblock( + (dtio->stop_flush_event? + dtio->stop_flush_event:dtio->event), + UB_EV_READ); return 1; /* try later */ } #endif