summaryrefslogtreecommitdiffstats
path: root/src/rspamd_proxy.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-08-07 08:26:32 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-08-07 08:26:32 +0100
commit8bcdcfc6c8e93dda7e5eeb2122bf2ed5772f00a3 (patch)
tree918a3479201b873eb8cfd5c8f9c8728cda8885ba /src/rspamd_proxy.c
parentbe8b130d14166145787f4e8e9b194b98c98c873d (diff)
downloadrspamd-8bcdcfc6c8e93dda7e5eeb2122bf2ed5772f00a3.tar.gz
rspamd-8bcdcfc6c8e93dda7e5eeb2122bf2ed5772f00a3.zip
[Feature] Set TCP_NODELAY for milter sockets
Issue: #1790
Diffstat (limited to 'src/rspamd_proxy.c')
-rw-r--r--src/rspamd_proxy.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/rspamd_proxy.c b/src/rspamd_proxy.c
index a2521fec1..be0980102 100644
--- a/src/rspamd_proxy.c
+++ b/src/rspamd_proxy.c
@@ -35,6 +35,10 @@
#include "libserver/milter.h"
#include "contrib/zstd/zstd.h"
+#ifdef HAVE_NETINET_TCP_H
+#include <netinet/tcp.h> /* for TCP_NODELAY */
+#endif
+
/* Rotate keys each minute by default */
#define DEFAULT_ROTATION_TIME 60.0
#define DEFAULT_RETRIES 5
@@ -2006,6 +2010,14 @@ proxy_accept_socket (gint fd, short what, void *arg)
rspamd_inet_address_to_string (addr),
rspamd_inet_address_get_port (addr));
+#ifdef TCP_NODELAY
+ gint sopt = 1;
+
+ if (setsockopt (nfd, SOL_TCP, TCP_NODELAY, &sopt, sizeof (sopt)) == -1) {
+ msg_warn_session ("cannot set TCP_NODELAY: %s", strerror (errno));
+ }
+#endif
+
rspamd_milter_handle_socket (nfd, NULL,
session->pool,
ctx->ev_base,