[Redirector] Add DNS timeout

This commit is contained in:
Connection Refused
2021-10-14 19:03:42 +08:00
parent 06f215cedf
commit 1bc80b71b4
3 changed files with 17 additions and 3 deletions

View File

@@ -23,7 +23,10 @@ void ProcessPacket(ENDPOINT_ID id, SOCKADDR_IN6 target, char* packet, int length
{
if (udpConn.Send(&dnsAddr, packet, length) == length)
{
int size = udpConn.Read(NULL, buffer, sizeof(buffer));
timeval timeout;
timeout.tv_sec = 4;
int size = udpConn.Read(NULL, buffer, sizeof(buffer), &timeout);
if (size != 0 && size != SOCKET_ERROR)
{
nf_udpPostReceive(id, (unsigned char*)&target, buffer, size, option);