Fix build with miniupnpc 2.2.8

See
https://github.com/miniupnp/miniupnp/blob/miniupnpc_2_2_8/miniupnpc/Changelog.txt.
And https://github.com/0ad/0ad/pull/45

Patch by: @emily
Accepted: by @Stan
Comments by: @phosit, @sera
Differential Revision: https://code.wildfiregames.com/D5307
This was SVN commit r28167.
This commit is contained in:
Stan
2024-07-30 18:44:38 +00:00
parent 4256666fb1
commit 38e3f5cec0
2 changed files with 18 additions and 2 deletions
+17 -2
View File
@@ -252,7 +252,11 @@ void CNetServerWorker::SetupUPnP()
else if ((devlist = upnpDiscover(10000, 0, 0, 0, 0, 0)) != NULL)
#endif
{
#if defined(MINIUPNPC_API_VERSION) && MINIUPNPC_API_VERSION >= 18
ret = UPNP_GetValidIGD(devlist, &urls, &data, internalIPAddress, sizeof(internalIPAddress), nullptr, 0);
#else
ret = UPNP_GetValidIGD(devlist, &urls, &data, internalIPAddress, sizeof(internalIPAddress));
#endif
allocatedUrls = ret != 0; // urls is allocated on non-zero return values
}
else
@@ -270,17 +274,28 @@ void CNetServerWorker::SetupUPnP()
case 1:
LOGMESSAGE("Net server: found valid IGD = %s", urls.controlURL);
break;
#if defined(MINIUPNPC_API_VERSION) && MINIUPNPC_API_VERSION >= 18
case 2:
LOGMESSAGE("Net server: found a valid, not connected IGD = %s, will try to continue anyway", urls.controlURL);
LOGMESSAGE("Net server: found IGD with reserved IP = %s, will try to continue anyway", urls.controlURL);
break;
case 3:
#else
case 2:
#endif
LOGMESSAGE("Net server: found a valid, not connected IGD = %s, will try to continue anyway", urls.controlURL);
break;
#if defined(MINIUPNPC_API_VERSION) && MINIUPNPC_API_VERSION >= 18
case 4:
#else
case 3:
#endif
LOGMESSAGE("Net server: found a UPnP device unrecognized as IGD = %s, will try to continue anyway", urls.controlURL);
break;
default:
debug_warn(L"Unrecognized return value from UPNP_GetValidIGD");
}
// Try getting our external/internet facing IP. TODO: Display this on the game-setup page for conviniance.
// Try getting our external/internet facing IP. TODO: Display this on the game-setup page for convenience.
ret = UPNP_GetExternalIPAddress(urls.controlURL, data.first.servicetype, externalIPAddress);
if (ret != UPNPCOMMAND_SUCCESS)
{