janitorial: Use poll() instead of select().
This commit is contained in:
parent
0aecedf281
commit
63504e9e80
|
@ -67,6 +67,15 @@
|
|||
|
||||
#include "config.h"
|
||||
#include <stdarg.h>
|
||||
#ifdef HAVE_POLL_H
|
||||
#include <poll.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_POLL_H
|
||||
# include <sys/poll.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include "winsock2.h"
|
||||
#include "windef.h"
|
||||
|
@ -302,13 +311,12 @@ static UCHAR NetBTWaitForNameResponse(const NetBTAdapter *adapter, SOCKET fd,
|
|||
while (!found && ret == NRC_GOODRET && (now = GetTickCount()) < waitUntil)
|
||||
{
|
||||
DWORD msToWait = waitUntil - now;
|
||||
struct fd_set fds;
|
||||
struct timeval timeout = { msToWait / 1000, msToWait % 1000 };
|
||||
struct pollfd pfd;
|
||||
int r;
|
||||
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(fd, &fds);
|
||||
r = select(fd + 1, &fds, NULL, NULL, &timeout);
|
||||
pfd.fd = fd;
|
||||
pfd.events = POLLIN;
|
||||
r = poll(&pfd, 1, msToWait);
|
||||
if (r < 0)
|
||||
ret = NRC_SYSTEM;
|
||||
else if (r == 1)
|
||||
|
|
|
@ -38,6 +38,12 @@
|
|||
#ifdef HAVE_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_POLL_H
|
||||
#include <poll.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_POLL_H
|
||||
# include <sys/poll.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
|
@ -3049,22 +3055,19 @@ LPSTR INTERNET_GetResponseBuffer(void)
|
|||
|
||||
LPSTR INTERNET_GetNextLine(INT nSocket, LPDWORD dwLen)
|
||||
{
|
||||
struct timeval tv;
|
||||
fd_set infd;
|
||||
struct pollfd pfd;
|
||||
BOOL bSuccess = FALSE;
|
||||
INT nRecv = 0;
|
||||
LPSTR lpszBuffer = INTERNET_GetResponseBuffer();
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
FD_ZERO(&infd);
|
||||
FD_SET(nSocket, &infd);
|
||||
tv.tv_sec=RESPONSE_TIMEOUT;
|
||||
tv.tv_usec=0;
|
||||
pfd.fd = nSocket;
|
||||
pfd.events = POLLIN;
|
||||
|
||||
while (nRecv < MAX_REPLY_LEN)
|
||||
{
|
||||
if (select(nSocket+1,&infd,NULL,NULL,&tv) > 0)
|
||||
if (poll(&pfd,1, RESPONSE_TIMEOUT * 1000) > 0)
|
||||
{
|
||||
if (recv(nSocket, &lpszBuffer[nRecv], 1, 0) <= 0)
|
||||
{
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#ifdef HAVE_POLL_H
|
||||
#include <poll.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_POLL_H
|
||||
# include <sys/poll.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
|
@ -610,19 +616,16 @@ BOOL NETCON_getNextLine(WININET_NETCONNECTION *connection, LPSTR lpszBuffer, LPD
|
|||
|
||||
if (!connection->useSSL)
|
||||
{
|
||||
struct timeval tv;
|
||||
fd_set infd;
|
||||
struct pollfd pfd;
|
||||
BOOL bSuccess = FALSE;
|
||||
DWORD nRecv = 0;
|
||||
|
||||
FD_ZERO(&infd);
|
||||
FD_SET(connection->socketFD, &infd);
|
||||
tv.tv_sec=RESPONSE_TIMEOUT;
|
||||
tv.tv_usec=0;
|
||||
pfd.fd = connection->socketFD;
|
||||
pfd.events = POLLIN;
|
||||
|
||||
while (nRecv < *dwBuffer)
|
||||
{
|
||||
if (select(connection->socketFD+1,&infd,NULL,NULL,&tv) > 0)
|
||||
if (poll(&pfd,1, RESPONSE_TIMEOUT * 1000) > 0)
|
||||
{
|
||||
if (recv(connection->socketFD, &lpszBuffer[nRecv], 1, 0) <= 0)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue