From 22baa341f71ad1c5007eba2d05877849b49f7b0f Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Tue, 15 May 2018 18:51:50 +1000 Subject: [PATCH] Avoid blocking setting ret to -1. --- src/generator.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/generator.c b/src/generator.c index 7df505b4..8016b437 100644 --- a/src/generator.c +++ b/src/generator.c @@ -1848,9 +1848,12 @@ static void send_json_msgq(cs_msg_t **csmsgq) fd = proxy->cs.fd; ret = send(fd, csmsg->buf + csmsg->ofs, csmsg->len, MSG_DONTWAIT); if (ret < 1) { - if (!ret || errno == EAGAIN || errno == EWOULDBLOCK) + if (!ret) break; - csmsg->len = ret = 0; + ret = 0; + if (errno == EAGAIN || errno == EWOULDBLOCK) + break; + csmsg->len = 0; LOGNOTICE("Proxy %d:%d %s failed to send msg in send_json_msgq, dropping", proxy->id, proxy->subid, proxy->url); set_proxy_disabled(proxy);