mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-15 07:20:31 +02:00
net: Support ipv6 lookups.
We try to connect() to both, so should still be safe in environments where ipv6 is broken.
This commit is contained in:
1 parent
07e178a2da
commit
ca4340b9e0
6 files changed
+33
-12
No files matched your search
+13
-3
@@ -69,11 +69,13 @@ static ServerStatus RetrieveStatus() {
|
||||
// relay that address to a mobile device searching for the server.
|
||||
static void RegisterServer(int port) {
|
||||
http::Client http;
|
||||
Buffer theVoid;
|
||||
|
||||
if (http.Resolve(REPORT_HOSTNAME, REPORT_PORT)) {
|
||||
char resource[1024] = {};
|
||||
// We register both IPv4 and IPv6 in case the other client is using a different one.
|
||||
// Our server is (currently?) ipv4 only, so we always register the ipv4 local for now.
|
||||
if (http.Resolve(REPORT_HOSTNAME, REPORT_PORT, net::DNSType::IPV4)) {
|
||||
Buffer theVoid;
|
||||
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);
|
||||
|
||||
@@ -81,6 +83,14 @@ static void RegisterServer(int port) {
|
||||
http.Disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
if (http.Resolve(REPORT_HOSTNAME, REPORT_PORT, net::DNSType::IPV6)) {
|
||||
Buffer theVoid;
|
||||
if (http.Connect()) {
|
||||
http.GET(resource, &theVoid);
|
||||
http.Disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ExecuteServer() {
|
||||
|
||||
Reference in new issue
Block a user