MXS-1220: Fix minor problems with admin thread
The admin thread now uses blocking IO. This is not optimal but it simplifies the code by some amount. Fixed option processing removing one extra character from key name. Use correct member variable when checking for the option map end.
This commit is contained in:
committed by
Markus Mäkelä
parent
c4a8f8c8a6
commit
caf2172677
@ -61,6 +61,8 @@ bool mxs_admin_init()
|
||||
|
||||
if (sock > -1)
|
||||
{
|
||||
setblocking(sock);
|
||||
|
||||
if (listen(sock, INT_MAX) == 0)
|
||||
{
|
||||
admin = new (std::nothrow) AdminListener(sock);
|
||||
@ -121,9 +123,9 @@ AdminListener::~AdminListener()
|
||||
|
||||
void AdminListener::handle_clients()
|
||||
{
|
||||
AdminClient* client = accept_client();
|
||||
AdminClient* client;
|
||||
|
||||
if (client)
|
||||
while ((client = accept_client()))
|
||||
{
|
||||
SAdminClient sclient(client);
|
||||
ClientList::iterator it = m_clients.insert(m_clients.begin(), sclient);
|
||||
@ -156,11 +158,6 @@ AdminClient* AdminListener::accept_client()
|
||||
{
|
||||
rval = new AdminClient(fd, addr, m_timeout);
|
||||
}
|
||||
else if (errno == EAGAIN || errno == EWOULDBLOCK)
|
||||
{
|
||||
// TODO: Use epoll for this
|
||||
thread_millisleep(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_ERROR("Failed to accept client: %d, %s\n", errno, mxs_strerror(errno));
|
||||
|
||||
Reference in New Issue
Block a user