mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-12 19:12:28 -04:00
improving safe upnp shutdown
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1771 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
b99b99f0d5
commit
3ab1b5bb3f
2 changed files with 9 additions and 30 deletions
|
@ -191,11 +191,12 @@ bool upnphandler::shutdown_upnp()
|
|||
//stopping os ok, set starting to true for next net reset
|
||||
toStop = false;
|
||||
toStart = true;
|
||||
upnpState = RS_UPNP_S_UNINITIALISED;
|
||||
|
||||
/* always attempt this (unless no port number) */
|
||||
if (eport_curr > 0 && eport > 0)
|
||||
if (eport_curr > 0 && eport > 0 && (upnpState >= RS_UPNP_S_ACTIVE))
|
||||
{
|
||||
std::cerr << "Attempting To Remove Redirection: port: " << eport_curr;
|
||||
std::cerr << "upnphandler::shutdown_upnp() : Attempting To Remove Redirection: port: " << eport_curr;
|
||||
std::cerr << " Prot: TCP";
|
||||
std::cerr << std::endl;
|
||||
|
||||
|
@ -204,7 +205,7 @@ bool upnphandler::shutdown_upnp()
|
|||
upnpPortMapping1.push_back(cUPnPPortMapping1);
|
||||
cUPnPControlPoint->DeletePortMappings(upnpPortMapping1);
|
||||
|
||||
std::cerr << "Attempting To Remove Redirection: port: " << eport_curr;
|
||||
std::cerr << " : Attempting To Remove Redirection: port: " << eport_curr;
|
||||
std::cerr << " Prot: UDP";
|
||||
std::cerr << std::endl;
|
||||
|
||||
|
@ -216,6 +217,10 @@ bool upnphandler::shutdown_upnp()
|
|||
//destroy the upnp object
|
||||
cUPnPControlPoint->~CUPnPControlPoint();
|
||||
upnpState = RS_UPNP_S_UNINITIALISED;
|
||||
} else {
|
||||
#ifdef CONN_DEBUG
|
||||
std::cerr << "upnphandler::shutdown_upnp() : avoid upnp connection for shutdows A net flag went down." << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue