C4NetIO: mac: To be on the safe side, only activate poll timeout cap when APPLE

stable-5.4
Martin Plicht 2014-02-16 10:53:06 +01:00
parent f90e67d4ca
commit d63ea57e5f
1 changed files with 6 additions and 0 deletions

View File

@ -385,12 +385,14 @@ bool C4NetIOTCP::CloseBroadcast()
return true;
}
#ifdef APPLE
static int fix_poll_timeout(int timeout) {
if (timeout < 0 || timeout > 1000)
return 1000;
else
return timeout;
}
#endif
bool C4NetIOTCP::Execute(int iMaxTime, pollfd *fds) // (mt-safe)
{
@ -407,7 +409,9 @@ bool C4NetIOTCP::Execute(int iMaxTime, pollfd *fds) // (mt-safe)
WSANETWORKEVENTS wsaEvents;
#else
#ifdef APPLE
iMaxTime = fix_poll_timeout(iMaxTime);
#endif
std::vector<pollfd> fdvec;
std::map<SOCKET, const pollfd*> fdmap;
@ -1520,7 +1524,9 @@ bool C4NetIOSimpleUDP::Execute(int iMaxTime, pollfd *)
if (!fInit) { SetError("not yet initialized"); return false; }
ResetError();
#ifdef APPLE
iMaxTime = fix_poll_timeout(iMaxTime);
#endif
// wait for socket / timeout
WaitResult eWR = WaitForSocket(iMaxTime);