Add listening sockets to shared epoll instance

All sorts of additional cleaning up can now be performed.
This commit is contained in:
Johan Wikman 2017-04-21 21:33:59 +03:00
parent 56b411aea9
commit c5fd2bdb81
2 changed files with 4 additions and 32 deletions

View File

@ -3473,10 +3473,11 @@ int poll_add_dcb(DCB *dcb)
else if (dcb->dcb_role == DCB_ROLE_BACKEND_HANDLER)
{
worker_id = dcb->session->client_dcb->poll.thread.id;
ss_dassert(worker_id == Worker::get_current_id());
}
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))

View File

@ -80,25 +80,7 @@ static bool add_fd_to_workers(int fd, uint32_t events, MXS_POLL_DATA* data)
bool rv = true;
int thread_id = data->thread.id;
for (int i = 0; i < n_threads; i++)
{
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;
}
}
rv = Worker::add_shared_fd(fd, events, data);
if (rv)
{
@ -161,18 +143,7 @@ static bool remove_fd_from_worker(int wid, int fd)
static bool remove_fd_from_workers(int fd)
{
int rc;
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;
return Worker::remove_shared_fd(fd);
}
bool poll_remove_fd_from_worker(int wid, int fd)