mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-29 01:16:20 -05:00
convert RSDHT_PEERREQ_ to enum class
This commit is contained in:
parent
fcaabb1922
commit
46d77bfe7a
@ -77,7 +77,7 @@ class DhtPeerDetails
|
|||||||
|
|
||||||
/* Connection Request Status */
|
/* Connection Request Status */
|
||||||
std::string mPeerReqStatusMsg;
|
std::string mPeerReqStatusMsg;
|
||||||
uint32_t mPeerReqState;
|
RsDhtPeerRequest mPeerReqState;
|
||||||
uint32_t mPeerReqMode;
|
uint32_t mPeerReqMode;
|
||||||
bdId mPeerReqProxyId;
|
bdId mPeerReqProxyId;
|
||||||
rstime_t mPeerReqTS;
|
rstime_t mPeerReqTS;
|
||||||
|
@ -263,7 +263,7 @@ int p3BitDht::OnlinePeerCallback_locked(const bdId *id, uint32_t /*status*/, Dht
|
|||||||
(void) id;
|
(void) id;
|
||||||
|
|
||||||
if ((dpd->mPeerConnectState != RsDhtPeerConnectState::DISCONNECTED) ||
|
if ((dpd->mPeerConnectState != RsDhtPeerConnectState::DISCONNECTED) ||
|
||||||
(dpd->mPeerReqState == RSDHT_PEERREQ_RUNNING))
|
(dpd->mPeerReqState == RsDhtPeerRequest::RUNNING))
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef DEBUG_PEERNET
|
#ifdef DEBUG_PEERNET
|
||||||
@ -368,7 +368,7 @@ int p3BitDht::UnreachablePeerCallback_locked(const bdId *id, uint32_t /*status*/
|
|||||||
{
|
{
|
||||||
|
|
||||||
if ((dpd->mPeerConnectState != RsDhtPeerConnectState::DISCONNECTED) ||
|
if ((dpd->mPeerConnectState != RsDhtPeerConnectState::DISCONNECTED) ||
|
||||||
(dpd->mPeerReqState == RSDHT_PEERREQ_RUNNING))
|
(dpd->mPeerReqState == RsDhtPeerRequest::RUNNING))
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef DEBUG_PEERNET
|
#ifdef DEBUG_PEERNET
|
||||||
@ -989,7 +989,7 @@ int p3BitDht::ConnectCallback(const bdId *srcId, const bdId *proxyId, const bdId
|
|||||||
|
|
||||||
dpd->mPeerReqStatusMsg = "STOPPED: ";
|
dpd->mPeerReqStatusMsg = "STOPPED: ";
|
||||||
dpd->mPeerReqStatusMsg += decodeConnectionError(errcode);
|
dpd->mPeerReqStatusMsg += decodeConnectionError(errcode);
|
||||||
dpd->mPeerReqState = RSDHT_PEERREQ_STOPPED;
|
dpd->mPeerReqState = RsDhtPeerRequest::STOPPED;
|
||||||
dpd->mPeerReqTS = now;
|
dpd->mPeerReqTS = now;
|
||||||
|
|
||||||
int updatecode = CSB_UPDATE_FAILED_ATTEMPT;
|
int updatecode = CSB_UPDATE_FAILED_ATTEMPT;
|
||||||
@ -1048,7 +1048,7 @@ int p3BitDht::ConnectCallback(const bdId *srcId, const bdId *proxyId, const bdId
|
|||||||
else // a new connection attempt.
|
else // a new connection attempt.
|
||||||
{
|
{
|
||||||
dpd->mPeerReqStatusMsg = "Connect Attempt";
|
dpd->mPeerReqStatusMsg = "Connect Attempt";
|
||||||
dpd->mPeerReqState = RSDHT_PEERREQ_RUNNING;
|
dpd->mPeerReqState = RsDhtPeerRequest::RUNNING;
|
||||||
dpd->mPeerReqMode = mode;
|
dpd->mPeerReqMode = mode;
|
||||||
dpd->mPeerReqProxyId = *proxyId;
|
dpd->mPeerReqProxyId = *proxyId;
|
||||||
dpd->mPeerReqTS = now;
|
dpd->mPeerReqTS = now;
|
||||||
@ -1391,7 +1391,7 @@ int p3BitDht::doActions()
|
|||||||
if (dpd)
|
if (dpd)
|
||||||
{
|
{
|
||||||
dpd->mPeerReqStatusMsg = "Connect Request";
|
dpd->mPeerReqStatusMsg = "Connect Request";
|
||||||
dpd->mPeerReqState = RSDHT_PEERREQ_RUNNING;
|
dpd->mPeerReqState = RsDhtPeerRequest::RUNNING;
|
||||||
dpd->mPeerReqMode = action.mMode;
|
dpd->mPeerReqMode = action.mMode;
|
||||||
dpd->mPeerReqTS = now;
|
dpd->mPeerReqTS = now;
|
||||||
|
|
||||||
@ -1434,7 +1434,7 @@ int p3BitDht::doActions()
|
|||||||
dpd->mConnectLogic.updateCb(failReason);
|
dpd->mConnectLogic.updateCb(failReason);
|
||||||
|
|
||||||
dpd->mPeerReqStatusMsg = "Req Mode Unavailable";
|
dpd->mPeerReqStatusMsg = "Req Mode Unavailable";
|
||||||
dpd->mPeerReqState = RSDHT_PEERREQ_STOPPED;
|
dpd->mPeerReqState = RsDhtPeerRequest::STOPPED;
|
||||||
dpd->mPeerReqMode = action.mMode;
|
dpd->mPeerReqMode = action.mMode;
|
||||||
dpd->mPeerReqTS = now;
|
dpd->mPeerReqTS = now;
|
||||||
|
|
||||||
@ -1756,7 +1756,7 @@ int p3BitDht::checkConnectionAllowed(const bdId *peerId, int mode)
|
|||||||
it->second.mPeerCbMsg = "Denied Non-Friend";
|
it->second.mPeerCbMsg = "Denied Non-Friend";
|
||||||
|
|
||||||
it->second.mPeerReqStatusMsg = "Denied Non-Friend";
|
it->second.mPeerReqStatusMsg = "Denied Non-Friend";
|
||||||
it->second.mPeerReqState = RSDHT_PEERREQ_STOPPED;
|
it->second.mPeerReqState = RsDhtPeerRequest::STOPPED;
|
||||||
it->second.mPeerReqTS = now;
|
it->second.mPeerReqTS = now;
|
||||||
it->second.mPeerReqMode = 0;
|
it->second.mPeerReqMode = 0;
|
||||||
//it->second.mPeerProxyId;
|
//it->second.mPeerProxyId;
|
||||||
@ -2250,7 +2250,7 @@ void p3BitDht::Feedback_Connected(const RsPeerId& pid)
|
|||||||
rs_sprintf(dpd->mPeerConnectMsg, "Connected in %ld secs", dpd->mPeerConnectTS - dpd->mPeerConnectUdpTS);
|
rs_sprintf(dpd->mPeerConnectMsg, "Connected in %ld secs", dpd->mPeerConnectTS - dpd->mPeerConnectUdpTS);
|
||||||
|
|
||||||
// Remove the Connection Request.
|
// Remove the Connection Request.
|
||||||
if (dpd->mPeerReqState == RSDHT_PEERREQ_RUNNING)
|
if (dpd->mPeerReqState == RsDhtPeerRequest::RUNNING)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_PEERNET
|
#ifdef DEBUG_PEERNET
|
||||||
std::cerr << "p3BitDht::monitorConnections() Request Active, Stopping Request";
|
std::cerr << "p3BitDht::monitorConnections() Request Active, Stopping Request";
|
||||||
@ -2345,7 +2345,7 @@ void p3BitDht::UdpConnectionFailed_locked(DhtPeerDetails *dpd)
|
|||||||
/* shut it down */
|
/* shut it down */
|
||||||
|
|
||||||
/* ONLY need to update ConnectLogic - if it was our Attempt Running */
|
/* ONLY need to update ConnectLogic - if it was our Attempt Running */
|
||||||
if (dpd->mPeerReqState == RSDHT_PEERREQ_RUNNING)
|
if (dpd->mPeerReqState == RsDhtPeerRequest::RUNNING)
|
||||||
{
|
{
|
||||||
dpd->mConnectLogic.updateCb(CSB_UPDATE_FAILED_ATTEMPT);
|
dpd->mConnectLogic.updateCb(CSB_UPDATE_FAILED_ATTEMPT);
|
||||||
}
|
}
|
||||||
@ -2370,7 +2370,7 @@ void p3BitDht::UdpConnectionFailed_locked(DhtPeerDetails *dpd)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (dpd->mPeerReqState == RSDHT_PEERREQ_RUNNING)
|
if (dpd->mPeerReqState == RsDhtPeerRequest::RUNNING)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_PEERNET
|
#ifdef DEBUG_PEERNET
|
||||||
std::cerr << "p3BitDht::UdpConnectionFailed_locked() ";
|
std::cerr << "p3BitDht::UdpConnectionFailed_locked() ";
|
||||||
|
@ -723,7 +723,7 @@ DhtPeerDetails::DhtPeerDetails()
|
|||||||
mDhtUpdateTS = time(NULL);
|
mDhtUpdateTS = time(NULL);
|
||||||
|
|
||||||
mPeerReqStatusMsg = "Just Added";
|
mPeerReqStatusMsg = "Just Added";
|
||||||
mPeerReqState = RSDHT_PEERREQ_STOPPED;
|
mPeerReqState = RsDhtPeerRequest::STOPPED;
|
||||||
mPeerReqMode = 0;
|
mPeerReqMode = 0;
|
||||||
//mPeerReqProxyId;
|
//mPeerReqProxyId;
|
||||||
mPeerReqTS = time(NULL);
|
mPeerReqTS = time(NULL);
|
||||||
|
@ -61,8 +61,11 @@ enum class RsDhtPeerConnectState : uint8_t
|
|||||||
CONNECTED = 3
|
CONNECTED = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
#define RSDHT_PEERREQ_STOPPED 1
|
enum class RsDhtPeerRequest : uint8_t
|
||||||
#define RSDHT_PEERREQ_RUNNING 2
|
{
|
||||||
|
STOPPED = 1,
|
||||||
|
RUNNING = 2
|
||||||
|
};
|
||||||
|
|
||||||
#define RSDHT_TOU_MODE_NONE 0
|
#define RSDHT_TOU_MODE_NONE 0
|
||||||
#define RSDHT_TOU_MODE_DIRECT 1
|
#define RSDHT_TOU_MODE_DIRECT 1
|
||||||
@ -122,7 +125,7 @@ class RsDhtNetPeer
|
|||||||
|
|
||||||
std::string mPeerConnectProxyId;
|
std::string mPeerConnectProxyId;
|
||||||
|
|
||||||
uint32_t mPeerReqState; // Req Status.
|
RsDhtPeerRequest mPeerReqState;
|
||||||
std::string mCbPeerMsg; // Peer Cb Mgs.
|
std::string mCbPeerMsg; // Peer Cb Mgs.
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -477,10 +477,10 @@ void DhtWindow::updateNetPeers()
|
|||||||
}
|
}
|
||||||
switch(status.mPeerReqState)
|
switch(status.mPeerReqState)
|
||||||
{
|
{
|
||||||
case RSDHT_PEERREQ_RUNNING:
|
case RsDhtPeerRequest::RUNNING:
|
||||||
reqstr += tr("Request Active");
|
reqstr += tr("Request Active");
|
||||||
break;
|
break;
|
||||||
case RSDHT_PEERREQ_STOPPED:
|
case RsDhtPeerRequest::STOPPED:
|
||||||
reqstr += tr("No Request");
|
reqstr += tr("No Request");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user