mirror of
https://github.com/moonlight-stream/Internet-Hosting-Tool.git
synced 2026-06-19 07:01:02 +00:00
Always run the loopback server test
It appears that in rare cases NAT reflection can work where real WAN traffic fails
This commit is contained in:
+5
-18
@@ -1283,19 +1283,11 @@ int main(int argc, char* argv[])
|
|||||||
// Go directly to the relay check if we have only IPv6 connectivity
|
// Go directly to the relay check if we have only IPv6 connectivity
|
||||||
igdDisconnected = false;
|
igdDisconnected = false;
|
||||||
locallyReportedWanAddr = {};
|
locallyReportedWanAddr = {};
|
||||||
goto RelayCheck;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to connect via WAN IPv4 address
|
|
||||||
fprintf(LOG_OUT, "Testing GameStream ports via STUN-reported WAN address\n");
|
|
||||||
if (!TestAllPorts(&ss, portMsgBuf, sizeof(portMsgBuf), false, true)) {
|
|
||||||
RelayCheck:
|
|
||||||
struct addrinfo hint = {};
|
struct addrinfo hint = {};
|
||||||
struct addrinfo* result;
|
struct addrinfo* result;
|
||||||
|
|
||||||
// We can get here if the router doesn't support NAT reflection.
|
|
||||||
// We'll need to call out to our loopback server to get a second opinion.
|
|
||||||
|
|
||||||
hint.ai_family = AF_UNSPEC;
|
hint.ai_family = AF_UNSPEC;
|
||||||
hint.ai_flags = AI_ADDRCONFIG;
|
hint.ai_flags = AI_ADDRCONFIG;
|
||||||
err = getaddrinfo("loopback.moonlight-stream.org", NULL, &hint, &result);
|
err = getaddrinfo("loopback.moonlight-stream.org", NULL, &hint, &result);
|
||||||
@@ -1312,7 +1304,11 @@ int main(int argc, char* argv[])
|
|||||||
fprintf(CONSOLE_OUT, "Testing GameStream connectivity over the Internet using a relay server...\n");
|
fprintf(CONSOLE_OUT, "Testing GameStream connectivity over the Internet using a relay server...\n");
|
||||||
if (TestAllPorts((PSOCKADDR_STORAGE)current->ai_addr, portMsgBuf, sizeof(portMsgBuf), true, true, &allPortsFailedOnV4)) {
|
if (TestAllPorts((PSOCKADDR_STORAGE)current->ai_addr, portMsgBuf, sizeof(portMsgBuf), true, true, &allPortsFailedOnV4)) {
|
||||||
freeaddrinfo(result);
|
freeaddrinfo(result);
|
||||||
goto AllTestsPassed;
|
snprintf(msgBuf, sizeof(msgBuf), "This PC is ready to host over the Internet!\n\n"
|
||||||
|
"For the easiest setup, you should pair Moonlight to your gaming PC from your home network before trying to stream over the Internet.\n\n"
|
||||||
|
"If you can't, you can type the following address into Moonlight's Add PC dialog: %s", wanAddrStr);
|
||||||
|
DisplayMessage(msgBuf, nullptr, MpInfo);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1371,13 +1367,4 @@ int main(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
AllTestsPassed:
|
|
||||||
snprintf(msgBuf, sizeof(msgBuf), "This PC is ready to host over the Internet!\n\n"
|
|
||||||
"For the easiest setup, you should pair Moonlight to your gaming PC from your home network before trying to stream over the Internet.\n\n"
|
|
||||||
"If you can't, you can type the following address into Moonlight's Add PC dialog: %s", wanAddrStr);
|
|
||||||
DisplayMessage(msgBuf, nullptr, MpInfo);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user