mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-19 20:04:24 -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
5 changed files with 24 additions and 79 deletions
|
@ -700,19 +700,14 @@ void p3ConnectMgr::networkConsistencyCheck()
|
||||||
bool doNetReset = false;
|
bool doNetReset = false;
|
||||||
//if one of the flag is degrated from true to false during last tick, let's do a reset
|
//if one of the flag is degrated from true to false during last tick, let's do a reset
|
||||||
//storing old flags
|
//storing old flags
|
||||||
// #ifdef CONN_DEBUG
|
#ifdef CONN_DEBUG
|
||||||
// std::cerr << "p3ConnectMgr::networkConsistencyCheck() net flags : " << std::endl;
|
std::cerr << "p3ConnectMgr::networkConsistencyCheck() net flags : " << std::endl;
|
||||||
// std::cerr << " oldnetFlagLocalOk : " << oldnetFlagLocalOk << ". netFlagLocalOk : " << netFlagLocalOk << "." << std::endl;
|
std::cerr << " oldnetFlagLocalOk : " << oldnetFlagLocalOk << ". netFlagLocalOk : " << netFlagLocalOk << "." << std::endl;
|
||||||
// std::cerr << " oldnetFlagUpnpOk : " << oldnetFlagUpnpOk << ". netFlagUpnpOk : " << netFlagUpnpOk << "." << std::endl;
|
std::cerr << " oldnetFlagUpnpOk : " << oldnetFlagUpnpOk << ". netFlagUpnpOk : " << netFlagUpnpOk << "." << std::endl;
|
||||||
// std::cerr << " oldnetFlagDhtOk : " << oldnetFlagDhtOk << ". netFlagDhtOk : " << netFlagDhtOk << "." << std::endl;
|
std::cerr << " oldnetFlagDhtOk : " << oldnetFlagDhtOk << ". netFlagDhtOk : " << netFlagDhtOk << "." << std::endl;
|
||||||
// std::cerr << " oldnetFlagStunOk : " << oldnetFlagStunOk << ". netFlagStunOk : " << netFlagStunOk << "." << std::endl;
|
std::cerr << " oldnetFlagStunOk : " << oldnetFlagStunOk << ". netFlagStunOk : " << netFlagStunOk << "." << std::endl;
|
||||||
// std::cerr << " oldnetFlagExtraAddressCheckOk : " << oldnetFlagExtraAddressCheckOk << ". netFlagExtraAddressCheckOk : " << netFlagExtraAddressCheckOk << "." << std::endl;
|
std::cerr << " oldnetFlagExtraAddressCheckOk : " << oldnetFlagExtraAddressCheckOk << ". netFlagExtraAddressCheckOk : " << netFlagExtraAddressCheckOk << "." << std::endl;
|
||||||
// #endif
|
#endif
|
||||||
oldnetFlagLocalOk = netFlagLocalOk;
|
|
||||||
oldnetFlagUpnpOk = netFlagUpnpOk;
|
|
||||||
oldnetFlagDhtOk = netFlagDhtOk;
|
|
||||||
oldnetFlagStunOk = netFlagStunOk;
|
|
||||||
oldnetFlagExtraAddressCheckOk = netFlagExtraAddressCheckOk;
|
|
||||||
if ((!netFlagLocalOk && oldnetFlagLocalOk)
|
if ((!netFlagLocalOk && oldnetFlagLocalOk)
|
||||||
|| (!netFlagUpnpOk && oldnetFlagUpnpOk)
|
|| (!netFlagUpnpOk && oldnetFlagUpnpOk)
|
||||||
|| (!netFlagDhtOk && oldnetFlagDhtOk)
|
|| (!netFlagDhtOk && oldnetFlagDhtOk)
|
||||||
|
@ -722,6 +717,11 @@ void p3ConnectMgr::networkConsistencyCheck()
|
||||||
#ifdef CONN_DEBUG
|
#ifdef CONN_DEBUG
|
||||||
std::cerr << "p3ConnectMgr::networkConsistencyCheck() A net flag went down." << std::endl;
|
std::cerr << "p3ConnectMgr::networkConsistencyCheck() A net flag went down." << std::endl;
|
||||||
#endif
|
#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;
|
doNetReset = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -573,7 +573,6 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CUPnPService *m_WanService;
|
CUPnPService *m_WanService;
|
||||||
RsMutex m_getStateVariableMutex;
|
|
||||||
std::string m_getStateVariableLastResult;
|
std::string m_getStateVariableLastResult;
|
||||||
static CUPnPControlPoint *s_CtrlPoint;
|
static CUPnPControlPoint *s_CtrlPoint;
|
||||||
CUPnPControlPoint(unsigned short udpPort);
|
CUPnPControlPoint(unsigned short udpPort);
|
||||||
|
|
|
@ -106,9 +106,6 @@ bool upnphandler::start_upnp()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
char eprot1[] = "TCP";
|
|
||||||
char eprot2[] = "UDP";
|
|
||||||
|
|
||||||
struct sockaddr_in localAddr;
|
struct sockaddr_in localAddr;
|
||||||
{
|
{
|
||||||
RsStackMutex stack(dataMtx); /* LOCK STACK MUTEX */
|
RsStackMutex stack(dataMtx); /* LOCK STACK MUTEX */
|
||||||
|
@ -153,7 +150,7 @@ bool upnphandler::start_upnp()
|
||||||
std::cerr << "Attempting Redirection: InAddr: " << in_addr;
|
std::cerr << "Attempting Redirection: InAddr: " << in_addr;
|
||||||
std::cerr << " InPort: " << in_port1;
|
std::cerr << " InPort: " << in_port1;
|
||||||
std::cerr << " ePort: " << eport1;
|
std::cerr << " ePort: " << eport1;
|
||||||
std::cerr << " eProt: " << eprot1;
|
std::cerr << " eProt: " << "TCP";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,49 +188,34 @@ bool upnphandler::shutdown_upnp()
|
||||||
{
|
{
|
||||||
RsStackMutex stack(dataMtx); /* LOCK STACK MUTEX */
|
RsStackMutex stack(dataMtx); /* LOCK STACK MUTEX */
|
||||||
|
|
||||||
if (!(upnpState >= RS_UPNP_S_READY))
|
//stopping os ok, set starting to true for next net reset
|
||||||
{
|
toStop = false;
|
||||||
return false;
|
toStart = true;
|
||||||
}
|
|
||||||
|
|
||||||
char eprot1[] = "TCP";
|
|
||||||
char eprot2[] = "UDP";
|
|
||||||
|
|
||||||
/* always attempt this (unless no port number) */
|
/* always attempt this (unless no port number) */
|
||||||
if (eport_curr > 0)
|
if (eport_curr > 0 && eport > 0)
|
||||||
{
|
{
|
||||||
|
std::cerr << "Attempting To Remove Redirection: port: " << eport_curr;
|
||||||
char eport1[256];
|
std::cerr << " Prot: TCP";
|
||||||
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 << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
std::vector<CUPnPPortMapping> upnpPortMapping1;
|
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);
|
upnpPortMapping1.push_back(cUPnPPortMapping1);
|
||||||
cUPnPControlPoint->DeletePortMappings(upnpPortMapping1);
|
cUPnPControlPoint->DeletePortMappings(upnpPortMapping1);
|
||||||
|
|
||||||
std::cerr << "Attempting To Remove Redirection: port: " << eport2;
|
std::cerr << "Attempting To Remove Redirection: port: " << eport_curr;
|
||||||
std::cerr << " Prot: " << eprot2;
|
std::cerr << " Prot: UDP";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
std::vector<CUPnPPortMapping> upnpPortMapping2;
|
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);
|
upnpPortMapping2.push_back(cUPnPPortMapping2);
|
||||||
cUPnPControlPoint->DeletePortMappings(upnpPortMapping2);
|
cUPnPControlPoint->DeletePortMappings(upnpPortMapping2);
|
||||||
|
|
||||||
//destroy the upnp object
|
//destroy the upnp object
|
||||||
cUPnPControlPoint->~CUPnPControlPoint();
|
cUPnPControlPoint->~CUPnPControlPoint();
|
||||||
upnpState = RS_UPNP_S_UNINITIALISED;
|
upnpState = RS_UPNP_S_UNINITIALISED;
|
||||||
|
|
||||||
//stopping os ok, set starting to true for next net reset
|
|
||||||
toStop = false;
|
|
||||||
toStart = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -827,15 +827,6 @@ void NetworkDialog::updateNetworkStatus()
|
||||||
ui.iconlabel_ext->setPixmap(QPixmap::QPixmap(":/images/ledoff1.png"));
|
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 */
|
rsiface->unlockData(); /* UnLock Interface */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -210,33 +210,6 @@
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<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">
|
<layout class="QGridLayout">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="iconlabel_upnp">
|
<widget class="QLabel" name="iconlabel_upnp">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue