mirror of
https://github.com/moonlight-stream/Internet-Hosting-Tool.git
synced 2026-02-16 02:20:52 +00:00
Elevate priorities for the UDP relay threads
This commit is contained in:
@@ -868,6 +868,10 @@ int Run()
|
||||
|
||||
ResetLogFile();
|
||||
|
||||
// Bump the process priority class to above normal. The UDP relay threads will
|
||||
// further raise their own thread priorities to avoid preemption by other activity.
|
||||
SetPriorityClass(GetCurrentProcess(), ABOVE_NORMAL_PRIORITY_CLASS);
|
||||
|
||||
// Create the UDP alternate port relays
|
||||
for (int i = 0; i < ARRAYSIZE(k_Ports); i++) {
|
||||
if (k_Ports[i].proto == IPPROTO_UDP) {
|
||||
|
||||
@@ -21,6 +21,9 @@ UdpRelayThreadProc(LPVOID Context)
|
||||
PUDP_TUPLE tuple = (PUDP_TUPLE)Context;
|
||||
SOCKADDR_IN lastRemoteAddr;
|
||||
|
||||
// Ensure the relay threads aren't preempted by games or other CPU intensive activity
|
||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
|
||||
|
||||
RtlZeroMemory(&lastRemoteAddr, sizeof(lastRemoteAddr));
|
||||
|
||||
for (;;) {
|
||||
|
||||
Reference in New Issue
Block a user