mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-09-04 03:35:19 +02:00
Merge pull request #11004 from unknownbrackets/ipv6
Enable IPv6 for reporting / sharing / etc.
This commit is contained in:
+25
-4
@@ -71,13 +71,34 @@ static void RegisterServer(int port) {
|
||||
http::Client http;
|
||||
Buffer theVoid;
|
||||
|
||||
if (http.Resolve(REPORT_HOSTNAME, REPORT_PORT)) {
|
||||
char resource4[1024] = {};
|
||||
if (http.Resolve(REPORT_HOSTNAME, REPORT_PORT, net::DNSType::IPV4)) {
|
||||
if (http.Connect(2, 20.0, &scanCancelled)) {
|
||||
char resource[1024] = {};
|
||||
std::string ip = fd_util::GetLocalIP(http.sock());
|
||||
snprintf(resource, sizeof(resource) - 1, "/match/update?local=%s&port=%d", ip.c_str(), port);
|
||||
snprintf(resource4, sizeof(resource4) - 1, "/match/update?local=%s&port=%d", ip.c_str(), port);
|
||||
|
||||
http.GET(resource, &theVoid);
|
||||
http.GET(resource4, &theVoid);
|
||||
theVoid.Skip(theVoid.size());
|
||||
http.Disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
if (http.Resolve(REPORT_HOSTNAME, REPORT_PORT, net::DNSType::IPV6)) {
|
||||
// We register both IPv4 and IPv6 in case the other client is using a different one.
|
||||
if (resource4[0] != 0 && http.Connect()) {
|
||||
http.GET(resource4, &theVoid);
|
||||
theVoid.Skip(theVoid.size());
|
||||
http.Disconnect();
|
||||
}
|
||||
|
||||
// Currently, we're not using keepalive, so gotta reconnect...
|
||||
if (http.Connect()) {
|
||||
char resource6[1024] = {};
|
||||
std::string ip = fd_util::GetLocalIP(http.sock());
|
||||
snprintf(resource6, sizeof(resource6) - 1, "/match/update?local=%s&port=%d", ip.c_str(), port);
|
||||
|
||||
http.GET(resource6, &theVoid);
|
||||
theVoid.Skip(theVoid.size());
|
||||
http.Disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user