MXS-1220: Simplify admin request handling

The admin requests are now processed in blocking mode. The timing out of
connecttions is handled by a specific timeout thread that checks the state
of each admin request.

The simplification will help with the JSON parsing with PUT/POST
commands. If non-blocking IO is used, the network reading code and JSON
parsing needs a lot more work to handle partial reads.

If the administrative interface requires higher performance and
concurrency, a multi-threaded solution could be created.
This commit is contained in:
Markus Mäkelä
2017-04-15 06:26:10 +03:00
committed by Markus Mäkelä
parent 439d67d129
commit e34b65658e
4 changed files with 125 additions and 52 deletions

View File

@ -15,13 +15,17 @@
#include <maxscale/cppdefs.hh>
#include <string>
#include <deque>
#include <maxscale/thread.h>
#include "adminclient.hh"
using std::deque;
using std::string;
typedef deque<SAdminClient> ClientList;
/** The admin interface configuration */
struct AdminConfig
{
@ -50,13 +54,20 @@ public:
*/
void stop();
/**
* Close timed out connections
*/
void check_timeouts();
private:
void handle_clients();
void handle_timeouts();
AdminClient* accept_client();
int m_socket; /**< The network socket we listen on */
int m_active; /**< Positive value if the admin is active */
int m_timeout; /**< Network timeout in seconds */
int m_socket; /**< The network socket we listen on */
int m_active; /**< Positive value if the admin is active */
int m_timeout; /**< Network timeout in seconds */
ClientList m_clients;
};
/**