Fix Bug in getDREF Response

Fix Bug- readUDP loop in getDREF Response only ran once no matter what.
This wasn’t enough time for the plugin to send a response.

Note: You can try increasing the timeout, but the plugin has to have a
socket with a timeout of 1ms or less. If the timeout is higher than
that a lag is introduced.
This commit is contained in:
Chris Teubert
2015-04-26 13:48:06 -07:00
committed by Jason Watkins
parent a53c39a1a8
commit 3c43517e44

View File

@@ -432,23 +432,24 @@ int getDREFResponse(XPCSocket sock, float* values[], unsigned char count, int si
// Read data. Try 40 times to read, then give up.
// TODO: Why not just set the timeout to 40ms?
int result;
for (int i = 0; i < 512; ++i)
for (int i = 0; i < 40; ++i)
{
result = readUDP(sock, buffer, 65536);
if (result > 0)
{
break;
}
if (result < 0)
{
#ifdef _WIN32
printError("getDREFs", "Read operation failed. (%d)", WSAGetLastError());
#else
printError("getDREFs", "Read operation failed.");
#endif
return -1;
}
}
if (result < 0)
{
#ifdef _WIN32
printError("getDREFs", "Read operation failed. (%d)", WSAGetLastError());
#else
printError("getDREFs", "Read operation failed.");
#endif
return -1;
}
if (result < 6)
{