aboutsummaryrefslogtreecommitdiffstats
path: root/src/smtp.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2011-03-28 21:00:38 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2011-03-28 21:00:38 +0400
commit37d6c7f23fd44283d1853141d39ecc3f3a2c54e6 (patch)
treecaa5cbe2aaca2fb09886d43aeb77dbe2c160c553 /src/smtp.c
parent99225e6499d32f2415f64cd9d5d4402d3fb78b30 (diff)
downloadrspamd-37d6c7f23fd44283d1853141d39ecc3f3a2c54e6.tar.gz
rspamd-37d6c7f23fd44283d1853141d39ecc3f3a2c54e6.zip
* Add more timeouts: for fuzzy operations, for worker task operations
Handle miliseconds using a common macro.
Diffstat (limited to 'src/smtp.c')
-rw-r--r--src/smtp.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/smtp.c b/src/smtp.c
index 793f33e3a..390e73117 100644
--- a/src/smtp.c
+++ b/src/smtp.c
@@ -539,12 +539,10 @@ smtp_make_delay (struct smtp_session *session)
tv = memory_pool_alloc (session->pool, sizeof (struct timeval));
if (session->ctx->delay_jitter != 0) {
jitter = g_random_int_range (0, session->ctx->delay_jitter);
- tv->tv_sec = (session->ctx->smtp_delay + jitter) / 1000;
- tv->tv_usec = (session->ctx->smtp_delay + jitter - tv->tv_sec * 1000) * 1000;
+ msec_to_tv (session->ctx->smtp_delay + jitter, tv);
}
else {
- tv->tv_sec = session->ctx->smtp_delay / 1000;
- tv->tv_usec = (session->ctx->smtp_delay - tv->tv_sec * 1000) * 1000;
+ msec_to_tv (session->ctx->smtp_delay, tv);
}
evtimer_set (tev, smtp_delay_handler, session);
@@ -944,8 +942,7 @@ config_smtp_worker (struct rspamd_worker *worker)
gchar *value;
/* Init timeval */
- ctx->smtp_timeout.tv_sec = ctx->smtp_timeout_raw / 1000;
- ctx->smtp_timeout.tv_usec = (ctx->smtp_timeout_raw - ctx->smtp_timeout.tv_sec * 1000) * 1000;
+ msec_to_tv (ctx->smtp_timeout_raw, &ctx->smtp_timeout);
/* Init upstreams */
if ((value = ctx->upstreams_str) != NULL) {