From: Egor Date: Wed, 27 Sep 2023 23:04:46 +0000 (+0300) Subject: net: add proper blocking for non-tls X-Git-Url: https://git.patchysicp.xyz/?a=commitdiff_plain;h=81641271dd80c556b66a6a607e26a29c7814eab5;p=patchyircd.git net: add proper blocking for non-tls --- diff --git a/net.c b/net.c index a6601cb..e333c89 100644 --- a/net.c +++ b/net.c @@ -78,7 +78,6 @@ void killConnection(struct client_data *cl, bool byChoice) { free(cl); } -#if HAS_TLS static void block(struct client_data *cl, int out) { #ifdef _WIN32 @@ -96,7 +95,6 @@ static void block(struct client_data *cl, int out) poll(&pfd, 1, 0); #endif } -#endif void recvProc(struct client_data *cl) { ssize_t bytesRead; @@ -188,10 +186,12 @@ void sendClient(struct client_data *cl, const char *buf, size_t len) if (!rv) break; if (rv == -1) { - if (net_wouldblock()) + if (net_wouldblock()) { + block(cl, 1); continue; - else + } else { break; + } } buf += rv; len -= rv;