From 1077f0935e3cabea5e47d1dec3b02cbe8b612a87 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Sun, 6 May 2018 11:15:01 -0400 Subject: [PATCH] freebsd support --- .../nntpchan-daemon/libnntpchan/kqueue.hpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/contrib/backends/nntpchan-daemon/libnntpchan/kqueue.hpp b/contrib/backends/nntpchan-daemon/libnntpchan/kqueue.hpp index 7edcb35..4a0f554 100644 --- a/contrib/backends/nntpchan-daemon/libnntpchan/kqueue.hpp +++ b/contrib/backends/nntpchan-daemon/libnntpchan/kqueue.hpp @@ -2,7 +2,7 @@ #include #include -#include +#include namespace nntpchan { @@ -130,7 +130,20 @@ namespace ev { int writespace = 1024; int written = handler->write(writespace); - std::cerr << "writen " << written << " of " << writespace << std::endl; + if(written == -1) + { + if (errno == EAGAIN || errno == EWOULDBLOCK) + { + // blocking + } + else + { + perror("write()"); + handler->close(); + delete handler; + continue; + } + } } if(!handler->keepalive()) {