Fixed bug which may happen if additional write buffers are empty but main write buffer not.

* may cause nDPIsrvd to hang indefinitly if no more data received from a collector

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
Toni Uhlig
2023-10-19 13:40:44 +02:00
parent 315dc32baf
commit 6ff8982ffb

View File

@@ -430,7 +430,13 @@ static int handle_outgoing_data(int epollfd, struct remote_desc * const remote)
}
if (utarray_len(additional_write_buffers) == 0)
{
return del_out_event(epollfd, remote);
struct nDPIsrvd_write_buffer * const write_buffer = get_write_buffer(remote);
if (write_buffer->buf.used == 0) {
return del_out_event(epollfd, remote);
} else {
return drain_main_buffer(remote);
}
}
return 0;