Skip to content

Commit

Permalink
Rename disconnectingEventFd to disconnectingAllEventFd
Browse files Browse the repository at this point in the history
  • Loading branch information
halfgaar committed Nov 18, 2024
1 parent 38b4e52 commit 2195ee4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions threaddata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ ThreadData::ThreadData(int threadnr, const Settings &settings, const PluginLoade
if (taskEventFd < 0)
throw std::runtime_error("Can't create eventfd.");

disconnectingEventFd = eventfd(0, EFD_NONBLOCK);
if (disconnectingEventFd < 0)
disconnectingAllEventFd = eventfd(0, EFD_NONBLOCK);
if (disconnectingAllEventFd < 0)
throw std::runtime_error("Can't create eventfd.");

randomish.seed(get_random_int<unsigned long>());

struct epoll_event ev;
std::array<int, 2> event_fds {taskEventFd, disconnectingEventFd};
std::array<int, 2> event_fds {taskEventFd, disconnectingAllEventFd};
for (int efd : event_fds)
{
memset(&ev, 0, sizeof (struct epoll_event));
Expand All @@ -67,10 +67,10 @@ ThreadData::~ThreadData()
if (taskEventFd >= 0)
close(taskEventFd);

if (disconnectingEventFd >= 0)
if (disconnectingAllEventFd >= 0)
{
close(disconnectingEventFd);
disconnectingEventFd = -1;
close(disconnectingAllEventFd);
disconnectingAllEventFd = -1;
}

}
Expand Down Expand Up @@ -713,7 +713,7 @@ void ThreadData::sendAllDisconnects()
}

uint64_t one = 1;
check<std::runtime_error>(write(disconnectingEventFd, &one, sizeof(uint64_t)));
check<std::runtime_error>(write(disconnectingAllEventFd, &one, sizeof(uint64_t)));
}

void ThreadData::removeQueuedClients()
Expand Down
2 changes: 1 addition & 1 deletion threaddata.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class ThreadData
std::thread thread;
int threadnr = 0;
int taskEventFd = -1;
int disconnectingEventFd = -1;
int disconnectingAllEventFd = -1;
std::mutex taskQueueMutex;
std::list<std::function<void()>> taskQueue;
QueuedTasks delayedTasks;
Expand Down
2 changes: 1 addition & 1 deletion threadloop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void do_thread_work(ThreadData *threadData)
threadData->clearQueuedRetainedMessages();
}
}
else if (fd == threadData->disconnectingEventFd)
else if (fd == threadData->disconnectingAllEventFd)
{
/*
* This block (and related) ensures all the clients get processed at least once when a shutdown
Expand Down

0 comments on commit 2195ee4

Please sign in to comment.