aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libserver/rspamd_control.c9
-rw-r--r--src/libserver/worker_util.c3
2 files changed, 7 insertions, 5 deletions
diff --git a/src/libserver/rspamd_control.c b/src/libserver/rspamd_control.c
index 3217798ce..e8c24ff12 100644
--- a/src/libserver/rspamd_control.c
+++ b/src/libserver/rspamd_control.c
@@ -158,7 +158,7 @@ rspamd_control_write_reply (struct rspamd_control_session *session)
rep = ucl_object_typed_new (UCL_OBJECT);
DL_FOREACH (session->replies, elt) {
- rspamd_snprintf (tmpbuf, sizeof (tmpbuf), "%p", elt->wrk->pid);
+ rspamd_snprintf (tmpbuf, sizeof (tmpbuf), "%P", elt->wrk->pid);
cur = ucl_object_typed_new (UCL_OBJECT);
ucl_object_insert_key (cur, ucl_object_fromstring (g_quark_to_string (
@@ -199,7 +199,7 @@ rspamd_control_wrk_io (gint fd, short what, gpointer ud)
if (read (elt->wrk->control_pipe[0], &elt->reply, sizeof (elt->reply)) !=
sizeof (elt->reply)) {
- msg_err ("cannot read request from the worker %p (%s): %s",
+ msg_err ("cannot read request from the worker %P (%s): %s",
elt->wrk->pid, g_quark_to_string (elt->wrk->type), strerror (errno));
}
@@ -208,7 +208,6 @@ rspamd_control_wrk_io (gint fd, short what, gpointer ud)
if (elt->session->replies_remain == 0) {
rspamd_control_write_reply (elt->session);
- rspamd_control_connection_close (elt->session);
}
}
@@ -287,7 +286,7 @@ rspamd_control_finish_hadler (struct rspamd_http_connection *conn,
session->replies_remain ++;
}
else {
- msg_err ("cannot write request to the worker %p (%s): %s",
+ msg_err ("cannot write request to the worker %P (%s): %s",
wrk->pid, g_quark_to_string (wrk->type), strerror (errno));
}
}
@@ -352,7 +351,7 @@ rspamd_control_default_cmd_handler (gint fd,
}
rep.reply.stat.conns = cd->worker->nconns;
- rep.reply.stat.utime = rspamd_get_calendar_ticks () - cd->worker->start_time;
+ rep.reply.stat.uptime = rspamd_get_calendar_ticks () - cd->worker->start_time;
break;
case RSPAMD_CONTROL_RELOAD:
break;
diff --git a/src/libserver/worker_util.c b/src/libserver/worker_util.c
index 2db047afe..02be93d8f 100644
--- a/src/libserver/worker_util.c
+++ b/src/libserver/worker_util.c
@@ -29,6 +29,7 @@
#include "unix-std.h"
#include "utlist.h"
#include "ottery.h"
+#include "rspamd_control.h"
#ifdef WITH_GPERF_TOOLS
#include <google/profiler.h>
@@ -246,6 +247,7 @@ rspamd_prepare_worker (struct rspamd_worker *worker, const char *name,
ev_base = event_init ();
rspamd_worker_init_signals (worker, ev_base);
+ rspamd_control_worker_add_default_handler (worker, ev_base);
/* Accept all sockets */
cur = worker->cf->listen_socks;
@@ -469,6 +471,7 @@ rspamd_fork_worker (struct rspamd_main *rspamd_main,
/* Do silent log reopen to avoid collisions */
rspamd_log_close (rspamd_main->logger);
rspamd_log_open (rspamd_main->logger);
+ cur->start_time = rspamd_get_calendar_ticks ();
#if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION <= 30))
# if (GLIB_MINOR_VERSION > 20)