mirror of
https://github.com/pocoproject/poco.git
synced 2025-01-06 00:31:10 +01:00
Fix epollfd validity checks when compiling with wepoll (#3855)
This commit is contained in:
parent
c693b0b1b2
commit
85c68e7a81
@ -88,10 +88,11 @@ public:
|
|||||||
{
|
{
|
||||||
#ifdef WEPOLL_H_
|
#ifdef WEPOLL_H_
|
||||||
if (_eventfd >= 0) eventfd(_port, _eventfd);
|
if (_eventfd >= 0) eventfd(_port, _eventfd);
|
||||||
|
if (_epollfd) close(_epollfd);
|
||||||
#else
|
#else
|
||||||
if (_eventfd > 0) close(_eventfd.exchange(0));
|
if (_eventfd > 0) close(_eventfd.exchange(0));
|
||||||
#endif
|
|
||||||
if (_epollfd >= 0) close(_epollfd);
|
if (_epollfd >= 0) close(_epollfd);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void add(const Socket& socket, int mode)
|
void add(const Socket& socket, int mode)
|
||||||
@ -146,7 +147,11 @@ public:
|
|||||||
close(_epollfd);
|
close(_epollfd);
|
||||||
_socketMap.clear();
|
_socketMap.clear();
|
||||||
_epollfd = epoll_create(1);
|
_epollfd = epoll_create(1);
|
||||||
|
#ifdef WEPOLL_H_
|
||||||
|
if (!_epollfd) SocketImpl::error();
|
||||||
|
#else
|
||||||
if (_epollfd < 0) SocketImpl::error();
|
if (_epollfd < 0) SocketImpl::error();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef WEPOLL_H_
|
#ifdef WEPOLL_H_
|
||||||
eventfd(_port, _eventfd);
|
eventfd(_port, _eventfd);
|
||||||
|
@ -646,7 +646,12 @@ bool SocketImpl::poll(const Poco::Timespan& timeout, int mode)
|
|||||||
#else
|
#else
|
||||||
int epollfd = epoll_create(1);
|
int epollfd = epoll_create(1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef WEPOLL_H_
|
||||||
|
if (!epollfd)
|
||||||
|
#else
|
||||||
if (epollfd < 0)
|
if (epollfd < 0)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
error("Can't create epoll queue");
|
error("Can't create epoll queue");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user