aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main.h1
-rw-r--r--src/message.c3
-rw-r--r--src/protocol.c4
-rw-r--r--src/util.c14
-rw-r--r--src/util.h1
-rw-r--r--src/worker.c1
6 files changed, 23 insertions, 1 deletions
diff --git a/src/main.h b/src/main.h
index e26ab3fda..431ed8f4b 100644
--- a/src/main.h
+++ b/src/main.h
@@ -184,6 +184,7 @@ struct worker_task {
char *last_error; /**< last error */
int error_code; /**< code of last error */
memory_pool_t *task_pool; /**< memory pool for task */
+ struct timespec ts; /**< time of connection */
};
/**
diff --git a/src/message.c b/src/message.c
index 561c49457..6d770bbe8 100644
--- a/src/message.c
+++ b/src/message.c
@@ -292,6 +292,7 @@ mime_foreach_callback (GMimeObject *part, gpointer user_data)
if (type == NULL) {
msg_warn ("mime_foreach_callback: type of part is unknown, assume text/plain");
type = g_mime_content_type_new ("text", "plain");
+ memory_pool_add_destructor (task->task_pool, (pool_destruct_func)g_mime_content_type_destroy, type);
}
wrapper = g_mime_part_get_content_object (GMIME_PART (part));
if (wrapper != NULL) {
@@ -802,6 +803,7 @@ message_get_header (memory_pool_t *pool, GMimeMessage *message, const char *fiel
while (ia && ia->address) {
ia_string = internet_address_to_string ((InternetAddress *)ia->address, FALSE);
+ memory_pool_add_destructor (pool, (pool_destruct_func)g_free, ia_string);
gret = g_list_prepend (gret, ia_string);
ia = ia->next;
}
@@ -809,6 +811,7 @@ message_get_header (memory_pool_t *pool, GMimeMessage *message, const char *fiel
i = internet_address_list_length (ia);
while (i > 0) {
ia_string = internet_address_to_string (internet_address_list_get_address (ia, i), FALSE);
+ memory_pool_add_destructor (pool, (pool_destruct_func)g_free, ia_string);
gret = g_list_prepend (gret, ia_string);
-- i;
}
diff --git a/src/protocol.c b/src/protocol.c
index 6230495bf..c9e4925ff 100644
--- a/src/protocol.c
+++ b/src/protocol.c
@@ -24,6 +24,7 @@
#include "config.h"
#include "main.h"
+#include "util.h"
#include "cfg_file.h"
/* Max line size as it is defined in rfc2822 */
@@ -485,7 +486,8 @@ show_metric_result (gpointer metric_name, gpointer metric_value, void *user_data
if (task->cmd == CMD_SYMBOLS && metric_value != NULL) {
show_metric_symbols (metric_res, cd);
}
- cd->log_offset += snprintf (cd->log_buf + cd->log_offset, cd->log_size - cd->log_offset, "] )");
+ cd->log_offset += snprintf (cd->log_buf + cd->log_offset, cd->log_size - cd->log_offset, "] ), len: %ld, time: %ldms",
+ (long int)task->msg->len, calculate_check_time (&task->ts));
}
static int
diff --git a/src/util.c b/src/util.c
index 1fdd2758a..ef9531bd3 100644
--- a/src/util.c
+++ b/src/util.c
@@ -787,6 +787,20 @@ resolve_stat_filename (memory_pool_t *pool, char *pattern, char *rcpt, char *fro
return new;
}
+long int
+calculate_check_time (struct timespec *begin)
+{
+ struct timespec ts;
+ long int res;
+
+ clock_gettime (CLOCK_REALTIME, &ts);
+
+ res = (ts.tv_sec - begin->tv_sec) * 1000 + /* Seconds */
+ (ts.tv_nsec - begin->tv_nsec) / 1000000; /* Nanoseconds */
+
+ return res;
+}
+
/*
* vi:ts=4
*/
diff --git a/src/util.h b/src/util.h
index fa47f21e1..67e3d3d01 100644
--- a/src/util.h
+++ b/src/util.h
@@ -55,5 +55,6 @@ void file_log_function (const gchar *log_domain, GLogLevelFlags log_level, const
/* Replace %r with rcpt value and %f with from value, new string is allocated in pool */
char* resolve_stat_filename (memory_pool_t *pool, char *pattern, char *rcpt, char *from);
+long int calculate_check_time (struct timespec *begin);
#endif
diff --git a/src/worker.c b/src/worker.c
index bf5dfa159..295f331dc 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -254,6 +254,7 @@ accept_socket (int fd, short what, void *arg)
new_task->state = READ_COMMAND;
new_task->sock = nfd;
new_task->cfg = worker->srv->cfg;
+ clock_gettime (CLOCK_REALTIME, &new_task->ts);
io_tv.tv_sec = WORKER_IO_TIMEOUT;
io_tv.tv_usec = 0;
TAILQ_INIT (&new_task->urls);