mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-01-14 02:32:55 -05:00
output event del before free.
This commit is contained in:
parent
a21ac9838d
commit
814a886354
1 changed files with 15 additions and 10 deletions
|
|
@ -292,6 +292,15 @@ static int dtio_find_msg(struct dt_io_thread* dtio)
|
|||
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)
|
||||
{
|
||||
|
|
@ -366,7 +375,10 @@ static int dtio_write_with_writev(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;
|
||||
|
|
@ -401,6 +413,7 @@ static int dtio_write_more_of_len(struct dt_io_thread* dtio)
|
|||
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) {
|
||||
|
|
@ -426,6 +439,7 @@ static int dtio_write_more_of_data(struct dt_io_thread* dtio)
|
|||
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) {
|
||||
|
|
@ -543,15 +557,6 @@ static void dtio_setup_cmd(struct dt_io_thread* dtio)
|
|||
}
|
||||
}
|
||||
|
||||
/** 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
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue