diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/socketengines/socketengine_epoll.cpp | 4 | ||||
-rw-r--r-- | src/socketengines/socketengine_kqueue.cpp | 4 | ||||
-rw-r--r-- | src/socketengines/socketengine_poll.cpp | 7 |
3 files changed, 6 insertions, 9 deletions
diff --git a/src/socketengines/socketengine_epoll.cpp b/src/socketengines/socketengine_epoll.cpp index 800cc7657..34f943dee 100644 --- a/src/socketengines/socketengine_epoll.cpp +++ b/src/socketengines/socketengine_epoll.cpp @@ -185,8 +185,6 @@ void EPollEngine::DelFd(EventHandler* eh) int EPollEngine::DispatchEvents() { - socklen_t codesize = sizeof(int); - int errcode; int i = epoll_wait(EngineHandle, &events[0], events.size(), 1000); ServerInstance->UpdateTime(); @@ -216,6 +214,8 @@ int EPollEngine::DispatchEvents() { ErrorEvents++; /* Get error number */ + socklen_t codesize = sizeof(int); + int errcode; if (getsockopt(ev.data.fd, SOL_SOCKET, SO_ERROR, &errcode, &codesize) < 0) errcode = errno; eh->HandleEvent(EVENT_ERROR, errcode); diff --git a/src/socketengines/socketengine_kqueue.cpp b/src/socketengines/socketengine_kqueue.cpp index 53bd741f0..517451237 100644 --- a/src/socketengines/socketengine_kqueue.cpp +++ b/src/socketengines/socketengine_kqueue.cpp @@ -37,9 +37,6 @@ private: /** These are used by kqueue() to hold socket events */ std::vector<struct kevent> ke_list; - /** This is a specialised time value used by kqueue() - */ - struct timespec ts; public: /** Create a new KQueueEngine */ @@ -203,6 +200,7 @@ void KQueueEngine::OnSetEvent(EventHandler* eh, int old_mask, int new_mask) int KQueueEngine::DispatchEvents() { + struct timespec ts; ts.tv_nsec = 0; ts.tv_sec = 1; diff --git a/src/socketengines/socketengine_poll.cpp b/src/socketengines/socketengine_poll.cpp index 53953626f..323de422b 100644 --- a/src/socketengines/socketengine_poll.cpp +++ b/src/socketengines/socketengine_poll.cpp @@ -185,13 +185,10 @@ void PollEngine::DelFd(EventHandler* eh) int PollEngine::DispatchEvents() { int i = poll(&events[0], CurrentSetSize, 1000); - int index; - socklen_t codesize = sizeof(int); - int errcode; int processed = 0; ServerInstance->UpdateTime(); - for (index = 0; index < CurrentSetSize && processed < i; index++) + for (int index = 0; index < CurrentSetSize && processed < i; index++) { struct pollfd& pfd = events[index]; @@ -215,6 +212,8 @@ int PollEngine::DispatchEvents() if (revents & POLLERR) { // Get error number + socklen_t codesize = sizeof(int); + int errcode; if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &errcode, &codesize) < 0) errcode = errno; eh->HandleEvent(EVENT_ERROR, errcode); |