Browse Source

[Fix] Use non-blocking mode for systemd sockets

Issue: #430
Reported by: @Twilek-de
tags/1.3.0
Vsevolod Stakhov 7 years ago
parent
commit
91515f2995
2 changed files with 6 additions and 0 deletions
  1. 2
    0
      rspamd.service
  2. 4
    0
      src/rspamd.c

+ 2
- 0
rspamd.service View File

@@ -3,6 +3,8 @@ Description=rapid spam filtering system
After=nss-lookup.target

[Service]
Type=forking
NonBlocking=true
ExecStart=/usr/bin/rspamd -c /etc/rspamd/rspamd.conf -f
User=_rspamd
RuntimeDirectory=rspamd

+ 4
- 0
src/rspamd.c View File

@@ -405,9 +405,13 @@ systemd_get_socket (struct rspamd_main *rspamd_main, gint number)
return NULL;
}
flags = fcntl (sock, F_GETFD);

if (flags != -1) {
(void)fcntl (sock, F_SETFD, flags | FD_CLOEXEC);
}

rspamd_socket_nonblocking (sock);

result = g_list_prepend (result, GINT_TO_POINTER (sock));
}
else if (num_passed <= number) {

Loading…
Cancel
Save