mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Fix select() calls - nfds must be the highest fd value plus 1
* This was copy-pasted from windows where unfortunately the nfds argument is ignored and we could get away with just passing 0 (which I suspect is where the broken code came from originally - a windows example code that passed 0)
This commit is contained in:
@@ -311,7 +311,7 @@ Socket *CreateClientSocket(const char *host, uint16_t port, int timeoutMS)
|
||||
timeval timeout;
|
||||
timeout.tv_sec = (timeoutMS / 1000);
|
||||
timeout.tv_usec = (timeoutMS % 1000) * 1000;
|
||||
result = select(0, NULL, &set, NULL, &timeout);
|
||||
result = select(s + 1, NULL, &set, NULL, &timeout);
|
||||
|
||||
if(result <= 0)
|
||||
{
|
||||
@@ -319,22 +319,13 @@ Socket *CreateClientSocket(const char *host, uint16_t port, int timeoutMS)
|
||||
close(s);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
RDCDEBUG("connect before timeout");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RDCDEBUG("problem other than blocking");
|
||||
close(s);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RDCDEBUG("connected immediately");
|
||||
}
|
||||
|
||||
int nodelay = 1;
|
||||
setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *)&nodelay, sizeof(nodelay));
|
||||
|
||||
@@ -326,7 +326,7 @@ Socket *CreateClientSocket(const char *host, uint16_t port, int timeoutMS)
|
||||
timeval timeout;
|
||||
timeout.tv_sec = (timeoutMS / 1000);
|
||||
timeout.tv_usec = (timeoutMS % 1000) * 1000;
|
||||
result = select(0, NULL, &set, NULL, &timeout);
|
||||
result = select((int)s + 1, NULL, &set, NULL, &timeout);
|
||||
|
||||
if(result <= 0)
|
||||
{
|
||||
@@ -334,22 +334,13 @@ Socket *CreateClientSocket(const char *host, uint16_t port, int timeoutMS)
|
||||
closesocket(s);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
RDCDEBUG("connect before timeout");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RDCDEBUG("problem other than blocking");
|
||||
closesocket(s);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RDCDEBUG("connected immediately");
|
||||
}
|
||||
|
||||
BOOL nodelay = TRUE;
|
||||
setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (const char *)&nodelay, sizeof(nodelay));
|
||||
|
||||
Reference in New Issue
Block a user