mirror of
https://bitbucket.org/King_DuckZ/keepupnpup.git
synced 2024-11-07 21:29:00 +00:00
Add verbosity in debug.
This commit is contained in:
parent
1d35e84cb4
commit
e2ff673710
1 changed files with 23 additions and 4 deletions
27
src/upnp.cpp
27
src/upnp.cpp
|
@ -35,6 +35,20 @@
|
|||
|
||||
namespace kuu {
|
||||
namespace {
|
||||
void freeUPNPDevlist (struct UPNPDev* parDele) {
|
||||
#if defined(KUU_VERBOSE)
|
||||
std::cout << "Deleting UPNPDev " << parDele << '\n';
|
||||
#endif
|
||||
::freeUPNPDevlist(parDele);
|
||||
}
|
||||
|
||||
void FreeUPNPUrls (struct UPNPUrls* parDele) {
|
||||
#if defined(KUU_VERBOSE)
|
||||
std::cout << "Deleting UPNPUrls " << parDele << '\n';
|
||||
#endif
|
||||
::FreeUPNPUrls(parDele);
|
||||
}
|
||||
|
||||
struct UPNPUrlsWithInitFlag {
|
||||
UPNPUrlsWithInitFlag() : initialized(false) {}
|
||||
struct UPNPUrls urls;
|
||||
|
@ -50,7 +64,7 @@ namespace kuu {
|
|||
void operator() (UPNPUrlsWithInitFlag& parUrls) {
|
||||
if (parUrls.initialized) {
|
||||
parUrls.initialized = false;
|
||||
FreeUPNPUrls(&parUrls.urls);
|
||||
kuu::FreeUPNPUrls(&parUrls.urls);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -112,7 +126,6 @@ namespace kuu {
|
|||
std::cout << "External ip address: " << parExternalAddr << '\n';
|
||||
}
|
||||
#endif
|
||||
|
||||
} //unnamed namespace
|
||||
|
||||
struct UPNP::LocalData {
|
||||
|
@ -121,10 +134,16 @@ namespace kuu {
|
|||
lanaddr(),
|
||||
externaladdr(),
|
||||
igd_reply(IGDNone),
|
||||
devlist(nullptr, &freeUPNPDevlist)
|
||||
devlist(nullptr, &kuu::freeUPNPDevlist)
|
||||
{
|
||||
}
|
||||
|
||||
~LocalData() noexcept {
|
||||
#if defined(KUU_VERBOSE)
|
||||
std::cout << "Destroying LocalData " << this << '\n';
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string lanaddr;
|
||||
std::string externaladdr;
|
||||
struct IGDdatas data;
|
||||
|
@ -147,7 +166,7 @@ namespace kuu {
|
|||
2, //ttl
|
||||
&error
|
||||
),
|
||||
&freeUPNPDevlist
|
||||
&kuu::freeUPNPDevlist
|
||||
);
|
||||
if (error)
|
||||
throw UPNPException(error, "Error initializing upnpc in upnpDiscover()", nullptr);
|
||||
|
|
Loading…
Reference in a new issue