aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2022-10-23 17:57:44 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2022-10-23 17:57:44 +0100
commit0eabbc4492945ddd0a4550fd6aa6a0db7eeae785 (patch)
treef95e2a112d371eacf5ff0fa6e1031a4da85b58da /src
parente28a3436d668c1f7d9f75b28741cc4db9651c497 (diff)
downloadrspamd-0eabbc4492945ddd0a4550fd6aa6a0db7eeae785.tar.gz
rspamd-0eabbc4492945ddd0a4550fd6aa6a0db7eeae785.zip
[Minor] Use seqpacket for control pipes
Diffstat (limited to 'src')
-rw-r--r--src/libserver/rspamd_control.c9
-rw-r--r--src/libserver/rspamd_control.h8
-rw-r--r--src/libserver/worker_util.c7
3 files changed, 14 insertions, 10 deletions
diff --git a/src/libserver/rspamd_control.c b/src/libserver/rspamd_control.c
index ef17ac24f..199efa948 100644
--- a/src/libserver/rspamd_control.c
+++ b/src/libserver/rspamd_control.c
@@ -908,8 +908,13 @@ rspamd_srv_handler (EV_P_ ev_io *w, int revents)
r = recvmsg (w->fd, &msg, 0);
if (r == -1) {
- msg_err ("cannot read from worker's srv pipe: %s",
- strerror (errno));
+ if (errno != EAGAIN) {
+ msg_err ("cannot read from worker's srv pipe: %s",
+ strerror(errno));
+ }
+ else {
+ return;
+ }
}
else if (r == 0) {
/*
diff --git a/src/libserver/rspamd_control.h b/src/libserver/rspamd_control.h
index 1b5756022..f6336854c 100644
--- a/src/libserver/rspamd_control.h
+++ b/src/libserver/rspamd_control.h
@@ -20,9 +20,7 @@
#include "mem_pool.h"
#include "contrib/libev/ev.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
+G_BEGIN_DECLS
struct rspamd_main;
struct rspamd_worker;
@@ -290,8 +288,6 @@ const gchar *rspamd_control_command_to_string (enum rspamd_control_type cmd);
*/
void rspamd_pending_control_free (gpointer p);
-#ifdef __cplusplus
-}
-#endif
+G_END_DECLS
#endif
diff --git a/src/libserver/worker_util.c b/src/libserver/worker_util.c
index 6fd2e6164..d8c62d210 100644
--- a/src/libserver/worker_util.c
+++ b/src/libserver/worker_util.c
@@ -1228,6 +1228,9 @@ rspamd_handle_main_fork (struct rspamd_worker *wrk,
#endif
}
+#ifndef SOCK_SEQPACKET
+#define SOCK_SEQPACKET SOCK_DGRAM
+#endif
struct rspamd_worker *
rspamd_fork_worker (struct rspamd_main *rspamd_main,
struct rspamd_worker_conf *cf,
@@ -1241,12 +1244,12 @@ rspamd_fork_worker (struct rspamd_main *rspamd_main,
/* Starting worker process */
wrk = (struct rspamd_worker *) g_malloc0 (sizeof (struct rspamd_worker));
- if (!rspamd_socketpair (wrk->control_pipe, SOCK_DGRAM)) {
+ if (!rspamd_socketpair (wrk->control_pipe, SOCK_SEQPACKET)) {
msg_err ("socketpair failure: %s", strerror (errno));
rspamd_hard_terminate (rspamd_main);
}
- if (!rspamd_socketpair (wrk->srv_pipe, SOCK_DGRAM)) {
+ if (!rspamd_socketpair (wrk->srv_pipe, SOCK_SEQPACKET)) {
msg_err ("socketpair failure: %s", strerror (errno));
rspamd_hard_terminate (rspamd_main);
}