mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
change the removing af dummy friends
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2049 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
de1f223d7d
commit
0d06dbe55b
@ -463,6 +463,7 @@ void p3ConnectMgr::statusTick()
|
|||||||
#endif
|
#endif
|
||||||
std::list<std::string> retryIds;
|
std::list<std::string> retryIds;
|
||||||
std::list<std::string>::iterator it2;
|
std::list<std::string>::iterator it2;
|
||||||
|
std::list<std::string> dummyToRemove;
|
||||||
|
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
time_t oldavail = now - MAX_AVAIL_PERIOD;
|
time_t oldavail = now - MAX_AVAIL_PERIOD;
|
||||||
@ -473,6 +474,18 @@ void p3ConnectMgr::statusTick()
|
|||||||
std::map<std::string, peerConnectState>::iterator it;
|
std::map<std::string, peerConnectState>::iterator it;
|
||||||
for(it = mFriendList.begin(); it != mFriendList.end(); it++)
|
for(it = mFriendList.begin(); it != mFriendList.end(); it++)
|
||||||
{
|
{
|
||||||
|
if (it->second.id == ("dummy" + it->second.gpg_id)) {
|
||||||
|
//if there is other friends for the same gpg key (that obviously are not "dummy"), we will remove this useless dummy friend
|
||||||
|
std::map<std::string, peerConnectState>::iterator it2;
|
||||||
|
for(it2 = mFriendList.begin(); it2 != mFriendList.end(); it2++) {
|
||||||
|
if ((it->second.id != it2->second.id) && (it->second.gpg_id == it2->second.gpg_id)) {
|
||||||
|
dummyToRemove.push_back(it->first);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (it->second.state & RS_PEER_S_CONNECTED)
|
if (it->second.state & RS_PEER_S_CONNECTED)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@ -496,6 +509,10 @@ void p3ConnectMgr::statusTick()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (std::list<std::string>::iterator dummyIt = dummyToRemove.begin(); dummyIt != dummyToRemove.end(); dummyIt++) {
|
||||||
|
removeFriend(*dummyIt);
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef P3CONNMGR_NO_AUTO_CONNECTION
|
#ifndef P3CONNMGR_NO_AUTO_CONNECTION
|
||||||
|
|
||||||
for(it2 = retryIds.begin(); it2 != retryIds.end(); it2++)
|
for(it2 = retryIds.begin(); it2 != retryIds.end(); it2++)
|
||||||
@ -2015,12 +2032,6 @@ bool p3ConnectMgr::addFriend(std::string id, std::string gpg_id, uint32_t netMod
|
|||||||
std::cerr << "p3ConnectMgr::addFriend() " << id << "; gpg_id : " << gpg_id << std::endl;
|
std::cerr << "p3ConnectMgr::addFriend() " << id << "; gpg_id : " << gpg_id << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONN_DEBUG
|
|
||||||
std::cerr << "p3ConnectMgr::addFriend() removing dummy friend" << std::endl;
|
|
||||||
#endif
|
|
||||||
//remove any dummy friend because we just add a real ssl friend
|
|
||||||
removeFriend("dummy"+ gpg_id);
|
|
||||||
|
|
||||||
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
|
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user