diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2020-08-09 23:07:06 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2020-08-09 23:07:06 +0200 |
commit | 8ccdadd3c7e269427ba6fce91d413eeeab67544a (patch) | |
tree | e3755a1b09e54916c9661b1c64597408e2cb87c2 /nDPIsrvd.c | |
parent | dc61464135bbdaed79c8ea7076f070320430bc45 (diff) |
do not disconnect a distributor client if write returned EAGAIN (still not perfect)
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'nDPIsrvd.c')
-rw-r--r-- | nDPIsrvd.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/nDPIsrvd.c b/nDPIsrvd.c index f01db62af..d9ba73c23 100644 --- a/nDPIsrvd.c +++ b/nDPIsrvd.c @@ -491,10 +491,15 @@ int main(int argc, char ** argv) if (remotes.desc[i].type == SERV_SOCK) { ssize_t bytes_written = write(remotes.desc[i].fd, current->buf, current->buf_wanted); + if (errno == EAGAIN) { + /* TODO: Prevent data loss */ + syslog(LOG_DAEMON | LOG_ERR, "Distributor write buffer bloat; Data loss!"); + continue; + } if (bytes_written < 0 || errno != 0) { syslog(LOG_DAEMON | LOG_ERR, - "Collector connection closed, send failed: %s", + "Distributor connection closed, send failed: %s", strerror(errno)); disconnect_client(epollfd, &remotes.desc[i]); continue; @@ -502,7 +507,7 @@ int main(int argc, char ** argv) if (bytes_written == 0) { syslog(LOG_DAEMON, - "Collector connection closed during write"); + "Distributor connection closed during write"); disconnect_client(epollfd, &remotes.desc[i]); continue; } |