Merge pull request #8538 from def-/pr-upnp

Support new UPNP API
This commit is contained in:
heinrich5991 2024-07-01 22:56:06 +00:00 committed by GitHub
commit 9ccb87bf6b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -25,8 +25,14 @@ void CUPnP::Open(NETADDR Address)
m_pUPnPDevice = upnpDiscover(2000, NULL, NULL, 0, 0, 2, &Error);
#if MINIUPNPC_API_VERSION > 17
char aWanAddr[64];
int Status = UPNP_GetValidIGD(m_pUPnPDevice, m_pUPnPUrls, m_pUPnPData, aLanAddr, sizeof(aLanAddr), aWanAddr, sizeof(aWanAddr));
dbg_msg("upnp", "status=%d, lan_addr=%s, wan_addr=%s", Status, aLanAddr, aWanAddr);
#else
int Status = UPNP_GetValidIGD(m_pUPnPDevice, m_pUPnPUrls, m_pUPnPData, aLanAddr, sizeof(aLanAddr));
dbg_msg("upnp", "status=%d, lan_addr=%s", Status, aLanAddr);
#endif
if(Status == 1)
{