mirror of
https://github.com/moonlight-stream/Internet-Hosting-Tool.git
synced 2026-06-20 07:31:22 +00:00
Remove superfluous select() call
This commit is contained in:
+4
-14
@@ -19,8 +19,6 @@ WINAPI
|
|||||||
UdpRelayThreadProc(LPVOID Context)
|
UdpRelayThreadProc(LPVOID Context)
|
||||||
{
|
{
|
||||||
PUDP_TUPLE tuple = (PUDP_TUPLE)Context;
|
PUDP_TUPLE tuple = (PUDP_TUPLE)Context;
|
||||||
fd_set fds;
|
|
||||||
int err;
|
|
||||||
SOCKADDR_IN lastRemoteAddr;
|
SOCKADDR_IN lastRemoteAddr;
|
||||||
|
|
||||||
RtlZeroMemory(&lastRemoteAddr, sizeof(lastRemoteAddr));
|
RtlZeroMemory(&lastRemoteAddr, sizeof(lastRemoteAddr));
|
||||||
@@ -29,19 +27,11 @@ UdpRelayThreadProc(LPVOID Context)
|
|||||||
char buffer[4096];
|
char buffer[4096];
|
||||||
SOCKADDR_IN sourceAddr;
|
SOCKADDR_IN sourceAddr;
|
||||||
int sourceAddrLen;
|
int sourceAddrLen;
|
||||||
|
int recvLen;
|
||||||
FD_ZERO(&fds);
|
|
||||||
|
|
||||||
FD_SET(tuple->socket, &fds);
|
|
||||||
|
|
||||||
err = select(0, &fds, NULL, NULL, NULL);
|
|
||||||
if (err <= 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceAddrLen = sizeof(sourceAddr);
|
sourceAddrLen = sizeof(sourceAddr);
|
||||||
err = recvfrom(tuple->socket, buffer, sizeof(buffer), 0, (PSOCKADDR)&sourceAddr, &sourceAddrLen);
|
recvLen = recvfrom(tuple->socket, buffer, sizeof(buffer), 0, (PSOCKADDR)&sourceAddr, &sourceAddrLen);
|
||||||
if (err == SOCKET_ERROR) {
|
if (recvLen == SOCKET_ERROR) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,7 +50,7 @@ UdpRelayThreadProc(LPVOID Context)
|
|||||||
destinationAddr.sin_port = htons(tuple->port);
|
destinationAddr.sin_port = htons(tuple->port);
|
||||||
}
|
}
|
||||||
|
|
||||||
sendto(tuple->socket, buffer, err, 0, (PSOCKADDR)&destinationAddr, sizeof(destinationAddr));
|
sendto(tuple->socket, buffer, recvLen, 0, (PSOCKADDR)&destinationAddr, sizeof(destinationAddr));
|
||||||
}
|
}
|
||||||
|
|
||||||
closesocket(tuple->socket);
|
closesocket(tuple->socket);
|
||||||
|
|||||||
Reference in New Issue
Block a user