From c6c5cb93ce6fdf8989fcc7b8e12e817fb46aea08 Mon Sep 17 00:00:00 2001 From: Leonid Evdokimov Date: Sun, 3 Apr 2016 18:06:16 +0300 Subject: [PATCH] Mark client socket non-blocking Avoiding to do so caused splice() to block during write. AFAIK, it does not affect bufferevent pump, but I may be wrong. --- redsocks.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/redsocks.c b/redsocks.c index 0c038eca..3a869dff 100644 --- a/redsocks.c +++ b/redsocks.c @@ -1106,6 +1106,12 @@ static void redsocks_accept_client(int fd, short what, void *_arg) goto fail; } + error = fcntl_nonblock(client_fd); + if (error) { + log_errno(LOG_ERR, "fcntl"); + goto fail; + } + if (apply_tcp_keepalive(client_fd)) goto fail;