rdata->rep.id = cmd.id;
rdata->rep.type = cmd.type;
rdata->fd = -1;
+ worker->tmp_data = rdata;
if (msg.msg_controllen >= CMSG_LEN (sizeof (int))) {
rfd = *(int *) CMSG_DATA(CMSG_FIRSTHDR (&msg));
else if (what == EV_WRITE) {
rdata = ud;
worker = rdata->worker;
+ worker->tmp_data = NULL; /* Avoid race */
srv = rdata->srv;
memset (&msg, 0, sizeof (msg));
{
g_assert (worker != NULL);
+ worker->tmp_data = NULL;
event_set (&worker->srv_ev, worker->srv_pipe[0], EV_READ | EV_PERSIST,
rspamd_srv_handler, worker);
event_base_set (ev_base, &worker->srv_ev);
nowait ? "with no result available" :
(WTERMSIG (res) == SIGKILL ? "hardly" : "softly"));
if (w->srv_pipe[0] != -1) {
+ /* Ugly workaround */
+ if (w->tmp_data) {
+ g_free (w->tmp_data);
+ }
event_del (&w->srv_ev);
}
+
if (w->finish_actions) {
g_ptr_array_free (w->finish_actions, TRUE);
}
+
REF_RELEASE (w->cf);
g_free (w);
}
if (cur->srv_pipe[0] != -1) {
+ /* Ugly workaround */
+ if (cur->tmp_data) {
+ g_free (cur->tmp_data);
+ }
event_del (&cur->srv_ev);
}
main process. [0] - main, [1] - worker */
struct event srv_ev; /**< used by main for read workers' requests */
gpointer control_data; /**< used by control protocol to handle commands */
+ gpointer tmp_data; /**< used to avoid race condition to deal with control messages */
GPtrArray *finish_actions; /**< called when worker is terminated */
};