mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 00:19:25 -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 */
|
||||
std::string mPeerReqStatusMsg;
|
||||
uint32_t mPeerReqState;
|
||||
RsDhtPeerRequest mPeerReqState;
|
||||
uint32_t mPeerReqMode;
|
||||
bdId mPeerReqProxyId;
|
||||
rstime_t mPeerReqTS;
|
||||
|
@ -263,7 +263,7 @@ int p3BitDht::OnlinePeerCallback_locked(const bdId *id, uint32_t /*status*/, Dht
|
||||
(void) id;
|
||||
|
||||
if ((dpd->mPeerConnectState != RsDhtPeerConnectState::DISCONNECTED) ||
|
||||
(dpd->mPeerReqState == RSDHT_PEERREQ_RUNNING))
|
||||
(dpd->mPeerReqState == RsDhtPeerRequest::RUNNING))
|
||||
{
|
||||
|
||||
#ifdef DEBUG_PEERNET
|
||||
@ -368,7 +368,7 @@ int p3BitDht::UnreachablePeerCallback_locked(const bdId *id, uint32_t /*status*/
|
||||
{
|
||||
|
||||
if ((dpd->mPeerConnectState != RsDhtPeerConnectState::DISCONNECTED) ||
|
||||
(dpd->mPeerReqState == RSDHT_PEERREQ_RUNNING))
|
||||
(dpd->mPeerReqState == RsDhtPeerRequest::RUNNING))
|
||||
{
|
||||
|
||||
#ifdef DEBUG_PEERNET
|
||||
@ -989,7 +989,7 @@ int p3BitDht::ConnectCallback(const bdId *srcId, const bdId *proxyId, const bdId
|
||||
|
||||
dpd->mPeerReqStatusMsg = "STOPPED: ";
|
||||
dpd->mPeerReqStatusMsg += decodeConnectionError(errcode);
|
||||
dpd->mPeerReqState = RSDHT_PEERREQ_STOPPED;
|
||||
dpd->mPeerReqState = RsDhtPeerRequest::STOPPED;
|
||||
dpd->mPeerReqTS = now;
|
||||
|
||||
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.
|
||||
{
|
||||
dpd->mPeerReqStatusMsg = "Connect Attempt";
|
||||
dpd->mPeerReqState = RSDHT_PEERREQ_RUNNING;
|
||||
dpd->mPeerReqState = RsDhtPeerRequest::RUNNING;
|
||||
dpd->mPeerReqMode = mode;
|
||||
dpd->mPeerReqProxyId = *proxyId;
|
||||
dpd->mPeerReqTS = now;
|
||||
@ -1391,7 +1391,7 @@ int p3BitDht::doActions()
|
||||
if (dpd)
|
||||
{
|
||||
dpd->mPeerReqStatusMsg = "Connect Request";
|
||||
dpd->mPeerReqState = RSDHT_PEERREQ_RUNNING;
|
||||
dpd->mPeerReqState = RsDhtPeerRequest::RUNNING;
|
||||
dpd->mPeerReqMode = action.mMode;
|
||||
dpd->mPeerReqTS = now;
|
||||
|
||||
@ -1434,7 +1434,7 @@ int p3BitDht::doActions()
|
||||
dpd->mConnectLogic.updateCb(failReason);
|
||||
|
||||
dpd->mPeerReqStatusMsg = "Req Mode Unavailable";
|
||||
dpd->mPeerReqState = RSDHT_PEERREQ_STOPPED;
|
||||
dpd->mPeerReqState = RsDhtPeerRequest::STOPPED;
|
||||
dpd->mPeerReqMode = action.mMode;
|
||||
dpd->mPeerReqTS = now;
|
||||
|
||||
@ -1756,7 +1756,7 @@ int p3BitDht::checkConnectionAllowed(const bdId *peerId, int mode)
|
||||
it->second.mPeerCbMsg = "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.mPeerReqMode = 0;
|
||||
//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);
|
||||
|
||||
// Remove the Connection Request.
|
||||
if (dpd->mPeerReqState == RSDHT_PEERREQ_RUNNING)
|
||||
if (dpd->mPeerReqState == RsDhtPeerRequest::RUNNING)
|
||||
{
|
||||
#ifdef DEBUG_PEERNET
|
||||
std::cerr << "p3BitDht::monitorConnections() Request Active, Stopping Request";
|
||||
@ -2345,7 +2345,7 @@ void p3BitDht::UdpConnectionFailed_locked(DhtPeerDetails *dpd)
|
||||
/* shut it down */
|
||||
|
||||
/* 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);
|
||||
}
|
||||
@ -2370,7 +2370,7 @@ void p3BitDht::UdpConnectionFailed_locked(DhtPeerDetails *dpd)
|
||||
|
||||
|
||||
|
||||
if (dpd->mPeerReqState == RSDHT_PEERREQ_RUNNING)
|
||||
if (dpd->mPeerReqState == RsDhtPeerRequest::RUNNING)
|
||||
{
|
||||
#ifdef DEBUG_PEERNET
|
||||
std::cerr << "p3BitDht::UdpConnectionFailed_locked() ";
|
||||
|
@ -723,7 +723,7 @@ DhtPeerDetails::DhtPeerDetails()
|
||||
mDhtUpdateTS = time(NULL);
|
||||
|
||||
mPeerReqStatusMsg = "Just Added";
|
||||
mPeerReqState = RSDHT_PEERREQ_STOPPED;
|
||||
mPeerReqState = RsDhtPeerRequest::STOPPED;
|
||||
mPeerReqMode = 0;
|
||||
//mPeerReqProxyId;
|
||||
mPeerReqTS = time(NULL);
|
||||
|
@ -61,8 +61,11 @@ enum class RsDhtPeerConnectState : uint8_t
|
||||
CONNECTED = 3
|
||||
};
|
||||
|
||||
#define RSDHT_PEERREQ_STOPPED 1
|
||||
#define RSDHT_PEERREQ_RUNNING 2
|
||||
enum class RsDhtPeerRequest : uint8_t
|
||||
{
|
||||
STOPPED = 1,
|
||||
RUNNING = 2
|
||||
};
|
||||
|
||||
#define RSDHT_TOU_MODE_NONE 0
|
||||
#define RSDHT_TOU_MODE_DIRECT 1
|
||||
@ -122,7 +125,7 @@ class RsDhtNetPeer
|
||||
|
||||
std::string mPeerConnectProxyId;
|
||||
|
||||
uint32_t mPeerReqState; // Req Status.
|
||||
RsDhtPeerRequest mPeerReqState;
|
||||
std::string mCbPeerMsg; // Peer Cb Mgs.
|
||||
|
||||
};
|
||||
|
@ -477,10 +477,10 @@ void DhtWindow::updateNetPeers()
|
||||
}
|
||||
switch(status.mPeerReqState)
|
||||
{
|
||||
case RSDHT_PEERREQ_RUNNING:
|
||||
case RsDhtPeerRequest::RUNNING:
|
||||
reqstr += tr("Request Active");
|
||||
break;
|
||||
case RSDHT_PEERREQ_STOPPED:
|
||||
case RsDhtPeerRequest::STOPPED:
|
||||
reqstr += tr("No Request");
|
||||
break;
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user