mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-17 10:31:05 -04:00
id cleaning - continued
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-IdCleaning@7092 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
33ab4ee3b5
commit
c4c8414a79
23 changed files with 380 additions and 389 deletions
|
@ -120,7 +120,7 @@ peerConnectState::peerConnectState()
|
|||
|
||||
std::string textPeerConnectState(peerConnectState &state)
|
||||
{
|
||||
return "Id: " + state.id + "\n";
|
||||
return "Id: " + state.id.toStdString() + "\n";
|
||||
}
|
||||
|
||||
/*********
|
||||
|
@ -182,11 +182,11 @@ bool p3LinkMgrIMPL::getLocalAddress(struct sockaddr_storage &addr)
|
|||
}
|
||||
|
||||
|
||||
bool p3LinkMgrIMPL::isOnline(const std::string &ssl_id)
|
||||
bool p3LinkMgrIMPL::isOnline(const RsPeerId &ssl_id)
|
||||
{
|
||||
RsStackMutex stack(mLinkMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
std::map<RsPeerId, peerConnectState>::iterator it;
|
||||
it = mFriendList.find(ssl_id);
|
||||
if (it == mFriendList.end())
|
||||
{
|
||||
|
@ -202,11 +202,11 @@ bool p3LinkMgrIMPL::isOnline(const std::string &ssl_id)
|
|||
|
||||
|
||||
|
||||
uint32_t p3LinkMgrIMPL::getLinkType(const std::string &ssl_id)
|
||||
uint32_t p3LinkMgrIMPL::getLinkType(const RsPeerId &ssl_id)
|
||||
{
|
||||
RsStackMutex stack(mLinkMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
std::map<RsPeerId, peerConnectState>::iterator it;
|
||||
it = mFriendList.find(ssl_id);
|
||||
if (it == mFriendList.end())
|
||||
{
|
||||
|
@ -222,11 +222,11 @@ uint32_t p3LinkMgrIMPL::getLinkType(const std::string &ssl_id)
|
|||
|
||||
|
||||
|
||||
void p3LinkMgrIMPL::getOnlineList(std::list<std::string> &ssl_peers)
|
||||
void p3LinkMgrIMPL::getOnlineList(std::list<RsPeerId> &ssl_peers)
|
||||
{
|
||||
RsStackMutex stack(mLinkMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
std::map<RsPeerId, peerConnectState>::iterator it;
|
||||
for(it = mFriendList.begin(); it != mFriendList.end(); it++)
|
||||
{
|
||||
if (it->second.state & RS_PEER_S_CONNECTED)
|
||||
|
@ -237,11 +237,11 @@ void p3LinkMgrIMPL::getOnlineList(std::list<std::string> &ssl_peers)
|
|||
return;
|
||||
}
|
||||
|
||||
void p3LinkMgrIMPL::getFriendList(std::list<std::string> &ssl_peers)
|
||||
void p3LinkMgrIMPL::getFriendList(std::list<RsPeerId> &ssl_peers)
|
||||
{
|
||||
RsStackMutex stack(mLinkMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
std::map<RsPeerId, peerConnectState>::iterator it;
|
||||
for(it = mFriendList.begin(); it != mFriendList.end(); it++)
|
||||
{
|
||||
ssl_peers.push_back(it->first);
|
||||
|
@ -249,17 +249,17 @@ void p3LinkMgrIMPL::getFriendList(std::list<std::string> &ssl_peers)
|
|||
return;
|
||||
}
|
||||
|
||||
bool p3LinkMgrIMPL::getPeerName(const std::string &ssl_id, std::string &name)
|
||||
bool p3LinkMgrIMPL::getPeerName(const RsPeerId &ssl_id, std::string &name)
|
||||
{
|
||||
return mPeerMgr->getPeerName(ssl_id, name);
|
||||
}
|
||||
|
||||
|
||||
bool p3LinkMgrIMPL::getFriendNetStatus(const std::string &id, peerConnectState &state)
|
||||
bool p3LinkMgrIMPL::getFriendNetStatus(const RsPeerId &id, peerConnectState &state)
|
||||
{
|
||||
RsStackMutex stack(mLinkMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
std::map<RsPeerId, peerConnectState>::iterator it;
|
||||
it = mFriendList.find(id);
|
||||
if (it == mFriendList.end())
|
||||
{
|
||||
|
@ -273,13 +273,13 @@ bool p3LinkMgrIMPL::getFriendNetStatus(const std::string &id, peerConnectStat
|
|||
|
||||
|
||||
|
||||
void p3LinkMgrIMPL::setFriendVisibility(const std::string &id, bool isVisible)
|
||||
void p3LinkMgrIMPL::setFriendVisibility(const RsPeerId &id, bool isVisible)
|
||||
{
|
||||
/* set visibility */
|
||||
{
|
||||
RsStackMutex stack(mLinkMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
std::map<RsPeerId, peerConnectState>::iterator it;
|
||||
it = mFriendList.find(id);
|
||||
if (it == mFriendList.end())
|
||||
{
|
||||
|
@ -327,8 +327,8 @@ void p3LinkMgrIMPL::statusTick()
|
|||
#ifdef LINKMGR_DEBUG_TICK
|
||||
std::cerr << "p3LinkMgrIMPL::statusTick()" << std::endl;
|
||||
#endif
|
||||
std::list<std::string> retryIds;
|
||||
std::list<std::string>::iterator it2;
|
||||
std::list<RsPeerId> retryIds;
|
||||
std::list<RsPeerId>::iterator it2;
|
||||
//std::list<std::string> dummyToRemove;
|
||||
|
||||
{
|
||||
|
@ -337,7 +337,7 @@ void p3LinkMgrIMPL::statusTick()
|
|||
time_t retry = now - mRetryPeriod;
|
||||
|
||||
RsStackMutex stack(mLinkMtx); /****** LOCK MUTEX ******/
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
std::map<RsPeerId, peerConnectState>::iterator it;
|
||||
for(it = mFriendList.begin(); it != mFriendList.end(); it++)
|
||||
{
|
||||
if (it->second.state & RS_PEER_S_CONNECTED)
|
||||
|
@ -421,7 +421,7 @@ void p3LinkMgrIMPL::tickMonitors()
|
|||
{
|
||||
bool doStatusChange = false;
|
||||
std::list<pqipeer> actionList;
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
std::map<RsPeerId, peerConnectState>::iterator it;
|
||||
|
||||
{
|
||||
RsStackMutex stack(mLinkMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
@ -449,7 +449,7 @@ void p3LinkMgrIMPL::tickMonitors()
|
|||
actionList.push_back(peer);
|
||||
|
||||
#ifdef LINKMGR_DEBUG_ACTIONS
|
||||
std::cerr << "Friend: " << peer.name << " Id: " << peer.id << " State: " << peer.state;
|
||||
std::cerr << "Friend: " << peer.name << " Id: " << peer.id.toStdString() << " State: " << peer.state;
|
||||
if (peer.state & RS_PEER_S_FRIEND)
|
||||
std::cerr << " S:RS_PEER_S_FRIEND";
|
||||
if (peer.state & RS_PEER_S_ONLINE)
|
||||
|
@ -500,7 +500,7 @@ void p3LinkMgrIMPL::tickMonitors()
|
|||
it->second.actions = 0;
|
||||
|
||||
#ifdef LINKMGR_DEBUG_ACTIONS
|
||||
std::cerr << "Other: " << peer.name << " Id: " << peer.id << " State: " << peer.state;
|
||||
std::cerr << "Other: " << peer.name << " Id: " << peer.id.toStdString() << " State: " << peer.state;
|
||||
if (peer.state & RS_PEER_S_FRIEND)
|
||||
std::cerr << " S:RS_PEER_S_FRIEND";
|
||||
if (peer.state & RS_PEER_S_ONLINE)
|
||||
|
@ -576,13 +576,13 @@ void p3LinkMgrIMPL::tickMonitors()
|
|||
}
|
||||
|
||||
|
||||
const std::string p3LinkMgrIMPL::getOwnId()
|
||||
const RsPeerId p3LinkMgrIMPL::getOwnId()
|
||||
{
|
||||
return AuthSSL::getAuthSSL()->OwnId();
|
||||
}
|
||||
|
||||
|
||||
bool p3LinkMgrIMPL::connectAttempt(const std::string &id, struct sockaddr_storage &raddr,
|
||||
bool p3LinkMgrIMPL::connectAttempt(const RsPeerId &id, struct sockaddr_storage &raddr,
|
||||
struct sockaddr_storage &proxyaddr,
|
||||
struct sockaddr_storage &srcaddr,
|
||||
uint32_t &delay, uint32_t &period, uint32_t &type, uint32_t &flags, uint32_t &bandwidth,
|
||||
|
@ -592,7 +592,7 @@ bool p3LinkMgrIMPL::connectAttempt(const std::string &id, struct sockaddr_storag
|
|||
RsStackMutex stack(mLinkMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
/* check for existing */
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
std::map<RsPeerId, peerConnectState>::iterator it;
|
||||
it = mFriendList.find(id);
|
||||
if (it == mFriendList.end())
|
||||
{
|
||||
|
@ -774,7 +774,7 @@ bool p3LinkMgrIMPL::connectAttempt(const std::string &id, struct sockaddr_storag
|
|||
*
|
||||
*/
|
||||
|
||||
bool p3LinkMgrIMPL::connectResult(const std::string &id, bool success, uint32_t flags, const struct sockaddr_storage &remote_peer_address)
|
||||
bool p3LinkMgrIMPL::connectResult(const RsPeerId &id, bool success, uint32_t flags, const struct sockaddr_storage &remote_peer_address)
|
||||
{
|
||||
bool doDhtAssist = false ;
|
||||
bool updatePeerAddr = false;
|
||||
|
@ -791,7 +791,7 @@ bool p3LinkMgrIMPL::connectResult(const std::string &id, bool success, uint32_t
|
|||
return false;
|
||||
}
|
||||
/* check for existing */
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
std::map<RsPeerId, peerConnectState>::iterator it;
|
||||
it = mFriendList.find(id);
|
||||
if (it == mFriendList.end())
|
||||
{
|
||||
|
@ -806,7 +806,7 @@ bool p3LinkMgrIMPL::connectResult(const std::string &id, bool success, uint32_t
|
|||
/* now we can tell if we think we were connected - proper point to log */
|
||||
|
||||
{
|
||||
std::string out = "p3LinkMgrIMPL::connectResult() id: " + id;
|
||||
std::string out = "p3LinkMgrIMPL::connectResult() id: " + id.toStdString();
|
||||
if (success)
|
||||
{
|
||||
out += " SUCCESS ";
|
||||
|
@ -1030,7 +1030,7 @@ bool p3LinkMgrIMPL::connectResult(const std::string &id, bool success, uint32_t
|
|||
*/
|
||||
|
||||
// from pqissl, when a connection failed due to security
|
||||
void p3LinkMgrIMPL::notifyDeniedConnection(const std::string& gpgid,const std::string& sslid,const std::string& sslcn,const struct sockaddr_storage &addr, bool incoming)
|
||||
void p3LinkMgrIMPL::notifyDeniedConnection(const PGPIdType& gpgid,const RsPeerId& sslid,const std::string& sslcn,const struct sockaddr_storage &addr, bool incoming)
|
||||
{
|
||||
std::cerr << "p3LinkMgrIMPL::notifyDeniedConnection()";
|
||||
std::cerr << " pgpid: " << gpgid;
|
||||
|
@ -1040,7 +1040,7 @@ void p3LinkMgrIMPL::notifyDeniedConnection(const std::string& gpgid,const std::
|
|||
|
||||
RsStackMutex stack(mLinkMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
std::map<RsPeerId, peerConnectState>::iterator it;
|
||||
it = mFriendList.find(sslid);
|
||||
if (it == mFriendList.end())
|
||||
{
|
||||
|
@ -1070,12 +1070,12 @@ void p3LinkMgrIMPL::notifyDeniedConnection(const std::string& gpgid,const std::
|
|||
}
|
||||
|
||||
|
||||
void p3LinkMgrIMPL::peerStatus(std::string id, const pqiIpAddrSet &addrs,
|
||||
void p3LinkMgrIMPL::peerStatus(const RsPeerId& id, const pqiIpAddrSet &addrs,
|
||||
uint32_t type, uint32_t flags, uint32_t source)
|
||||
{
|
||||
/* HACKED UP FIX ****/
|
||||
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
std::map<RsPeerId, peerConnectState>::iterator it;
|
||||
bool isFriend = true;
|
||||
|
||||
time_t now = time(NULL);
|
||||
|
@ -1344,7 +1344,7 @@ void p3LinkMgrIMPL::peerStatus(std::string id, const pqiIpAddrSet &addrs,
|
|||
}
|
||||
|
||||
/* This has become very unwieldy - as extra arguments are required for UDP connections */
|
||||
void p3LinkMgrIMPL::peerConnectRequest(std::string id, const struct sockaddr_storage &raddr, const struct sockaddr_storage &proxyaddr, const struct sockaddr_storage &srcaddr,
|
||||
void p3LinkMgrIMPL::peerConnectRequest(const RsPeerId& id, const struct sockaddr_storage &raddr, const struct sockaddr_storage &proxyaddr, const struct sockaddr_storage &srcaddr,
|
||||
uint32_t source, uint32_t flags, uint32_t delay, uint32_t bandwidth)
|
||||
{
|
||||
#ifdef LINKMGR_DEBUG
|
||||
|
@ -1397,7 +1397,7 @@ void p3LinkMgrIMPL::peerConnectRequest(std::string id, const struct sockaddr_
|
|||
{
|
||||
RsStackMutex stack(mLinkMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
std::map<RsPeerId, peerConnectState>::iterator it;
|
||||
if (mFriendList.end() == (it = mFriendList.find(id)))
|
||||
{
|
||||
#ifdef LINKMGR_DEBUG
|
||||
|
@ -1449,7 +1449,7 @@ void p3LinkMgrIMPL::peerConnectRequest(std::string id, const struct sockaddr_
|
|||
/*******************************************************************/
|
||||
/*******************************************************************/
|
||||
/*************** External Control ****************/
|
||||
bool p3LinkMgrIMPL::retryConnect(const std::string &id)
|
||||
bool p3LinkMgrIMPL::retryConnect(const RsPeerId &id)
|
||||
{
|
||||
/* push all available addresses onto the connect addr stack */
|
||||
#ifdef LINKMGR_DEBUG
|
||||
|
@ -1467,7 +1467,7 @@ bool p3LinkMgrIMPL::retryConnect(const std::string &id)
|
|||
|
||||
|
||||
|
||||
bool p3LinkMgrIMPL::tryConnectUDP(const std::string &id, const struct sockaddr_storage &rUdpAddr,
|
||||
bool p3LinkMgrIMPL::tryConnectUDP(const RsPeerId &id, const struct sockaddr_storage &rUdpAddr,
|
||||
const struct sockaddr_storage &proxyaddr, const struct sockaddr_storage &srcaddr,
|
||||
uint32_t flags, uint32_t delay, uint32_t bandwidth)
|
||||
|
||||
|
@ -1514,7 +1514,7 @@ bool p3LinkMgrIMPL::tryConnectUDP(const std::string &id, const struct sockaddr
|
|||
}
|
||||
|
||||
/* look up the id */
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
std::map<RsPeerId, peerConnectState>::iterator it;
|
||||
if (mFriendList.end() == (it = mFriendList.find(id)))
|
||||
{
|
||||
#ifdef LINKMGR_DEBUG
|
||||
|
@ -1564,7 +1564,7 @@ bool p3LinkMgrIMPL::tryConnectUDP(const std::string &id, const struct sockaddr
|
|||
|
||||
|
||||
|
||||
bool p3LinkMgrIMPL::retryConnectTCP(const std::string &id)
|
||||
bool p3LinkMgrIMPL::retryConnectTCP(const RsPeerId &id)
|
||||
{
|
||||
/* Check if we should retry first */
|
||||
{
|
||||
|
@ -1589,7 +1589,7 @@ bool p3LinkMgrIMPL::retryConnectTCP(const std::string &id)
|
|||
}
|
||||
|
||||
/* look up the id */
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
std::map<RsPeerId, peerConnectState>::iterator it;
|
||||
if (mFriendList.end() == (it = mFriendList.find(id)))
|
||||
{
|
||||
#ifdef LINKMGR_DEBUG
|
||||
|
@ -1626,7 +1626,7 @@ bool p3LinkMgrIMPL::retryConnectTCP(const std::string &id)
|
|||
{
|
||||
RsStackMutex stack(mLinkMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
std::map<RsPeerId, peerConnectState>::iterator it;
|
||||
if (mFriendList.end() != (it = mFriendList.find(id)))
|
||||
{
|
||||
locked_ConnectAttempt_ProxyAddress(&(it->second), proxy_addr, domain_addr, domain_port);
|
||||
|
@ -1652,7 +1652,7 @@ bool p3LinkMgrIMPL::retryConnectTCP(const std::string &id)
|
|||
{
|
||||
RsStackMutex stack(mLinkMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
std::map<RsPeerId, peerConnectState>::iterator it;
|
||||
if (mFriendList.end() != (it = mFriendList.find(id)))
|
||||
{
|
||||
locked_ConnectAttempt_CurrentAddresses(&(it->second), lAddr, eAddr);
|
||||
|
@ -2125,7 +2125,7 @@ bool p3LinkMgrIMPL::locked_ConnectAttempt_Complete(peerConnectState *peer)
|
|||
************************************* Handling of Friends *************************************************
|
||||
***********************************************************************************************************/
|
||||
|
||||
int p3LinkMgrIMPL::addFriend(const std::string &id, bool isVisible)
|
||||
int p3LinkMgrIMPL::addFriend(const RsPeerId &id, bool isVisible)
|
||||
{
|
||||
rslog(RSL_WARNING, p3connectzone, "p3LinkMgr::addFriend() id: " + id);
|
||||
|
||||
|
@ -2137,7 +2137,7 @@ int p3LinkMgrIMPL::addFriend(const std::string &id, bool isVisible)
|
|||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
std::map<RsPeerId, peerConnectState>::iterator it;
|
||||
it = mFriendList.find(id);
|
||||
|
||||
if (it != mFriendList.end())
|
||||
|
@ -2166,7 +2166,7 @@ int p3LinkMgrIMPL::addFriend(const std::string &id, bool isVisible)
|
|||
}
|
||||
|
||||
|
||||
int p3LinkMgrIMPL::removeFriend(const std::string &id)
|
||||
int p3LinkMgrIMPL::removeFriend(const RsPeerId &id)
|
||||
{
|
||||
rslog(RSL_WARNING, p3connectzone, "p3LinkMgr::removeFriend() id: " + id);
|
||||
|
||||
|
@ -2178,7 +2178,7 @@ int p3LinkMgrIMPL::removeFriend(const std::string &id)
|
|||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
std::map<RsPeerId, peerConnectState>::iterator it;
|
||||
it = mFriendList.find(id);
|
||||
|
||||
if (it == mFriendList.end())
|
||||
|
@ -2218,10 +2218,10 @@ void p3LinkMgrIMPL::printPeerLists(std::ostream &out)
|
|||
out << std::endl;
|
||||
|
||||
|
||||
std::map<std::string, peerConnectState>::iterator it;
|
||||
std::map<RsPeerId, peerConnectState>::iterator it;
|
||||
for(it = mFriendList.begin(); it != mFriendList.end(); it++)
|
||||
{
|
||||
out << "\t SSL ID: " << it->second.id;
|
||||
out << "\t SSL ID: " << it->second.id.toStdString();
|
||||
out << "\t State: " << it->second.state;
|
||||
out << std::endl;
|
||||
}
|
||||
|
@ -2230,7 +2230,7 @@ void p3LinkMgrIMPL::printPeerLists(std::ostream &out)
|
|||
out << std::endl;
|
||||
for(it = mOthersList.begin(); it != mOthersList.end(); it++)
|
||||
{
|
||||
out << "\t SSL ID: " << it->second.id;
|
||||
out << "\t SSL ID: " << it->second.id.toStdString();
|
||||
out << "\t State: " << it->second.state;
|
||||
}
|
||||
}
|
||||
|
@ -2242,7 +2242,7 @@ void p3LinkMgrIMPL::printPeerLists(std::ostream &out)
|
|||
void printConnectState(std::ostream &out, peerConnectState &peer)
|
||||
{
|
||||
|
||||
out << "Friend: " << peer.name << " Id: " << peer.id << " State: " << peer.state;
|
||||
out << "Friend: " << peer.name << " Id: " << peer.id.toStdString() << " State: " << peer.state;
|
||||
if (peer.state & RS_PEER_S_FRIEND)
|
||||
out << " S:RS_PEER_S_FRIEND";
|
||||
if (peer.state & RS_PEER_S_ONLINE)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue