diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-10-27 09:42:59 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-10-27 09:42:59 +0000 |
commit | ad664dd4c66be1f803dcdf208bb228478422f102 (patch) | |
tree | 7829b9e442219c4cf5ecb9589848b78e74fdc4af /src/rspamd.c | |
parent | 880300de81564ce2fa4664953fb2a42be9d0bcd0 (diff) | |
download | rspamd-ad664dd4c66be1f803dcdf208bb228478422f102.tar.gz rspamd-ad664dd4c66be1f803dcdf208bb228478422f102.zip |
[Feature] Allow to explicitly set events backend
Diffstat (limited to 'src/rspamd.c')
-rw-r--r-- | src/rspamd.c | 41 |
1 files changed, 9 insertions, 32 deletions
diff --git a/src/rspamd.c b/src/rspamd.c index f726865e7..4b33e7577 100644 --- a/src/rspamd.c +++ b/src/rspamd.c @@ -1387,42 +1387,19 @@ main (gint argc, gchar **argv, gchar **env) rspamd_main->workers = g_hash_table_new (g_direct_hash, g_direct_equal); /* Init event base */ - event_loop = ev_default_loop (EVFLAG_SIGNALFD|EVBACKEND_ALL); + event_loop = ev_default_loop (EVFLAG_SIGNALFD| + rspamd_config_ev_backend_get (rspamd_main->cfg)); rspamd_main->event_loop = event_loop; if (event_loop) { - unsigned loop_type = ev_backend (event_loop); - const gchar *loop_str = "unknown"; - gboolean poor_backend = TRUE; - - switch (loop_type) { - case EVBACKEND_EPOLL: - loop_str = "epoll"; - poor_backend = FALSE; - break; - case EVBACKEND_POLL: - loop_str = "poll"; - break; - case EVBACKEND_SELECT: - loop_str = "select"; - break; - case EVBACKEND_KQUEUE: - loop_str = "kqueue"; - poor_backend = FALSE; - break; - case EVBACKEND_PORT: - loop_str = "port"; - poor_backend = FALSE; - break; - case EVBACKEND_DEVPOLL: - loop_str = "/dev/poll"; - poor_backend = FALSE; - break; - default: - break; - } + int loop_type = ev_backend (event_loop); + gboolean effective_backend; + const gchar *loop_str; + + loop_str = + rspamd_config_ev_backend_to_string (loop_type, &effective_backend); - if (poor_backend) { + if (!effective_backend) { msg_warn_main ("event loop uses non-optimal backend: %s", loop_str); } else { |