Add listening sockets to shared epoll instance
All sorts of additional cleaning up can now be performed.
This commit is contained in:
@ -3473,10 +3473,11 @@ int poll_add_dcb(DCB *dcb)
|
|||||||
else if (dcb->dcb_role == DCB_ROLE_BACKEND_HANDLER)
|
else if (dcb->dcb_role == DCB_ROLE_BACKEND_HANDLER)
|
||||||
{
|
{
|
||||||
worker_id = dcb->session->client_dcb->poll.thread.id;
|
worker_id = dcb->session->client_dcb->poll.thread.id;
|
||||||
|
ss_dassert(worker_id == Worker::get_current_id());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
worker_id = MXS_WORKER_ANY;
|
worker_id = Worker::get_current_id();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (poll_add_fd_to_worker(worker_id, dcb->fd, events, (MXS_POLL_DATA*)dcb))
|
if (poll_add_fd_to_worker(worker_id, dcb->fd, events, (MXS_POLL_DATA*)dcb))
|
||||||
|
|||||||
@ -80,25 +80,7 @@ static bool add_fd_to_workers(int fd, uint32_t events, MXS_POLL_DATA* data)
|
|||||||
bool rv = true;
|
bool rv = true;
|
||||||
int thread_id = data->thread.id;
|
int thread_id = data->thread.id;
|
||||||
|
|
||||||
for (int i = 0; i < n_threads; i++)
|
rv = Worker::add_shared_fd(fd, events, data);
|
||||||
{
|
|
||||||
Worker* worker = Worker::get(i);
|
|
||||||
ss_dassert(worker);
|
|
||||||
|
|
||||||
if (!worker->add_fd(fd, events, data))
|
|
||||||
{
|
|
||||||
/** Remove the fd from the previous epoll instances */
|
|
||||||
for (int j = 0; j < i; j++)
|
|
||||||
{
|
|
||||||
Worker* worker = Worker::get(j);
|
|
||||||
ss_dassert(worker);
|
|
||||||
|
|
||||||
worker->remove_fd(fd);
|
|
||||||
}
|
|
||||||
rv = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rv)
|
if (rv)
|
||||||
{
|
{
|
||||||
@ -161,18 +143,7 @@ static bool remove_fd_from_worker(int wid, int fd)
|
|||||||
|
|
||||||
static bool remove_fd_from_workers(int fd)
|
static bool remove_fd_from_workers(int fd)
|
||||||
{
|
{
|
||||||
int rc;
|
return Worker::remove_shared_fd(fd);
|
||||||
|
|
||||||
for (int i = 0; i < n_threads; ++i)
|
|
||||||
{
|
|
||||||
Worker* worker = Worker::get(i);
|
|
||||||
ss_dassert(worker);
|
|
||||||
// We don't care about the result, anything serious and the
|
|
||||||
// function will not return and the process taken down.
|
|
||||||
worker->remove_fd(fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool poll_remove_fd_from_worker(int wid, int fd)
|
bool poll_remove_fd_from_worker(int wid, int fd)
|
||||||
|
|||||||
Reference in New Issue
Block a user