Minimize SendTo and Read Socket Timeout Delays

SendTo and Read were using longer than necessary socket timeouts that may add to process time delay and stuttering.  They were also using different values between Window and Linux/Mac.  The timeouts are now standardized for all versions and coded in the same manner as the xplaneConnect.c functions.
This commit is contained in:
Norman Princen
2020-05-12 19:06:28 -07:00
committed by GitHub
parent 4241599ad7
commit 1f78a23351

View File

@@ -95,9 +95,9 @@ namespace XPC
// Without this, playback may become choppy due to process blocking
// Definitions
FD_SET stReadFDS;
FD_SET stExceptFDS;
timeval tv;
fd_set stReadFDS;
fd_set stExceptFDS;
struct timeval timeout;
// Setup for Select
FD_ZERO(&stReadFDS);
@@ -106,11 +106,11 @@ namespace XPC
FD_SET(sock, &stExceptFDS);
// Set timeout period for select to 0 to poll the socket
tv.tv_sec = 0;
tv.tv_usec = 0;
timeout.tv_sec = 0;
timeout.tv_usec = 0;
// Select Command
int status = select(-1, &stReadFDS, (FD_SET*)0, &stExceptFDS, &tv);
int status = select(sock+1, &stReadFDS, NULL, &stExceptFDS, &timeout);
if (status < 0)
{
#ifdef _WIN32