diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-12-24 16:31:40 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-12-24 16:31:40 +0000 |
commit | 14c1c342fadc78232bc4dfefb6b39d7f07bf456a (patch) | |
tree | 2ac12a31ce4a718b6d4993e13cfe5d1ac7a23f85 /src/libserver/re_cache.c | |
parent | bdad45f8aa525378e5c2081798b88f7c9ca72e44 (diff) | |
download | rspamd-14c1c342fadc78232bc4dfefb6b39d7f07bf456a.tar.gz rspamd-14c1c342fadc78232bc4dfefb6b39d7f07bf456a.zip |
[Minor] Slightly change fp logic
Diffstat (limited to 'src/libserver/re_cache.c')
-rw-r--r-- | src/libserver/re_cache.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libserver/re_cache.c b/src/libserver/re_cache.c index 1579092dc..7bab42e5d 100644 --- a/src/libserver/re_cache.c +++ b/src/libserver/re_cache.c @@ -33,6 +33,7 @@ #include "unix-std.h" #include <signal.h> #include <stdalign.h> +#include <math.h> #include "contrib/libev/ev.h" #ifndef WITH_PCRE2 @@ -538,7 +539,7 @@ rspamd_re_cache_process_pcre (struct rspamd_re_runtime *rt, const gchar *start = NULL, *end = NULL; guint max_hits = rspamd_regexp_get_maxhits (re); guint64 id = rspamd_regexp_get_cache_id (re); - gdouble t1, t2, pr; + gdouble t1 = NAN, t2, pr; const gdouble slow_time = 1e8; if (in == NULL) { @@ -587,7 +588,7 @@ rspamd_re_cache_process_pcre (struct rspamd_re_runtime *rt, rt->stat.regexp_matched += r; } - if (pr > 0.9) { + if (!isnan (t1)) { t2 = rspamd_get_ticks (TRUE); if (t2 - t1 > slow_time) { |