fix(PollSet): windows fixes

This commit is contained in:
Alex Fabijanic 2022-05-08 09:34:19 -05:00
parent b175a8de7a
commit 03561df128
4 changed files with 7 additions and 7 deletions

View File

@ -462,7 +462,7 @@ private:
inline void SocketProactor::addSocket(Socket sock, int mode)
{
_pollSet.add(sock, mode);
_pollSet.add(sock, mode | PollSet::POLL_ERROR);
}

View File

@ -613,8 +613,8 @@ int SocketImpl::available()
#if (POCO_OS != POCO_OS_LINUX)
if (type() == SOCKET_TYPE_DATAGRAM)
{
char buf[result];
result = recvfrom(sockfd(), buf, result, MSG_PEEK, NULL, NULL);
std::vector<char> buf(result);
result = recvfrom(sockfd(), &buf[0], result, MSG_PEEK, NULL, NULL);
}
#endif
return result;

View File

@ -300,13 +300,13 @@ int SocketProactor::poll(int* pHandled)
if (it->second & PollSet::POLL_READ)
{
Socket sock = it->first;
if (hasHandlers(_readHandlers, sock.impl()->sockfd()))
if (hasHandlers(_readHandlers, static_cast<int>(sock.impl()->sockfd())))
handled += receive(sock);
}
if (it->second & PollSet::POLL_WRITE)
{
Socket sock = it->first;
if (hasHandlers(_writeHandlers, sock.impl()->sockfd()))
if (hasHandlers(_writeHandlers, static_cast<int>(sock.impl()->sockfd())))
handled += send(sock);
}
if (it->second & PollSet::POLL_ERROR)

View File

@ -195,8 +195,8 @@ void PollSetTest::testPollNoServer()
ss2.connectNB(SocketAddress("127.0.0.1", 0xFEFF));
PollSet ps;
assertTrue(ps.empty());
ps.add(ss1, PollSet::POLL_READ);
ps.add(ss2, PollSet::POLL_READ);
ps.add(ss1, PollSet::POLL_READ | PollSet::POLL_ERROR);
ps.add(ss2, PollSet::POLL_READ | PollSet::POLL_ERROR);
assertTrue(!ps.empty());
assertTrue(ps.has(ss1));
assertTrue(ps.has(ss2));