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:
committed by
Jason Watkins
parent
a53c39a1a8
commit
3c43517e44
@@ -432,24 +432,25 @@ int getDREFResponse(XPCSocket sock, float* values[], unsigned char count, int si
|
|||||||
// Read data. Try 40 times to read, then give up.
|
// Read data. Try 40 times to read, then give up.
|
||||||
// TODO: Why not just set the timeout to 40ms?
|
// TODO: Why not just set the timeout to 40ms?
|
||||||
int result;
|
int result;
|
||||||
for (int i = 0; i < 512; ++i)
|
for (int i = 0; i < 40; ++i)
|
||||||
{
|
{
|
||||||
result = readUDP(sock, buffer, 65536);
|
result = readUDP(sock, buffer, 65536);
|
||||||
if (result > 0)
|
if (result > 0)
|
||||||
{
|
{
|
||||||
break;
|
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)
|
if (result < 6)
|
||||||
{
|
{
|
||||||
printError("getDREFs", "Response was too short. Expected at least 6 bytes, but only got %d.", result);
|
printError("getDREFs", "Response was too short. Expected at least 6 bytes, but only got %d.", result);
|
||||||
|
|||||||
Reference in New Issue
Block a user