diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-06-09 14:36:07 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-06-09 14:36:07 +0100 |
commit | 903111c6cc2cbc07de9f84a8ad1b9cddc5dfaaeb (patch) | |
tree | 354c8a0122232003e707ddfa4d32aec35d0afa99 /src/rspamd.c | |
parent | ae6f563623c765e574bd9a211be7524f7495ea28 (diff) | |
download | rspamd-903111c6cc2cbc07de9f84a8ad1b9cddc5dfaaeb.tar.gz rspamd-903111c6cc2cbc07de9f84a8ad1b9cddc5dfaaeb.zip |
[Project] Do not listen sockets in the main process
Diffstat (limited to 'src/rspamd.c')
-rw-r--r-- | src/rspamd.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/rspamd.c b/src/rspamd.c index 2f86739b6..7ea403258 100644 --- a/src/rspamd.c +++ b/src/rspamd.c @@ -402,6 +402,9 @@ create_listen_socket (GPtrArray *addrs, guint cnt, GList *result = NULL; gint fd; guint i; + static const int listen_opts = RSPAMD_INET_ADDRESS_LISTEN_ASYNC| + RSPAMD_INET_ADDRESS_LISTEN_REUSEPORT| + RSPAMD_INET_ADDRESS_LISTEN_NOLISTEN; struct rspamd_worker_listen_socket *ls; g_ptr_array_sort (addrs, rspamd_inet_address_compare_ptr); @@ -413,7 +416,7 @@ create_listen_socket (GPtrArray *addrs, guint cnt, if (listen_type & RSPAMD_WORKER_SOCKET_TCP) { fd = rspamd_inet_address_listen (g_ptr_array_index (addrs, i), SOCK_STREAM, - RSPAMD_INET_ADDRESS_LISTEN_ASYNC|RSPAMD_INET_ADDRESS_LISTEN_REUSEPORT, -1); + listen_opts, -1); if (fd != -1) { ls = g_malloc0 (sizeof (*ls)); ls->addr = rspamd_inet_address_copy (g_ptr_array_index (addrs, i)); @@ -425,7 +428,7 @@ create_listen_socket (GPtrArray *addrs, guint cnt, if (listen_type & RSPAMD_WORKER_SOCKET_UDP) { fd = rspamd_inet_address_listen (g_ptr_array_index (addrs, i), SOCK_DGRAM, - RSPAMD_INET_ADDRESS_LISTEN_ASYNC|RSPAMD_INET_ADDRESS_LISTEN_REUSEPORT, -1); + listen_opts, -1); if (fd != -1) { ls = g_malloc0 (sizeof (*ls)); ls->addr = rspamd_inet_address_copy (g_ptr_array_index (addrs, i)); |