diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-03-25 10:19:56 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-03-25 10:19:56 +0000 |
commit | 56468b07a43cd540967b25a5c16d44b7ecca6724 (patch) | |
tree | e3d000deeb7eba9a53711012c578af13c4d8e3d8 /src | |
parent | 441683d87b59a89bfd46f557caae254f15be2a7e (diff) | |
download | rspamd-56468b07a43cd540967b25a5c16d44b7ecca6724.tar.gz rspamd-56468b07a43cd540967b25a5c16d44b7ecca6724.zip |
[Minor] Slightly improve ev backend selection
Diffstat (limited to 'src')
-rw-r--r-- | src/libserver/cfg_utils.c | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c index 01fa08f74..d3ad9e210 100644 --- a/src/libserver/cfg_utils.c +++ b/src/libserver/cfg_utils.c @@ -2579,12 +2579,13 @@ rspamd_config_register_settings_id (struct rspamd_config *cfg, int rspamd_config_ev_backend_get (struct rspamd_config *cfg) { +#define AUTO_BACKEND (ev_supported_backends () & ~EVBACKEND_IOURING) if (cfg == NULL || cfg->events_backend == NULL) { - return ev_supported_backends () & ~EVBACKEND_IOURING; + return AUTO_BACKEND; } if (strcmp (cfg->events_backend, "auto") == 0) { - return ev_supported_backends () & ~EVBACKEND_IOURING; + return AUTO_BACKEND; } else if (strcmp (cfg->events_backend, "epoll") == 0) { if (ev_supported_backends () & EVBACKEND_EPOLL) { @@ -2593,7 +2594,17 @@ rspamd_config_ev_backend_get (struct rspamd_config *cfg) else { msg_warn_config ("unsupported events_backend: %s; defaulting to auto", cfg->events_backend); - return ev_supported_backends (); + return AUTO_BACKEND; + } + } + else if (strcmp (cfg->events_backend, "iouring") == 0) { + if (ev_supported_backends () & EVBACKEND_IOURING) { + return EVBACKEND_IOURING; + } + else { + msg_warn_config ("unsupported events_backend: %s; defaulting to auto", + cfg->events_backend); + return AUTO_BACKEND; } } else if (strcmp (cfg->events_backend, "kqueue") == 0) { @@ -2603,7 +2614,7 @@ rspamd_config_ev_backend_get (struct rspamd_config *cfg) else { msg_warn_config ("unsupported events_backend: %s; defaulting to auto", cfg->events_backend); - return ev_supported_backends (); + return AUTO_BACKEND; } } else if (strcmp (cfg->events_backend, "poll") == 0) { @@ -2617,7 +2628,7 @@ rspamd_config_ev_backend_get (struct rspamd_config *cfg) cfg->events_backend); } - return ev_supported_backends () & ~EVBACKEND_IOURING; + return AUTO_BACKEND; } const gchar * @@ -2630,15 +2641,22 @@ rspamd_config_ev_backend_to_string (int ev_backend, gboolean *effective) return "auto"; } + if (ev_backend & EVBACKEND_IOURING) { + SET_EFFECTIVE (TRUE); + return "epoll+io_uring"; + } + if (ev_backend & EVBACKEND_LINUXAIO) { + SET_EFFECTIVE (TRUE); + return "epoll+aio"; + }if (ev_backend & EVBACKEND_IOURING) { + SET_EFFECTIVE (TRUE); + return "epoll+io_uring"; + } + if (ev_backend & EVBACKEND_LINUXAIO) { + SET_EFFECTIVE (TRUE); + return "epoll+aio"; + } if (ev_backend & EVBACKEND_EPOLL) { - if (ev_backend & EVBACKEND_IOURING) { - SET_EFFECTIVE (TRUE); - return "epoll+io_uring"; - } - if (ev_backend & EVBACKEND_LINUXAIO) { - SET_EFFECTIVE (TRUE); - return "epoll+aio"; - } SET_EFFECTIVE (TRUE); return "epoll"; } |