Silence excessive debugging in miniupnp handler

This commit is contained in:
Gioacchino Mazzurco 2020-03-08 22:07:12 +01:00
parent 8a2508109a
commit 57be2cb11e
No known key found for this signature in database
GPG Key ID: A1FBCA3872E87051
2 changed files with 12 additions and 17 deletions

View File

@ -642,14 +642,10 @@ void upnphandler::setExternalPort(unsigned short eport_in)
dataMtx.unlock(); /*** UNLOCK MUTEX ***/ dataMtx.unlock(); /*** UNLOCK MUTEX ***/
} }
/* as determined by uPnP */ /* as determined by uPnP */
bool upnphandler::getInternalAddress(struct sockaddr_storage &addr) bool upnphandler::getInternalAddress(struct sockaddr_storage &addr)
{ {
// std::cerr << "UPnPHandler::getInternalAddress() pre Lock!" << std::endl; RS_STACK_MUTEX(dataMtx);
dataMtx.lock(); /*** LOCK MUTEX ***/
// std::cerr << "UPnPHandler::getInternalAddress() postLock!" << std::endl;
std::cerr << "UPnPHandler::getInternalAddress()" << std::endl;
// copy to universal addr. // copy to universal addr.
sockaddr_storage_clear(addr); sockaddr_storage_clear(addr);
@ -657,18 +653,15 @@ bool upnphandler::getInternalAddress(struct sockaddr_storage &addr)
bool valid = (upnpState >= RS_UPNP_S_ACTIVE); bool valid = (upnpState >= RS_UPNP_S_ACTIVE);
dataMtx.unlock(); /*** UNLOCK MUTEX ***/ Dbg2() << __PRETTY_FUNCTION__ << " valid: " << valid
<< " addr: " << addr << std::endl;
return valid; return valid;
} }
bool upnphandler::getExternalAddress(struct sockaddr_storage &addr) bool upnphandler::getExternalAddress(sockaddr_storage &addr)
{ {
// std::cerr << "UPnPHandler::getExternalAddress() pre Lock!" << std::endl; RS_STACK_MUTEX(dataMtx);
dataMtx.lock(); /*** LOCK MUTEX ***/
// std::cerr << "UPnPHandler::getExternalAddress() postLock!" << std::endl;
std::cerr << "UPnPHandler::getExternalAddress()" << std::endl;
// copy to universal addr. // copy to universal addr.
sockaddr_storage_clear(addr); sockaddr_storage_clear(addr);
@ -676,7 +669,8 @@ bool upnphandler::getExternalAddress(struct sockaddr_storage &addr)
bool valid = (upnpState == RS_UPNP_S_ACTIVE); bool valid = (upnpState == RS_UPNP_S_ACTIVE);
dataMtx.unlock(); /*** UNLOCK MUTEX ***/ Dbg2() << __PRETTY_FUNCTION__ << " valid: " << valid
<< " addr: " << addr << std::endl;
return valid; return valid;
} }

View File

@ -28,7 +28,7 @@
/* platform independent networking... */ /* platform independent networking... */
#include "pqi/pqinetwork.h" #include "pqi/pqinetwork.h"
#include "pqi/pqiassist.h" #include "pqi/pqiassist.h"
#include "util/rsdebug.h"
#include "util/rsthreads.h" #include "util/rsthreads.h"
class upnpentry class upnpentry
@ -97,7 +97,7 @@ bool shutdown_upnp();
bool initUPnPState(); bool initUPnPState();
bool printUPnPState(); bool printUPnPState();
private: private:
bool background_setup_upnp(bool, bool); bool background_setup_upnp(bool, bool);
bool checkUPnPActive(); bool checkUPnPActive();
@ -123,4 +123,5 @@ bool checkUPnPActive();
/* active port forwarding */ /* active port forwarding */
std::list<upnpforward> activeForwards; std::list<upnpforward> activeForwards;
RS_SET_CONTEXT_DEBUG_LEVEL(1)
}; };