mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Bug which causes net reset solved
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1770 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
2e5130a1da
commit
b99b99f0d5
@ -700,19 +700,14 @@ void p3ConnectMgr::networkConsistencyCheck()
|
||||
bool doNetReset = false;
|
||||
//if one of the flag is degrated from true to false during last tick, let's do a reset
|
||||
//storing old flags
|
||||
// #ifdef CONN_DEBUG
|
||||
// std::cerr << "p3ConnectMgr::networkConsistencyCheck() net flags : " << std::endl;
|
||||
// std::cerr << " oldnetFlagLocalOk : " << oldnetFlagLocalOk << ". netFlagLocalOk : " << netFlagLocalOk << "." << std::endl;
|
||||
// std::cerr << " oldnetFlagUpnpOk : " << oldnetFlagUpnpOk << ". netFlagUpnpOk : " << netFlagUpnpOk << "." << std::endl;
|
||||
// std::cerr << " oldnetFlagDhtOk : " << oldnetFlagDhtOk << ". netFlagDhtOk : " << netFlagDhtOk << "." << std::endl;
|
||||
// std::cerr << " oldnetFlagStunOk : " << oldnetFlagStunOk << ". netFlagStunOk : " << netFlagStunOk << "." << std::endl;
|
||||
// std::cerr << " oldnetFlagExtraAddressCheckOk : " << oldnetFlagExtraAddressCheckOk << ". netFlagExtraAddressCheckOk : " << netFlagExtraAddressCheckOk << "." << std::endl;
|
||||
// #endif
|
||||
oldnetFlagLocalOk = netFlagLocalOk;
|
||||
oldnetFlagUpnpOk = netFlagUpnpOk;
|
||||
oldnetFlagDhtOk = netFlagDhtOk;
|
||||
oldnetFlagStunOk = netFlagStunOk;
|
||||
oldnetFlagExtraAddressCheckOk = netFlagExtraAddressCheckOk;
|
||||
#ifdef CONN_DEBUG
|
||||
std::cerr << "p3ConnectMgr::networkConsistencyCheck() net flags : " << std::endl;
|
||||
std::cerr << " oldnetFlagLocalOk : " << oldnetFlagLocalOk << ". netFlagLocalOk : " << netFlagLocalOk << "." << std::endl;
|
||||
std::cerr << " oldnetFlagUpnpOk : " << oldnetFlagUpnpOk << ". netFlagUpnpOk : " << netFlagUpnpOk << "." << std::endl;
|
||||
std::cerr << " oldnetFlagDhtOk : " << oldnetFlagDhtOk << ". netFlagDhtOk : " << netFlagDhtOk << "." << std::endl;
|
||||
std::cerr << " oldnetFlagStunOk : " << oldnetFlagStunOk << ". netFlagStunOk : " << netFlagStunOk << "." << std::endl;
|
||||
std::cerr << " oldnetFlagExtraAddressCheckOk : " << oldnetFlagExtraAddressCheckOk << ". netFlagExtraAddressCheckOk : " << netFlagExtraAddressCheckOk << "." << std::endl;
|
||||
#endif
|
||||
if ((!netFlagLocalOk && oldnetFlagLocalOk)
|
||||
|| (!netFlagUpnpOk && oldnetFlagUpnpOk)
|
||||
|| (!netFlagDhtOk && oldnetFlagDhtOk)
|
||||
@ -722,6 +717,11 @@ void p3ConnectMgr::networkConsistencyCheck()
|
||||
#ifdef CONN_DEBUG
|
||||
std::cerr << "p3ConnectMgr::networkConsistencyCheck() A net flag went down." << std::endl;
|
||||
#endif
|
||||
|
||||
//don't do a normal shutdown for upnp as it might hang up.
|
||||
//With a 0 port it will just dereference and not attemps to communicate for shutting upnp session.
|
||||
netAssistFirewallPorts(0, 0);
|
||||
|
||||
doNetReset = true;
|
||||
}
|
||||
|
||||
|
@ -573,7 +573,6 @@ private:
|
||||
|
||||
public:
|
||||
CUPnPService *m_WanService;
|
||||
RsMutex m_getStateVariableMutex;
|
||||
std::string m_getStateVariableLastResult;
|
||||
static CUPnPControlPoint *s_CtrlPoint;
|
||||
CUPnPControlPoint(unsigned short udpPort);
|
||||
|
@ -106,9 +106,6 @@ bool upnphandler::start_upnp()
|
||||
return false;
|
||||
}
|
||||
|
||||
char eprot1[] = "TCP";
|
||||
char eprot2[] = "UDP";
|
||||
|
||||
struct sockaddr_in localAddr;
|
||||
{
|
||||
RsStackMutex stack(dataMtx); /* LOCK STACK MUTEX */
|
||||
@ -153,7 +150,7 @@ bool upnphandler::start_upnp()
|
||||
std::cerr << "Attempting Redirection: InAddr: " << in_addr;
|
||||
std::cerr << " InPort: " << in_port1;
|
||||
std::cerr << " ePort: " << eport1;
|
||||
std::cerr << " eProt: " << eprot1;
|
||||
std::cerr << " eProt: " << "TCP";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
@ -191,49 +188,34 @@ bool upnphandler::shutdown_upnp()
|
||||
{
|
||||
RsStackMutex stack(dataMtx); /* LOCK STACK MUTEX */
|
||||
|
||||
if (!(upnpState >= RS_UPNP_S_READY))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
char eprot1[] = "TCP";
|
||||
char eprot2[] = "UDP";
|
||||
//stopping os ok, set starting to true for next net reset
|
||||
toStop = false;
|
||||
toStart = true;
|
||||
|
||||
/* always attempt this (unless no port number) */
|
||||
if (eport_curr > 0)
|
||||
if (eport_curr > 0 && eport > 0)
|
||||
{
|
||||
|
||||
char eport1[256];
|
||||
char eport2[256];
|
||||
|
||||
snprintf(eport1, 256, "%d", eport_curr);
|
||||
snprintf(eport2, 256, "%d", eport_curr);
|
||||
|
||||
std::cerr << "Attempting To Remove Redirection: port: " << eport1;
|
||||
std::cerr << " Prot: " << eprot1;
|
||||
std::cerr << "Attempting To Remove Redirection: port: " << eport_curr;
|
||||
std::cerr << " Prot: TCP";
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::vector<CUPnPPortMapping> upnpPortMapping1;
|
||||
CUPnPPortMapping cUPnPPortMapping1 = CUPnPPortMapping(eport_curr, 0, eprot1, true, "tcp redirection");
|
||||
CUPnPPortMapping cUPnPPortMapping1 = CUPnPPortMapping(eport_curr, 0, "TCP", true, "tcp redirection");
|
||||
upnpPortMapping1.push_back(cUPnPPortMapping1);
|
||||
cUPnPControlPoint->DeletePortMappings(upnpPortMapping1);
|
||||
|
||||
std::cerr << "Attempting To Remove Redirection: port: " << eport2;
|
||||
std::cerr << " Prot: " << eprot2;
|
||||
std::cerr << "Attempting To Remove Redirection: port: " << eport_curr;
|
||||
std::cerr << " Prot: UDP";
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::vector<CUPnPPortMapping> upnpPortMapping2;
|
||||
CUPnPPortMapping cUPnPPortMapping2 = CUPnPPortMapping(eport_curr, 0, eprot2, true, "udp redirection");
|
||||
CUPnPPortMapping cUPnPPortMapping2 = CUPnPPortMapping(eport_curr, 0, "UDP", true, "udp redirection");
|
||||
upnpPortMapping2.push_back(cUPnPPortMapping2);
|
||||
cUPnPControlPoint->DeletePortMappings(upnpPortMapping2);
|
||||
|
||||
//destroy the upnp object
|
||||
cUPnPControlPoint->~CUPnPControlPoint();
|
||||
upnpState = RS_UPNP_S_UNINITIALISED;
|
||||
|
||||
//stopping os ok, set starting to true for next net reset
|
||||
toStop = false;
|
||||
toStart = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -827,15 +827,6 @@ void NetworkDialog::updateNetworkStatus()
|
||||
ui.iconlabel_ext->setPixmap(QPixmap::QPixmap(":/images/ledoff1.png"));
|
||||
}
|
||||
|
||||
if (config.netExtraAddressOk || config.netStunOk || config.netUpnpOk)
|
||||
{
|
||||
ui.iconlabel_netInternetConnection->setPixmap(QPixmap::QPixmap(":/images/ledon1.png"));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.iconlabel_netInternetConnection->setPixmap(QPixmap::QPixmap(":/images/ledoff1.png"));
|
||||
}
|
||||
|
||||
rsiface->unlockData(); /* UnLock Interface */
|
||||
}
|
||||
|
||||
|
@ -210,33 +210,6 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="iconlabel_netInternetConnection">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="images.qrc">:/images/ledoff1.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="iconlabel_netInternetConnection_2">
|
||||
<property name="text">
|
||||
<string>Internet connection</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="iconlabel_upnp">
|
||||
|
Loading…
Reference in New Issue
Block a user