summaryrefslogtreecommitdiffstats
path: root/src/client/rspamc.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-04-01 12:05:25 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-04-01 12:05:25 +0100
commit34900140350c11df3e938184a03026395316f54e (patch)
tree899eaff2690ca7b1b3a403c9b2edbf99585c3cb5 /src/client/rspamc.c
parent5a19519ed2ad4efcc2bd5b6e5e703dccc6b7f9fa (diff)
downloadrspamd-34900140350c11df3e938184a03026395316f54e.tar.gz
rspamd-34900140350c11df3e938184a03026395316f54e.zip
[Fix] Do not count sending and loading time in rspamc
Diffstat (limited to 'src/client/rspamc.c')
-rw-r--r--src/client/rspamc.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/client/rspamc.c b/src/client/rspamc.c
index d58310de6..839fd2ff0 100644
--- a/src/client/rspamc.c
+++ b/src/client/rspamc.c
@@ -324,7 +324,6 @@ struct rspamc_command {
struct rspamc_callback_data {
struct rspamc_command *cmd;
gchar *filename;
- gdouble start;
};
gboolean
@@ -1392,9 +1391,10 @@ rspamc_client_execute_cmd (struct rspamc_command *cmd, ucl_object_t *result,
static void
rspamc_client_cb (struct rspamd_client_connection *conn,
- struct rspamd_http_message *msg,
- const gchar *name, ucl_object_t *result, GString *input,
- gpointer ud, GError *err)
+ struct rspamd_http_message *msg,
+ const gchar *name, ucl_object_t *result, GString *input,
+ gpointer ud, gdouble start_time, gdouble send_time,
+ GError *err)
{
gchar *ucl_out;
struct rspamc_callback_data *cbdata = (struct rspamc_callback_data *)ud;
@@ -1405,7 +1405,13 @@ rspamc_client_cb (struct rspamd_client_connection *conn,
gsize body_len;
cmd = cbdata->cmd;
- diff = finish - cbdata->start;
+
+ if (send_time > 0) {
+ diff = finish - send_time;
+ }
+ else {
+ diff = finish - start_time;
+ }
if (execute) {
/* Pass all to the external command */
@@ -1526,7 +1532,6 @@ rspamc_process_input (struct event_base *ev_base, struct rspamc_command *cmd,
cbdata = g_slice_alloc (sizeof (struct rspamc_callback_data));
cbdata->cmd = cmd;
cbdata->filename = g_strdup (name);
- cbdata->start = rspamd_get_ticks ();
if (cmd->need_input) {
rspamd_client_command (conn, cmd->path, attrs, in, rspamc_client_cb,