aboutsummaryrefslogtreecommitdiff
path: root/nDPIsrvd.c
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2023-10-19 13:40:44 +0200
committerToni Uhlig <matzeton@googlemail.com>2023-10-19 13:40:44 +0200
commit6ff8982ffbab71ce74a9f84506109a87780a9bac (patch)
tree22d60332ef01da02b56b1647045e5c52ba7a41b1 /nDPIsrvd.c
parent315dc32baf722c6063c18b5a27d02037dc49ece8 (diff)
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>
Diffstat (limited to 'nDPIsrvd.c')
-rw-r--r--nDPIsrvd.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/nDPIsrvd.c b/nDPIsrvd.c
index efaf27cf2..28a989fc0 100644
--- a/nDPIsrvd.c
+++ b/nDPIsrvd.c
@@ -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;