Write slave heartbeat in correct thread

The writing should be done on the worker that owns the DCB.
This commit is contained in:
Markus Mäkelä
2019-05-06 15:17:42 +03:00
parent 4e3a581c94
commit 0638ea736e

View File

@ -47,6 +47,7 @@
#include <maxscale/service.h>
#include <maxscale/utils.h>
#include <maxscale/version.h>
#include <maxscale/routingworker.hh>
using std::string;
using std::vector;
@ -6305,7 +6306,11 @@ static int blr_slave_send_heartbeat(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave
}
/* Write the packet */
return MXS_SESSION_ROUTE_REPLY(slave->dcb->session, h_event);
mxs::RoutingWorker* worker = (mxs::RoutingWorker*)slave->dcb->poll.owner;
worker->execute([slave, h_event]() {
MXS_SESSION_ROUTE_REPLY(slave->dcb->session, h_event);
}, mxs::RoutingWorker::EXECUTE_AUTO);
return 1;
}
/**