mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-14 08:59:50 -05:00
convert RSDHT_TOU_MODE_ to enum class
This commit is contained in:
parent
46d77bfe7a
commit
bc1ba3654d
@ -302,16 +302,16 @@ void convertDhtPeerDetailsToRsDhtNetPeer(RsDhtNetPeer &status, const DhtPeerDeta
|
|||||||
switch(details.mPeerConnectMode)
|
switch(details.mPeerConnectMode)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
status.mPeerConnectMode = RSDHT_TOU_MODE_NONE;
|
status.mPeerConnectMode = RsDhtTouMode::NONE;
|
||||||
break;
|
break;
|
||||||
case BITDHT_CONNECT_MODE_DIRECT:
|
case BITDHT_CONNECT_MODE_DIRECT:
|
||||||
status.mPeerConnectMode = RSDHT_TOU_MODE_DIRECT;
|
status.mPeerConnectMode = RsDhtTouMode::DIRECT;
|
||||||
break;
|
break;
|
||||||
case BITDHT_CONNECT_MODE_PROXY:
|
case BITDHT_CONNECT_MODE_PROXY:
|
||||||
status.mPeerConnectMode = RSDHT_TOU_MODE_PROXY;
|
status.mPeerConnectMode = RsDhtTouMode::PROXY;
|
||||||
break;
|
break;
|
||||||
case BITDHT_CONNECT_MODE_RELAY:
|
case BITDHT_CONNECT_MODE_RELAY:
|
||||||
status.mPeerConnectMode = RSDHT_TOU_MODE_RELAY;
|
status.mPeerConnectMode = RsDhtTouMode::RELAY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2003,7 +2003,7 @@ void p3BitDht::initiateConnection(const bdId *srcId, const bdId *proxyId, const
|
|||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case BITDHT_CONNECT_MODE_DIRECT:
|
case BITDHT_CONNECT_MODE_DIRECT:
|
||||||
// touConnectMode = RSDHT_TOU_MODE_DIRECT;
|
// touConnectMode = RsDhtTouMode::DIRECT;
|
||||||
connectFlags |= RS_CB_FLAG_MODE_UDP_DIRECT;
|
connectFlags |= RS_CB_FLAG_MODE_UDP_DIRECT;
|
||||||
delay = delayOrBandwidth;
|
delay = delayOrBandwidth;
|
||||||
break;
|
break;
|
||||||
@ -2021,12 +2021,12 @@ void p3BitDht::initiateConnection(const bdId *srcId, const bdId *proxyId, const
|
|||||||
delay = delayOrBandwidth;
|
delay = delayOrBandwidth;
|
||||||
if (useProxyPort)
|
if (useProxyPort)
|
||||||
{
|
{
|
||||||
// touConnectMode = RSDHT_TOU_MODE_PROXY;
|
// touConnectMode = RsDhtTouMode::PROXY;
|
||||||
connectFlags |= RS_CB_FLAG_MODE_UDP_PROXY;
|
connectFlags |= RS_CB_FLAG_MODE_UDP_PROXY;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// touConnectMode = RSDHT_TOU_MODE_DIRECT;
|
// touConnectMode = RsDhtTouMode::DIRECT;
|
||||||
connectFlags |= RS_CB_FLAG_MODE_UDP_DIRECT;
|
connectFlags |= RS_CB_FLAG_MODE_UDP_DIRECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2034,7 +2034,7 @@ void p3BitDht::initiateConnection(const bdId *srcId, const bdId *proxyId, const
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case BITDHT_CONNECT_MODE_RELAY:
|
case BITDHT_CONNECT_MODE_RELAY:
|
||||||
// touConnectMode = RSDHT_TOU_MODE_RELAY;
|
// touConnectMode = RsDhtTouMode::RELAY;
|
||||||
connectFlags |= RS_CB_FLAG_MODE_UDP_RELAY;
|
connectFlags |= RS_CB_FLAG_MODE_UDP_RELAY;
|
||||||
bandwidth = delayOrBandwidth;
|
bandwidth = delayOrBandwidth;
|
||||||
break;
|
break;
|
||||||
|
@ -67,11 +67,13 @@ enum class RsDhtPeerRequest : uint8_t
|
|||||||
RUNNING = 2
|
RUNNING = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
#define RSDHT_TOU_MODE_NONE 0
|
enum class RsDhtTouMode : uint8_t
|
||||||
#define RSDHT_TOU_MODE_DIRECT 1
|
{
|
||||||
#define RSDHT_TOU_MODE_PROXY 2
|
NONE = 0,
|
||||||
#define RSDHT_TOU_MODE_RELAY 3
|
DIRECT = 1,
|
||||||
|
PROXY = 2,
|
||||||
|
RELAY = 3
|
||||||
|
};
|
||||||
|
|
||||||
#define RSDHT_RELAY_NUM_CLASS 4
|
#define RSDHT_RELAY_NUM_CLASS 4
|
||||||
|
|
||||||
@ -119,8 +121,8 @@ class RsDhtNetPeer
|
|||||||
|
|
||||||
std::string mConnectState; // connectLogic.
|
std::string mConnectState; // connectLogic.
|
||||||
|
|
||||||
RsDhtPeerConnectState mPeerConnectState; // connect Status
|
RsDhtPeerConnectState mPeerConnectState;
|
||||||
uint32_t mPeerConnectMode; // connect mode
|
RsDhtTouMode mPeerConnectMode;
|
||||||
bool mExclusiveProxyLock;
|
bool mExclusiveProxyLock;
|
||||||
|
|
||||||
std::string mPeerConnectProxyId;
|
std::string mPeerConnectProxyId;
|
||||||
|
@ -410,17 +410,17 @@ void DhtWindow::updateNetPeers()
|
|||||||
QString cpmstr;
|
QString cpmstr;
|
||||||
switch(status.mPeerConnectMode)
|
switch(status.mPeerConnectMode)
|
||||||
{
|
{
|
||||||
case RSDHT_TOU_MODE_DIRECT:
|
case RsDhtTouMode::DIRECT:
|
||||||
cpmstr = tr("Direct");
|
cpmstr = tr("Direct");
|
||||||
break;
|
break;
|
||||||
case RSDHT_TOU_MODE_PROXY:
|
case RsDhtTouMode::PROXY:
|
||||||
cpmstr = tr("Proxy VIA")+" " + QString::fromStdString(status.mPeerConnectProxyId);
|
cpmstr = tr("Proxy VIA")+" " + QString::fromStdString(status.mPeerConnectProxyId);
|
||||||
break;
|
break;
|
||||||
case RSDHT_TOU_MODE_RELAY:
|
case RsDhtTouMode::RELAY:
|
||||||
cpmstr = tr("Relay VIA")+" " + QString::fromStdString(status.mPeerConnectProxyId);
|
cpmstr = tr("Relay VIA")+" " + QString::fromStdString(status.mPeerConnectProxyId);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case RSDHT_TOU_MODE_NONE:
|
case RsDhtTouMode::NONE:
|
||||||
cpmstr = tr("None");
|
cpmstr = tr("None");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -444,13 +444,13 @@ void DhtWindow::updateNetPeers()
|
|||||||
switch(status.mPeerConnectMode)
|
switch(status.mPeerConnectMode)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case RSDHT_TOU_MODE_DIRECT:
|
case RsDhtTouMode::DIRECT:
|
||||||
++nDirectPeers;
|
++nDirectPeers;
|
||||||
break;
|
break;
|
||||||
case RSDHT_TOU_MODE_PROXY:
|
case RsDhtTouMode::PROXY:
|
||||||
++nProxyPeers;
|
++nProxyPeers;
|
||||||
break;
|
break;
|
||||||
case RSDHT_TOU_MODE_RELAY:
|
case RsDhtTouMode::RELAY:
|
||||||
++nRelayPeers;
|
++nRelayPeers;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user