MXS-1220: Create separate admin thread
When MaxScale is started, a separate thread for the administrative interface is started. This allows the worker threads to handle client requests while the administrative thread handles the lower priority administrative requests. The administrative interface responds to all request with a 200 OK HTTP response. This allows the administrative interface itself to be tested.
This commit is contained in:
committed by
Markus Mäkelä
parent
5c0429466c
commit
23b6fb3e6d
@ -57,6 +57,7 @@
|
||||
#include "maxscale/poll.h"
|
||||
#include "maxscale/service.h"
|
||||
#include "maxscale/statistics.h"
|
||||
#include "maxscale/admin.hh"
|
||||
#include "maxscale/worker.hh"
|
||||
|
||||
using namespace maxscale;
|
||||
@ -1991,6 +1992,14 @@ int main(int argc, char **argv)
|
||||
write_child_exit_code(daemon_pipe[1], rc);
|
||||
}
|
||||
|
||||
if (!mxs_admin_init())
|
||||
{
|
||||
const char* logerr = "Failed to initialize admin interface";
|
||||
print_log_n_stderr(true, true, logerr, logerr, 0);
|
||||
rc = MAXSCALE_INTERNALERROR;
|
||||
goto return_main;
|
||||
}
|
||||
|
||||
/*<
|
||||
* Run worker 0 in the main thread.
|
||||
*/
|
||||
@ -1998,6 +2007,9 @@ int main(int argc, char **argv)
|
||||
ss_dassert(worker);
|
||||
worker->run();
|
||||
|
||||
/** Stop administrative interface */
|
||||
mxs_admin_shutdown();
|
||||
|
||||
/*<
|
||||
* Wait for the housekeeper to finish.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user