mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-15 20:42:29 -04:00
BugFix: DHT was not turning on.
also updated the ServerDialog with more info on exact network state. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@753 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
95d5f38222
commit
bc98b9ea7d
12 changed files with 330 additions and 122 deletions
|
@ -64,6 +64,7 @@ const uint32_t MAX_UPNP_INIT = 10; /* seconds UPnP timeout */
|
||||||
***/
|
***/
|
||||||
|
|
||||||
#define CONN_DEBUG 1
|
#define CONN_DEBUG 1
|
||||||
|
|
||||||
const uint32_t P3CONNMGR_TCP_DEFAULT_DELAY = 2; /* 2 Seconds? is it be enough! */
|
const uint32_t P3CONNMGR_TCP_DEFAULT_DELAY = 2; /* 2 Seconds? is it be enough! */
|
||||||
const uint32_t P3CONNMGR_UDP_DHT_DELAY = DHT_NOTIFY_PERIOD + 60; /* + 1 minute for DHT POST */
|
const uint32_t P3CONNMGR_UDP_DHT_DELAY = DHT_NOTIFY_PERIOD + 60; /* + 1 minute for DHT POST */
|
||||||
const uint32_t P3CONNMGR_UDP_PROXY_DELAY = 30; /* 30 seconds (NOT IMPLEMENTED YET!) */
|
const uint32_t P3CONNMGR_UDP_PROXY_DELAY = 30; /* 30 seconds (NOT IMPLEMENTED YET!) */
|
||||||
|
@ -169,7 +170,7 @@ void p3ConnectMgr::setOwnNetConfig(uint32_t netMode, uint32_t visState)
|
||||||
/* if we've started up - then tweak Dht On/Off */
|
/* if we've started up - then tweak Dht On/Off */
|
||||||
if (mNetStatus != RS_NET_UNKNOWN)
|
if (mNetStatus != RS_NET_UNKNOWN)
|
||||||
{
|
{
|
||||||
enableNetAssistFirewall(!(ownState.visState & RS_VIS_STATE_NODHT));
|
enableNetAssistConnect(!(ownState.visState & RS_VIS_STATE_NODHT));
|
||||||
}
|
}
|
||||||
|
|
||||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||||
|
@ -231,6 +232,17 @@ void p3ConnectMgr::setOwnNetConfig(uint32_t netMode, uint32_t visState)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void p3ConnectMgr::netStatusReset()
|
||||||
|
{
|
||||||
|
netFlagOk = true;
|
||||||
|
netFlagUpnpOk = false;
|
||||||
|
netFlagDhtOk = false;
|
||||||
|
netFlagExtOk = false;
|
||||||
|
netFlagUdpOk = false;
|
||||||
|
netFlagTcpOk = false;
|
||||||
|
netFlagResetReq = false;
|
||||||
|
}
|
||||||
|
|
||||||
void p3ConnectMgr::netStartup()
|
void p3ConnectMgr::netStartup()
|
||||||
{
|
{
|
||||||
/* startup stuff */
|
/* startup stuff */
|
||||||
|
@ -246,6 +258,7 @@ void p3ConnectMgr::netStartup()
|
||||||
netDhtInit();
|
netDhtInit();
|
||||||
netUdpInit();
|
netUdpInit();
|
||||||
netStunInit();
|
netStunInit();
|
||||||
|
netStatusReset();
|
||||||
|
|
||||||
/* decide which net setup mode we're going into
|
/* decide which net setup mode we're going into
|
||||||
*/
|
*/
|
||||||
|
@ -469,7 +482,7 @@ void p3ConnectMgr::netDhtInit()
|
||||||
|
|
||||||
connMtx.unlock(); /* UNLOCK MUTEX */
|
connMtx.unlock(); /* UNLOCK MUTEX */
|
||||||
|
|
||||||
enableNetAssistFirewall(!(vs & RS_VIS_STATE_NODHT));
|
enableNetAssistConnect(!(vs & RS_VIS_STATE_NODHT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -532,6 +545,14 @@ void p3ConnectMgr::netUpnpCheck()
|
||||||
/* switch to UDP startup */
|
/* switch to UDP startup */
|
||||||
connMtx.lock(); /* LOCK MUTEX */
|
connMtx.lock(); /* LOCK MUTEX */
|
||||||
|
|
||||||
|
/* Set Net Status flags ....
|
||||||
|
* we now have external upnp address. Golden!
|
||||||
|
* don't set netOk flag until have seen some traffic.
|
||||||
|
*/
|
||||||
|
|
||||||
|
netFlagUpnpOk = true;
|
||||||
|
netFlagExtOk = true;
|
||||||
|
|
||||||
mUpnpAddrValid = true;
|
mUpnpAddrValid = true;
|
||||||
mUpnpExtAddr = extAddr;
|
mUpnpExtAddr = extAddr;
|
||||||
mNetStatus = RS_NET_UDP_SETUP;
|
mNetStatus = RS_NET_UDP_SETUP;
|
||||||
|
@ -778,6 +799,15 @@ bool p3ConnectMgr::udpExtAddressCheck()
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* update net Status flags ....
|
||||||
|
* we've got stun information via udp...
|
||||||
|
* so up is okay, and ext address is known stable or not.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (mStunAddrStable)
|
||||||
|
netFlagExtOk = true;
|
||||||
|
netFlagUdpOk = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -1552,6 +1582,11 @@ void p3ConnectMgr::peerStatus(std::string id,
|
||||||
/* If we get a info -> then they are online */
|
/* If we get a info -> then they are online */
|
||||||
it->second.state |= RS_PEER_S_ONLINE;
|
it->second.state |= RS_PEER_S_ONLINE;
|
||||||
it->second.lastavailable = now;
|
it->second.lastavailable = now;
|
||||||
|
|
||||||
|
/* if we are recieving these - the dht is definitely up.
|
||||||
|
*/
|
||||||
|
|
||||||
|
netFlagDhtOk = true;
|
||||||
}
|
}
|
||||||
else if (source == RS_CB_DISC)
|
else if (source == RS_CB_DISC)
|
||||||
{
|
{
|
||||||
|
@ -3257,5 +3292,40 @@ bool p3ConnectMgr::getDHTEnabled()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool p3ConnectMgr::getNetStatusOk()
|
||||||
|
{
|
||||||
|
return netFlagOk;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool p3ConnectMgr::getNetStatusUpnpOk()
|
||||||
|
{
|
||||||
|
return netFlagUpnpOk;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool p3ConnectMgr::getNetStatusDhtOk()
|
||||||
|
{
|
||||||
|
return netFlagDhtOk;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool p3ConnectMgr::getNetStatusExtOk()
|
||||||
|
{
|
||||||
|
return netFlagExtOk;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool p3ConnectMgr::getNetStatusUdpOk()
|
||||||
|
{
|
||||||
|
return netFlagUdpOk;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool p3ConnectMgr::getNetStatusTcpOk()
|
||||||
|
{
|
||||||
|
return netFlagTcpOk;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool p3ConnectMgr::getNetResetReq()
|
||||||
|
{
|
||||||
|
return netFlagResetReq;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,13 @@ const uint32_t RS_NET_CONN_UDP_ALL = 0x00f0;
|
||||||
const uint32_t RS_NET_CONN_TCP_LOCAL = 0x0001;
|
const uint32_t RS_NET_CONN_TCP_LOCAL = 0x0001;
|
||||||
const uint32_t RS_NET_CONN_TCP_EXTERNAL = 0x0002;
|
const uint32_t RS_NET_CONN_TCP_EXTERNAL = 0x0002;
|
||||||
const uint32_t RS_NET_CONN_UDP_DHT_SYNC = 0x0010;
|
const uint32_t RS_NET_CONN_UDP_DHT_SYNC = 0x0010;
|
||||||
|
const uint32_t RS_NET_CONN_UDP_PEER_SYNC = 0x0020; /* coming soon */
|
||||||
|
|
||||||
|
/* extra flags */
|
||||||
|
// not sure if needed yet.
|
||||||
|
//const uint32_t RS_NET_CONN_PEERAGE = 0x0f00;
|
||||||
|
//const uint32_t RS_NET_CONN_SERVER = 0x0100; /* TCP only */
|
||||||
|
//const uint32_t RS_NET_CONN_PEER = 0x0200; /* all UDP */
|
||||||
|
|
||||||
|
|
||||||
/* flags of peerStatus */
|
/* flags of peerStatus */
|
||||||
|
@ -176,6 +183,14 @@ bool getUPnPState();
|
||||||
bool getUPnPEnabled();
|
bool getUPnPEnabled();
|
||||||
bool getDHTEnabled();
|
bool getDHTEnabled();
|
||||||
|
|
||||||
|
bool getNetStatusOk();
|
||||||
|
bool getNetStatusUpnpOk();
|
||||||
|
bool getNetStatusDhtOk();
|
||||||
|
bool getNetStatusExtOk();
|
||||||
|
bool getNetStatusUdpOk();
|
||||||
|
bool getNetStatusTcpOk();
|
||||||
|
bool getNetResetReq();
|
||||||
|
|
||||||
void setOwnNetConfig(uint32_t netMode, uint32_t visState);
|
void setOwnNetConfig(uint32_t netMode, uint32_t visState);
|
||||||
bool setLocalAddress(std::string id, struct sockaddr_in addr);
|
bool setLocalAddress(std::string id, struct sockaddr_in addr);
|
||||||
bool setExtAddress(std::string id, struct sockaddr_in addr);
|
bool setExtAddress(std::string id, struct sockaddr_in addr);
|
||||||
|
@ -260,7 +275,7 @@ void netDhtInit();
|
||||||
void netUdpInit();
|
void netUdpInit();
|
||||||
void netStunInit();
|
void netStunInit();
|
||||||
|
|
||||||
|
void netStatusReset();
|
||||||
|
|
||||||
|
|
||||||
void netInit();
|
void netInit();
|
||||||
|
@ -338,6 +353,15 @@ private:
|
||||||
struct sockaddr_in mUpnpExtAddr;
|
struct sockaddr_in mUpnpExtAddr;
|
||||||
struct sockaddr_in mStunExtAddr;
|
struct sockaddr_in mStunExtAddr;
|
||||||
|
|
||||||
|
/* network status flags (read by rsiface) */
|
||||||
|
bool netFlagOk;
|
||||||
|
bool netFlagUpnpOk;
|
||||||
|
bool netFlagDhtOk;
|
||||||
|
bool netFlagExtOk;
|
||||||
|
bool netFlagUdpOk;
|
||||||
|
bool netFlagTcpOk;
|
||||||
|
bool netFlagResetReq;
|
||||||
|
|
||||||
|
|
||||||
/* these are protected for testing */
|
/* these are protected for testing */
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -48,6 +48,8 @@ const int p3dhtzone = 3892;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define DHT_DEBUG 1
|
||||||
|
|
||||||
/**** DHT State Variables ****/
|
/**** DHT State Variables ****/
|
||||||
|
|
||||||
#define DHT_STATE_OFF 0
|
#define DHT_STATE_OFF 0
|
||||||
|
|
|
@ -137,11 +137,21 @@ class RsConfig
|
||||||
|
|
||||||
int promptAtBoot; /* popup the password prompt */
|
int promptAtBoot; /* popup the password prompt */
|
||||||
|
|
||||||
|
/* older data types */
|
||||||
bool DHTActive;
|
bool DHTActive;
|
||||||
bool uPnPActive;
|
bool uPnPActive;
|
||||||
|
|
||||||
int uPnPState;
|
int uPnPState;
|
||||||
int DHTPeers;
|
int DHTPeers;
|
||||||
|
|
||||||
|
/* Flags for Network Status */
|
||||||
|
bool netOk; /* That we've talked to someone! */
|
||||||
|
bool netUpnpOk; /* upnp is enabled and active */
|
||||||
|
bool netDhtOk; /* response from dht */
|
||||||
|
bool netExtOk; /* know our external address */
|
||||||
|
bool netUdpOk; /* recvd stun / udp packets */
|
||||||
|
bool netTcpOk; /* recvd incoming tcp */
|
||||||
|
bool netResetReq;
|
||||||
};
|
};
|
||||||
|
|
||||||
/********************** For Search Interface *****************/
|
/********************** For Search Interface *****************/
|
||||||
|
|
|
@ -124,6 +124,15 @@ int RsServer::UpdateAllConfig()
|
||||||
config.maxIndivDataRate = (int) pqih -> getMaxIndivRate(true);/* kb */
|
config.maxIndivDataRate = (int) pqih -> getMaxIndivRate(true);/* kb */
|
||||||
config.promptAtBoot = true; /* popup the password prompt */
|
config.promptAtBoot = true; /* popup the password prompt */
|
||||||
|
|
||||||
|
/* update network configuration */
|
||||||
|
|
||||||
|
config.netOk = mConnMgr->getNetStatusOk();
|
||||||
|
config.netUpnpOk = mConnMgr->getNetStatusUpnpOk();
|
||||||
|
config.netDhtOk = mConnMgr->getNetStatusDhtOk();
|
||||||
|
config.netExtOk = mConnMgr->getNetStatusExtOk();
|
||||||
|
config.netUdpOk = mConnMgr->getNetStatusUdpOk();
|
||||||
|
config.netTcpOk = mConnMgr->getNetStatusTcpOk();
|
||||||
|
|
||||||
/* update DHT/UPnP config */
|
/* update DHT/UPnP config */
|
||||||
|
|
||||||
config.uPnPState = mConnMgr->getUPnPState();
|
config.uPnPState = mConnMgr->getUPnPState();
|
||||||
|
|
|
@ -487,17 +487,17 @@
|
||||||
<property name="contextMenuPolicy" >
|
<property name="contextMenuPolicy" >
|
||||||
<enum>Qt::NoContextMenu</enum>
|
<enum>Qt::NoContextMenu</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout" >
|
<layout class="QGridLayout" >
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0" >
|
||||||
<widget class="QGroupBox" name="groupBox_5" >
|
<widget class="QGroupBox" name="groupBox_5" >
|
||||||
<property name="title" >
|
<property name="title" >
|
||||||
<string>Library</string>
|
<string>Library</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_8" >
|
<layout class="QGridLayout" >
|
||||||
<item row="0" column="1" colspan="2" >
|
<item row="0" column="1" colspan="2" >
|
||||||
<widget class="QLabel" name="label_3" >
|
<widget class="QLabel" name="label_3" >
|
||||||
<property name="styleSheet" >
|
<property name="styleSheet" >
|
||||||
<string notr="true" >background-color: rgb(253, 252, 248);</string>
|
<string>background-color: rgb(253, 252, 248);</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Exploring My RetroShare Library</string>
|
<string>Exploring My RetroShare Library</string>
|
||||||
|
@ -543,7 +543,7 @@
|
||||||
<item row="2" column="1" >
|
<item row="2" column="1" >
|
||||||
<widget class="QPushButton" name="createAlbum_btn_library" >
|
<widget class="QPushButton" name="createAlbum_btn_library" >
|
||||||
<property name="styleSheet" >
|
<property name="styleSheet" >
|
||||||
<string notr="true" />
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Create Album</string>
|
<string>Create Album</string>
|
||||||
|
@ -556,7 +556,7 @@
|
||||||
<item row="2" column="2" >
|
<item row="2" column="2" >
|
||||||
<widget class="QPushButton" name="deleteAlbum_btn_library" >
|
<widget class="QPushButton" name="deleteAlbum_btn_library" >
|
||||||
<property name="styleSheet" >
|
<property name="styleSheet" >
|
||||||
<string notr="true" />
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Delete Album</string>
|
<string>Delete Album</string>
|
||||||
|
@ -572,7 +572,7 @@
|
||||||
<item row="2" column="4" >
|
<item row="2" column="4" >
|
||||||
<widget class="QPushButton" name="find_btn_library" >
|
<widget class="QPushButton" name="find_btn_library" >
|
||||||
<property name="styleSheet" >
|
<property name="styleSheet" >
|
||||||
<string notr="true" >pushButton_41:hover{ color : white;}</string>
|
<string>pushButton_41:hover{ color : white;}</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Find</string>
|
<string>Find</string>
|
||||||
|
@ -591,22 +591,14 @@
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab_13" >
|
<widget class="QWidget" name="tab_13" >
|
||||||
<property name="geometry" >
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>226</width>
|
|
||||||
<height>345</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<attribute name="title" >
|
<attribute name="title" >
|
||||||
<string>Folder</string>
|
<string>Folder</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QFormLayout" name="formLayout" >
|
<layout class="QGridLayout" >
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0" >
|
||||||
<widget class="QComboBox" name="comboBox" >
|
<widget class="QComboBox" name="comboBox" >
|
||||||
<property name="styleSheet" >
|
<property name="styleSheet" >
|
||||||
<string notr="true" >border-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));</string>
|
<string>border-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));</string>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
|
@ -628,18 +620,10 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="tab_14" >
|
<widget class="QWidget" name="tab_14" >
|
||||||
<property name="geometry" >
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>238</width>
|
|
||||||
<height>390</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<attribute name="title" >
|
<attribute name="title" >
|
||||||
<string>Organizer</string>
|
<string>Organizer</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QGridLayout" name="gridLayout_25" >
|
<layout class="QGridLayout" >
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0" >
|
||||||
<widget class="QTreeView" name="organizertreeView" >
|
<widget class="QTreeView" name="organizertreeView" >
|
||||||
<property name="font" >
|
<property name="font" >
|
||||||
|
@ -653,7 +637,7 @@
|
||||||
<item row="1" column="0" >
|
<item row="1" column="0" >
|
||||||
<widget class="QPushButton" name="shareFiles_btn" >
|
<widget class="QPushButton" name="shareFiles_btn" >
|
||||||
<property name="styleSheet" >
|
<property name="styleSheet" >
|
||||||
<string notr="true" >border-color: rgb(0, 0, 0);</string>
|
<string>border-color: rgb(0, 0, 0);</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Share Files..</string>
|
<string>Share Files..</string>
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
#include "rsiface/rsiface.h"
|
#include "rsiface/rsiface.h"
|
||||||
#include "rsiface/rspeers.h"
|
#include "rsiface/rspeers.h"
|
||||||
|
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
|
@ -42,6 +44,10 @@ ServerDialog::ServerDialog(QWidget *parent)
|
||||||
|
|
||||||
connect( ui.netModeComboBox, SIGNAL( activated ( int ) ), this, SLOT( toggleUPnP( ) ) );
|
connect( ui.netModeComboBox, SIGNAL( activated ( int ) ), this, SLOT( toggleUPnP( ) ) );
|
||||||
|
|
||||||
|
QTimer *timer = new QTimer(this);
|
||||||
|
timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus()));
|
||||||
|
timer->start(1000);
|
||||||
|
|
||||||
|
|
||||||
/* Hide platform specific features */
|
/* Hide platform specific features */
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
|
@ -109,15 +115,69 @@ void ServerDialog::load()
|
||||||
}
|
}
|
||||||
ui.discComboBox->setCurrentIndex(netIndex);
|
ui.discComboBox->setCurrentIndex(netIndex);
|
||||||
|
|
||||||
|
rsiface->lockData(); /* Lock Interface */
|
||||||
|
|
||||||
/* set the addresses */
|
ui.totalRate->setValue(rsiface->getConfig().maxDataRate);
|
||||||
|
ui.indivRate->setValue(rsiface->getConfig().maxIndivDataRate);
|
||||||
|
|
||||||
|
rsiface->unlockData(); /* UnLock Interface */
|
||||||
|
|
||||||
|
toggleUPnP();
|
||||||
|
|
||||||
|
//ui.check_net->setCheckable(true);
|
||||||
|
ui.check_upnp->setCheckable(true);
|
||||||
|
ui.check_dht->setCheckable(true);
|
||||||
|
ui.check_ext->setCheckable(true);
|
||||||
|
ui.check_udp->setCheckable(true);
|
||||||
|
ui.check_tcp->setCheckable(true);
|
||||||
|
|
||||||
|
//ui.check_net->setEnabled(false);
|
||||||
|
ui.check_upnp->setEnabled(false);
|
||||||
|
ui.check_dht->setEnabled(false);
|
||||||
|
ui.check_ext->setEnabled(false);
|
||||||
|
ui.check_udp->setEnabled(false);
|
||||||
|
ui.check_tcp->setEnabled(false);
|
||||||
|
|
||||||
|
ui.radio_nonet->setEnabled(false);
|
||||||
|
ui.radio_netLimited->setEnabled(false);
|
||||||
|
ui.radio_netUdp->setEnabled(false);
|
||||||
|
ui.radio_netServer->setEnabled(false);
|
||||||
|
|
||||||
|
/* Addresses must be set here - otherwise can't edit it */
|
||||||
/* set local address */
|
/* set local address */
|
||||||
ui.localAddress->setText(QString::fromStdString(detail.localAddr));
|
ui.localAddress->setText(QString::fromStdString(detail.localAddr));
|
||||||
ui.localPort -> setValue(detail.localPort);
|
ui.localPort -> setValue(detail.localPort);
|
||||||
/* set the server address */
|
/* set the server address */
|
||||||
ui.extAddress->setText(QString::fromStdString(detail.extAddr));
|
ui.extAddress->setText(QString::fromStdString(detail.extAddr));
|
||||||
ui.extPort -> setValue(detail.extPort);
|
ui.extPort -> setValue(detail.extPort);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Loads the settings for this page */
|
||||||
|
void ServerDialog::updateStatus()
|
||||||
|
{
|
||||||
|
|
||||||
|
/* load up configuration from rsPeers */
|
||||||
|
RsPeerDetails detail;
|
||||||
|
if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* only update if can't edit */
|
||||||
|
if (!ui.localPort->isEnabled())
|
||||||
|
{
|
||||||
|
/* set local address */
|
||||||
|
ui.localPort -> setValue(detail.localPort);
|
||||||
|
ui.extPort -> setValue(detail.extPort);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* set local address */
|
||||||
|
ui.localAddress->setText(QString::fromStdString(detail.localAddr));
|
||||||
|
/* set the server address */
|
||||||
|
ui.extAddress->setText(QString::fromStdString(detail.extAddr));
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* set status */
|
/* set status */
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
out << "Attempted Network Mode: ";
|
out << "Attempted Network Mode: ";
|
||||||
|
@ -131,6 +191,7 @@ void ServerDialog::load()
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case RS_NETMODE_UPNP:
|
case RS_NETMODE_UPNP:
|
||||||
|
|
||||||
out << "Automatic: UPnP Forwarded Port";
|
out << "Automatic: UPnP Forwarded Port";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -178,7 +239,6 @@ void ServerDialog::load()
|
||||||
out << std::endl;
|
out << std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (detail.netMode == RS_NETMODE_UNREACHABLE)
|
if (detail.netMode == RS_NETMODE_UNREACHABLE)
|
||||||
{
|
{
|
||||||
ui.netStatusBox->setTextColor( Qt::red );
|
ui.netStatusBox->setTextColor( Qt::red );
|
||||||
|
@ -190,17 +250,47 @@ void ServerDialog::load()
|
||||||
|
|
||||||
ui.netStatusBox->setText(QString::fromStdString(out.str()));
|
ui.netStatusBox->setText(QString::fromStdString(out.str()));
|
||||||
ui.netStatusBox ->setReadOnly(true);
|
ui.netStatusBox ->setReadOnly(true);
|
||||||
|
#endif
|
||||||
|
|
||||||
rsiface->lockData(); /* Lock Interface */
|
rsiface->lockData(); /* Lock Interface */
|
||||||
|
|
||||||
ui.totalRate->setValue(rsiface->getConfig().maxDataRate);
|
/* now the extra bit .... switch on check boxes */
|
||||||
ui.indivRate->setValue(rsiface->getConfig().maxIndivDataRate);
|
const RsConfig &config = rsiface->getConfig();
|
||||||
|
|
||||||
|
//ui.check_net->setChecked(config.netOk);
|
||||||
|
ui.check_upnp->setChecked(config.netUpnpOk);
|
||||||
|
ui.check_dht->setChecked(config.netDhtOk);
|
||||||
|
ui.check_ext->setChecked(config.netExtOk);
|
||||||
|
ui.check_udp->setChecked(config.netUdpOk);
|
||||||
|
ui.check_tcp->setChecked(config.netTcpOk);
|
||||||
|
|
||||||
|
if (config.netExtOk)
|
||||||
|
{
|
||||||
|
if (config.netUpnpOk || config.netTcpOk)
|
||||||
|
{
|
||||||
|
ui.radio_netServer->setChecked(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui.radio_netUdp->setChecked(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (config.netOk)
|
||||||
|
{
|
||||||
|
ui.radio_netLimited->setChecked(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui.radio_nonet->setChecked(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
rsiface->unlockData(); /* UnLock Interface */
|
rsiface->unlockData(); /* UnLock Interface */
|
||||||
|
|
||||||
toggleUPnP();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ServerDialog::toggleUPnP()
|
void ServerDialog::toggleUPnP()
|
||||||
{
|
{
|
||||||
/* switch on the radioButton */
|
/* switch on the radioButton */
|
||||||
|
@ -217,9 +307,9 @@ void ServerDialog::toggleUPnP()
|
||||||
//ui.discComboBox->setEnabled(true);
|
//ui.discComboBox->setEnabled(true);
|
||||||
ui.discComboBox->setEnabled(false);
|
ui.discComboBox->setEnabled(false);
|
||||||
|
|
||||||
ui.localAddress->setEnabled(true);
|
ui.localAddress->setEnabled(false);
|
||||||
ui.localPort -> setEnabled(true);
|
ui.localPort -> setEnabled(true);
|
||||||
ui.extAddress -> setEnabled(true);
|
ui.extAddress -> setEnabled(false);
|
||||||
ui.extPort -> setEnabled(true);
|
ui.extPort -> setEnabled(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -42,7 +42,10 @@ public:
|
||||||
bool save(QString &errmsg);
|
bool save(QString &errmsg);
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
void load();
|
void load();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void updateStatus();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void saveAddresses();
|
void saveAddresses();
|
||||||
void toggleUPnP();
|
void toggleUPnP();
|
||||||
|
|
|
@ -518,17 +518,17 @@
|
||||||
<widget class="QComboBox" name="netModeComboBox" >
|
<widget class="QComboBox" name="netModeComboBox" >
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Automatic (Firewalled)</string>
|
<string>Automatic</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Firewalled + No UPnP</string>
|
<string>Firewalled</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>External (Forwarded) Port</string>
|
<string>Forwarded Port</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -579,77 +579,88 @@
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="title" >
|
<property name="title" >
|
||||||
<string>Server Status And Network Settings</string>
|
<string>Network Configuration</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QGridLayout" >
|
||||||
<item>
|
<item row="0" column="0" >
|
||||||
<layout class="QGridLayout" >
|
<widget class="QRadioButton" name="radio_nonet" >
|
||||||
<item rowspan="6" row="0" column="0" >
|
<property name="text" >
|
||||||
<widget class="QTextEdit" name="netStatusBox" />
|
<string>No Conectivity</string>
|
||||||
</item>
|
</property>
|
||||||
<item row="0" column="1" >
|
</widget>
|
||||||
<widget class="QCheckBox" name="checkBox" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>Network Okay</string>
|
|
||||||
</property>
|
|
||||||
<property name="checkable" >
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1" >
|
|
||||||
<widget class="QCheckBox" name="checkBox_6" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>UPnP Active</string>
|
|
||||||
</property>
|
|
||||||
<property name="checkable" >
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1" >
|
|
||||||
<widget class="QCheckBox" name="checkBox_5" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>DHT Okay</string>
|
|
||||||
</property>
|
|
||||||
<property name="checkable" >
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1" >
|
|
||||||
<widget class="QCheckBox" name="checkBox_2" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>Found Ext IP Addr</string>
|
|
||||||
</property>
|
|
||||||
<property name="checkable" >
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1" >
|
|
||||||
<widget class="QCheckBox" name="checkBox_3" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>UDP Connections</string>
|
|
||||||
</property>
|
|
||||||
<property name="checkable" >
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="1" >
|
|
||||||
<widget class="QCheckBox" name="checkBox_4" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>TCP server</string>
|
|
||||||
</property>
|
|
||||||
<property name="checkable" >
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="0" column="1" >
|
||||||
|
<widget class="QCheckBox" name="check_udp" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>UDP Connections</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" >
|
||||||
|
<widget class="QRadioButton" name="radio_netLimited" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Limited</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1" >
|
||||||
|
<widget class="QCheckBox" name="check_ext" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Stable External IP Addrress</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item rowspan="2" row="2" column="0" >
|
||||||
|
<widget class="QRadioButton" name="radio_netUdp" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Udp</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1" >
|
||||||
|
<widget class="QCheckBox" name="check_dht" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>DHT Okay</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1" >
|
||||||
|
<widget class="QCheckBox" name="check_upnp" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>UPnP Active</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0" >
|
||||||
|
<widget class="QRadioButton" name="radio_netServer" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Retroshare Server</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1" >
|
||||||
|
<widget class="QCheckBox" name="check_tcp" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>TCP server</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0" colspan="2" >
|
||||||
<layout class="QHBoxLayout" >
|
<layout class="QHBoxLayout" >
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
|
@ -671,9 +682,6 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" >
|
<layout class="QGridLayout" >
|
||||||
<item row="0" column="0" >
|
|
||||||
<widget class="QLineEdit" name="localAddress" />
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1" >
|
<item row="0" column="1" >
|
||||||
<widget class="QLabel" name="label_5" >
|
<widget class="QLabel" name="label_5" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
|
@ -694,9 +702,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" >
|
|
||||||
<widget class="QLineEdit" name="extAddress" />
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1" >
|
<item row="1" column="1" >
|
||||||
<widget class="QLabel" name="label_4" >
|
<widget class="QLabel" name="label_4" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
|
@ -717,6 +722,12 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0" >
|
||||||
|
<widget class="QLineEdit" name="extAddress" />
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0" >
|
||||||
|
<widget class="QLineEdit" name="localAddress" />
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -834,7 +845,6 @@
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>localAddress</tabstop>
|
<tabstop>localAddress</tabstop>
|
||||||
<tabstop>localPort</tabstop>
|
<tabstop>localPort</tabstop>
|
||||||
<tabstop>extAddress</tabstop>
|
|
||||||
<tabstop>extPort</tabstop>
|
<tabstop>extPort</tabstop>
|
||||||
<tabstop>totalRate</tabstop>
|
<tabstop>totalRate</tabstop>
|
||||||
<tabstop>indivRate</tabstop>
|
<tabstop>indivRate</tabstop>
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
|
|
||||||
-- Diese und die folgenden Zeilen werden ignoriert --
|
|
||||||
|
|
||||||
M NetworkDialog.cpp
|
|
|
@ -151,13 +151,13 @@ int main(int argc, char *argv[])
|
||||||
notify->setMessengerWindow(w->messengerWindow);
|
notify->setMessengerWindow(w->messengerWindow);
|
||||||
|
|
||||||
/* only show window, if not startMinimized */
|
/* only show window, if not startMinimized */
|
||||||
/*if (!startMinimised)
|
if (!startMinimised)
|
||||||
{
|
{
|
||||||
|
|
||||||
w->show();
|
w->show();
|
||||||
//skinWindow->show();
|
//skinWindow->show();
|
||||||
|
|
||||||
}*/
|
}
|
||||||
|
|
||||||
/* Run Retroshare */
|
/* Run Retroshare */
|
||||||
//int ret = rshare.run();
|
//int ret = rshare.run();
|
||||||
|
|
|
@ -137,11 +137,21 @@ class RsConfig
|
||||||
|
|
||||||
int promptAtBoot; /* popup the password prompt */
|
int promptAtBoot; /* popup the password prompt */
|
||||||
|
|
||||||
|
/* older data types */
|
||||||
bool DHTActive;
|
bool DHTActive;
|
||||||
bool uPnPActive;
|
bool uPnPActive;
|
||||||
|
|
||||||
int uPnPState;
|
int uPnPState;
|
||||||
int DHTPeers;
|
int DHTPeers;
|
||||||
|
|
||||||
|
/* Flags for Network Status */
|
||||||
|
bool netOk; /* That we've talked to someone! */
|
||||||
|
bool netUpnpOk; /* upnp is enabled and active */
|
||||||
|
bool netDhtOk; /* response from dht */
|
||||||
|
bool netExtOk; /* know our external address */
|
||||||
|
bool netUdpOk; /* recvd stun / udp packets */
|
||||||
|
bool netTcpOk; /* recvd incoming tcp */
|
||||||
|
bool netResetReq;
|
||||||
};
|
};
|
||||||
|
|
||||||
/********************** For Search Interface *****************/
|
/********************** For Search Interface *****************/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue