fix a bug when closing RS for upnp

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1803 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
joss17 2009-11-10 17:17:05 +00:00
parent af1d165559
commit a444484734

View File

@ -200,11 +200,6 @@ bool upnphandler::shutdown_upnp()
{ {
RsStackMutex stack(dataMtx); /* LOCK STACK MUTEX */ RsStackMutex stack(dataMtx); /* LOCK STACK MUTEX */
//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) */ /* always attempt this (unless no port number) */
if (eport_curr > 0 && eport > 0 && (upnpState >= RS_UPNP_S_ACTIVE)) if (eport_curr > 0 && eport > 0 && (upnpState >= RS_UPNP_S_ACTIVE))
{ {
@ -232,13 +227,17 @@ bool upnphandler::shutdown_upnp()
//destroy the upnp object //destroy the upnp object
cUPnPControlPoint->~CUPnPControlPoint(); cUPnPControlPoint->~CUPnPControlPoint();
upnpState = RS_UPNP_S_UNINITIALISED;
} else { } else {
#ifdef UPNP_DEBUG #ifdef UPNP_DEBUG
std::cerr << "upnphandler::shutdown_upnp() : avoid upnp connection for shutdonws because probably a net flag went down." << std::endl; std::cerr << "upnphandler::shutdown_upnp() : avoid upnp connection for shutdonws because probably a net flag went down." << std::endl;
#endif #endif
} }
//stopping os ok, set starting to true for next net reset
toStop = false;
toStart = true;
upnpState = RS_UPNP_S_UNINITIALISED;
return true; return true;
} }
@ -298,7 +297,7 @@ void upnphandler::enable(bool active)
void upnphandler::shutdown() void upnphandler::shutdown()
{ {
/* blocking call to shutdown upnp */ /* blocking call to shutdown upnp */
std::cerr << "upnphandler::shutdown() called." << std::endl;
shutdown_upnp(); shutdown_upnp();
} }