update miniupnp to miniupnpc_2_2_8

This commit is contained in:
Green Sky 2024-07-18 15:34:05 +02:00
parent 30a22fd933
commit 60a66c7fac
No known key found for this signature in database
2 changed files with 10 additions and 3 deletions

View File

@ -18,7 +18,7 @@ if (NOT TARGET miniupnpc::miniupnpc)
set(UPNPC_NO_INSTALL ON CACHE BOOL "" FORCE) set(UPNPC_NO_INSTALL ON CACHE BOOL "" FORCE)
FetchContent_Declare(miniupnpc FetchContent_Declare(miniupnpc
GIT_REPOSITORY https://github.com/miniupnp/miniupnp.git GIT_REPOSITORY https://github.com/miniupnp/miniupnp.git
GIT_TAG miniupnpc_2_2_7 # meh GIT_TAG miniupnpc_2_2_8 # meh
SOURCE_SUBDIR miniupnpc SOURCE_SUBDIR miniupnpc
) )
FetchContent_MakeAvailable(miniupnpc) FetchContent_MakeAvailable(miniupnpc)

View File

@ -26,6 +26,7 @@ ToxUPnP::ToxUPnP(ToxI& tox) {
UPNPUrls urls { nullptr, nullptr, nullptr, nullptr, nullptr, }; UPNPUrls urls { nullptr, nullptr, nullptr, nullptr, nullptr, };
IGDdatas data; IGDdatas data;
char lanaddr[64] = "unset"; char lanaddr[64] = "unset";
char wanaddr[64] = "unset";
while (!_quit) { while (!_quit) {
if (seconds_since_last < 60*60) { if (seconds_since_last < 60*60) {
@ -49,7 +50,13 @@ ToxUPnP::ToxUPnP(ToxI& tox) {
std::cerr << " " << d->descURL << " " << d->st << " " << d->usn << "\n"; std::cerr << " " << d->descURL << " " << d->st << " " << d->usn << "\n";
} }
auto res = UPNP_GetValidIGD(devices.get(), &urls, &data, lanaddr, sizeof(lanaddr)); auto res = UPNP_GetValidIGD(
devices.get(),
&urls,
&data,
lanaddr, sizeof(lanaddr),
wanaddr, sizeof(wanaddr)
);
if (res < 1) { if (res < 1) {
std::cerr << "TUPNP error: no valid connected IGD has been found\n"; std::cerr << "TUPNP error: no valid connected IGD has been found\n";
@ -60,7 +67,7 @@ ToxUPnP::ToxUPnP(ToxI& tox) {
continue; continue;
} }
std::cerr << "TUPNP: valid IGD found (" << res << "), local ip: " << lanaddr << "\n"; std::cerr << "TUPNP: valid IGD found (" << res << "), lan ip: " << lanaddr << ", wan ip: " << wanaddr << "\n";
break; break;
} }