case RSPAMD_CONTROL_FUZZY_STAT:
case RSPAMD_CONTROL_FUZZY_SYNC:
case RSPAMD_CONTROL_LOG_PIPE:
+ case RSPAMD_CONTROL_CHILD_CHANGE:
break;
case RSPAMD_CONTROL_RERESOLVE:
if (cd->worker->srv->cfg) {
RSPAMD_CONTROL_FUZZY_STAT,
RSPAMD_CONTROL_FUZZY_SYNC,
RSPAMD_CONTROL_MONITORED_CHANGE,
+ RSPAMD_CONTROL_CHILD_CHANGE,
RSPAMD_CONTROL_MAX
};
struct {
guint unused;
} fuzzy_sync;
+ struct {
+ enum {
+ rspamd_child_offline,
+ rspamd_child_online,
+ rspamd_child_terminated,
+ } what;
+ pid_t pid;
+ guint additional;
+ } child_change;
} cmd;
};
* @param cmd
* @param except_pid
*/
-void
-rspamd_control_broadcast_srv_cmd (struct rspamd_main *rspamd_main,
- struct rspamd_control_command *cmd,
- pid_t except_pid);
+void rspamd_control_broadcast_srv_cmd (struct rspamd_main *rspamd_main,
+ struct rspamd_control_command *cmd,
+ pid_t except_pid);
/**
* Returns command from a specified string (case insensitive)
struct rspamd_worker *wrk = (struct rspamd_worker *)w->data;
gdouble time_from_last = ev_time ();
struct rspamd_main *rspamd_main;
+ static struct rspamd_control_command cmd;
struct tm tm;
gchar timebuf[64];
gchar usec_buf[16];
if (wrk->hb.nbeats > 0) {
/* First time lost event */
+ cmd.type = RSPAMD_CONTROL_CHILD_CHANGE;
+ cmd.cmd.child_change.what = rspamd_child_offline;
+ cmd.cmd.child_change.pid = wrk->pid;
+ rspamd_control_broadcast_srv_cmd (rspamd_main, &cmd, wrk->pid);
msg_warn_main ("lost heartbeat from worker type %s with pid %P, "
"last beat on: %s (%L beats received previously)",
g_quark_to_string (wrk->type), wrk->pid,
rspamd_snprintf (timebuf + r, sizeof (timebuf) - r,
"%s", usec_buf + 1);
+ cmd.type = RSPAMD_CONTROL_CHILD_CHANGE;
+ cmd.cmd.child_change.what = rspamd_child_online;
+ cmd.cmd.child_change.pid = wrk->pid;
+ rspamd_control_broadcast_srv_cmd (rspamd_main, &cmd, wrk->pid);
msg_info_main ("received heartbeat from worker type %s with pid %P, "
"last beat on: %s (%L beats lost previously)",
g_quark_to_string (wrk->type), wrk->pid,