[Redirector] Optimize code

This commit is contained in:
Connection Refused
2021-10-15 01:54:39 +08:00
parent 91b6692cfb
commit 19ff231f95
4 changed files with 47 additions and 57 deletions

View File

@@ -348,10 +348,10 @@ void udpSend(ENDPOINT_ID id, const unsigned char* target, const char* buffer, in
if (!remote->CreateUDP())
return;
auto data = (PNF_UDP_OPTIONS)new char[sizeof(NF_UDP_OPTIONS) + options->optionsLength]();
memcpy(data, options, sizeof(NF_UDP_OPTIONS) + options->optionsLength - 1);
auto option = (PNF_UDP_OPTIONS)new char[sizeof(NF_UDP_OPTIONS) + options->optionsLength]();
memcpy(option, options, sizeof(NF_UDP_OPTIONS) + options->optionsLength - 1);
thread(udpReceiveHandler, id, remote, data).detach();
thread(udpReceiveHandler, id, remote, option).detach();
}
if (remote->Send((PSOCKADDR_IN6)target, buffer, length) != length)