]> source.dussan.org Git - rspamd.git/commitdiff
[Test] Fix functional tests case
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 21 Jun 2019 11:50:42 +0000 (12:50 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 22 Jun 2019 09:57:29 +0000 (10:57 +0100)
src/libserver/task.c
src/libserver/task.h

index 3c92e05b9e1ac6bc9110b990014115d866225621..04be617448f58d401a54b3d00784cb6caadcd033 100644 (file)
@@ -75,7 +75,7 @@ struct rspamd_task *
 rspamd_task_new (struct rspamd_worker *worker, struct rspamd_config *cfg,
                                 rspamd_mempool_t *pool,
                                 struct rspamd_lang_detector *lang_det,
-                                struct ev_loop *ev_base)
+                                struct ev_loop *event_loop)
 {
        struct rspamd_task *new_task;
 
@@ -101,9 +101,16 @@ rspamd_task_new (struct rspamd_worker *worker, struct rspamd_config *cfg,
                }
        }
 
-       new_task->event_loop = ev_base;
-       new_task->task_timestamp = ev_time ();
-       new_task->time_virtual = ev_now (ev_base);
+       new_task->event_loop = event_loop;
+       if (event_loop) {
+               new_task->task_timestamp = ev_time ();
+               new_task->time_virtual = ev_now (event_loop);
+       }
+       else {
+               new_task->task_timestamp = ev_time ();
+               new_task->time_virtual = rspamd_get_virtual_ticks ();
+       }
+
        new_task->time_real_finish = NAN;
        new_task->time_virtual_finish = NAN;
 
index 7b30f97cd0fad4bab4b5d409d26fb5e0284df76b..d581378b7c492a957d8271458735dced51c0d7d4 100644 (file)
@@ -219,7 +219,7 @@ struct rspamd_task *rspamd_task_new (struct rspamd_worker *worker,
                                                                         struct rspamd_config *cfg,
                                                                         rspamd_mempool_t *pool,
                                                                         struct rspamd_lang_detector *lang_det,
-                                                                        struct ev_loop *ev_base);
+                                                                        struct ev_loop *event_loop);
 /**
  * Destroy task object and remove its IO dispatcher if it exists
  */