mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-28 02:33:29 +02:00
fix(PollSet): default enable epoll on linux
This commit is contained in:
parent
0df6a6a7d9
commit
3e6e259c2a
@ -132,6 +132,11 @@ POCO_NET_FORCE_SYMBOL(pocoNetworkInitializer)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if POCO_OS == POCO_OS_LINUX
|
||||||
|
#define POCO_HAVE_FD_EPOLL 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(POCO_OS_FAMILY_BSD)
|
#if defined(POCO_OS_FAMILY_BSD)
|
||||||
#ifndef POCO_HAVE_FD_POLL
|
#ifndef POCO_HAVE_FD_POLL
|
||||||
#define POCO_HAVE_FD_POLL 1
|
#define POCO_HAVE_FD_POLL 1
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "Poco/Net/DatagramSocket.h"
|
#include "Poco/Net/DatagramSocket.h"
|
||||||
#include "Poco/Net/ServerSocket.h"
|
#include "Poco/Net/ServerSocket.h"
|
||||||
#include "Poco/Timestamp.h"
|
#include "Poco/Timestamp.h"
|
||||||
|
#include "Poco/Stopwatch.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using Poco::Net::SocketProactor;
|
using Poco::Net::SocketProactor;
|
||||||
@ -25,6 +26,7 @@ using Poco::Net::ServerSocket;
|
|||||||
using Poco::Net::SocketAddress;
|
using Poco::Net::SocketAddress;
|
||||||
using Poco::Thread;
|
using Poco::Thread;
|
||||||
using Poco::Timestamp;
|
using Poco::Timestamp;
|
||||||
|
using Poco::Stopwatch;
|
||||||
|
|
||||||
|
|
||||||
SocketProactorTest::SocketProactorTest(const std::string& name): CppUnit::TestCase(name)
|
SocketProactorTest::SocketProactorTest(const std::string& name): CppUnit::TestCase(name)
|
||||||
@ -145,7 +147,14 @@ void SocketProactorTest::testUDPSocketProactor()
|
|||||||
received = true;
|
received = true;
|
||||||
};
|
};
|
||||||
proactor.addReceiveFrom(s, buf, sa, onRecvCompletion);
|
proactor.addReceiveFrom(s, buf, sa, onRecvCompletion);
|
||||||
while (!received) proactor.poll();
|
Stopwatch sw;
|
||||||
|
sw.start();
|
||||||
|
while (!received)
|
||||||
|
{
|
||||||
|
if (sw.elapsedSeconds() > 1)
|
||||||
|
fail("SocketProactor receive completion timed out.", __LINE__, __FILE__);
|
||||||
|
proactor.poll();
|
||||||
|
}
|
||||||
|
|
||||||
assertTrue (sent);
|
assertTrue (sent);
|
||||||
assertTrue (sendPassed);
|
assertTrue (sendPassed);
|
||||||
@ -167,8 +176,11 @@ void SocketProactorTest::testUDPSocketProactor()
|
|||||||
nullptr);
|
nullptr);
|
||||||
proactor.addReceiveFrom(s, buf, sa, nullptr);
|
proactor.addReceiveFrom(s, buf, sa, nullptr);
|
||||||
int handled = 0, handledTot = 0;
|
int handled = 0, handledTot = 0;
|
||||||
|
sw.restart();
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
if (sw.elapsedSeconds() > 1)
|
||||||
|
fail("SocketProactor receiveFrom timed out.", __LINE__, __FILE__);
|
||||||
proactor.poll(&handled);
|
proactor.poll(&handled);
|
||||||
handledTot += handled;
|
handledTot += handled;
|
||||||
} while (handledTot < 2);
|
} while (handledTot < 2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user