mirror of
https://github.com/moonlight-stream/Internet-Hosting-Tool.git
synced 2025-07-03 08:15:40 +00:00
Retransmit UDP test packets a few times to be safe
This commit is contained in:
parent
069b0c7656
commit
b1a1352bbf
@ -338,6 +338,9 @@ PortTestStatus TestPort(PSOCKADDR_STORAGE addr, int proto, int port, bool withSe
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const char testMsg[] = "moonlight-test";
|
const char testMsg[] = "moonlight-test";
|
||||||
|
|
||||||
|
// Send several test packets to ensure a random lost packet doesn't make the test fail
|
||||||
|
for (int i = 0; i < 5; i++) {
|
||||||
err = sendto(clientSock, testMsg, sizeof(testMsg), 0, (struct sockaddr*)&sin6, addrLen);
|
err = sendto(clientSock, testMsg, sizeof(testMsg), 0, (struct sockaddr*)&sin6, addrLen);
|
||||||
if (err == SOCKET_ERROR) {
|
if (err == SOCKET_ERROR) {
|
||||||
fprintf(LOG_OUT, "sendto() failed: %d\n", WSAGetLastError());
|
fprintf(LOG_OUT, "sendto() failed: %d\n", WSAGetLastError());
|
||||||
@ -346,6 +349,9 @@ PortTestStatus TestPort(PSOCKADDR_STORAGE addr, int proto, int port, bool withSe
|
|||||||
return PortTestError;
|
return PortTestError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Sleep(200);
|
||||||
|
}
|
||||||
|
|
||||||
struct timeval timeout = {};
|
struct timeval timeout = {};
|
||||||
fd_set fds;
|
fd_set fds;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user