From 75f3a6a5d8461bd96453cd9051f302365f1c230f Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 12 Mar 2012 21:38:41 +0000 Subject: [PATCH] disabled adding new keys from friends of friends when discovery if off git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5016 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/services/p3disc.cc | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/libretroshare/src/services/p3disc.cc b/libretroshare/src/services/p3disc.cc index 77f7307f2..fac181d5a 100644 --- a/libretroshare/src/services/p3disc.cc +++ b/libretroshare/src/services/p3disc.cc @@ -661,9 +661,9 @@ void p3disc::recvPeerDetails(RsDiscReply *item, const std::string &certGpgId) } bool should_notify_discovery = false ; + std::string item_gpg_id = rsPeers->getGPGId(item->PeerId()) ; - std::list::iterator pit; - for (pit = item->rsPeerList.begin(); pit != item->rsPeerList.end(); pit++) + for (std::list::iterator pit = item->rsPeerList.begin(); pit != item->rsPeerList.end(); pit++) { if(isDummyFriend(pit->pid)) { @@ -671,8 +671,8 @@ void p3disc::recvPeerDetails(RsDiscReply *item, const std::string &certGpgId) } bool new_info = false; - addDiscoveryData(item->PeerId(), pit->pid,rsPeers->getGPGId(item->PeerId()), - item->aboutId, pit->currentlocaladdr, pit->currentremoteaddr, 0, time(NULL),new_info); + addDiscoveryData(item->PeerId(), pit->pid,item_gpg_id, + item->aboutId, pit->currentlocaladdr, pit->currentremoteaddr, 0, time(NULL),new_info); if(new_info) should_notify_discovery = true ; @@ -717,10 +717,10 @@ void p3disc::recvPeerDetails(RsDiscReply *item, const std::string &certGpgId) /* add into NetMgr and non-search, so we can detect connect attempts */ mNetMgr->netAssistFriend(pit->pid,false); - + /* inform NetMgr that we know this peer */ mNetMgr->netAssistKnownPeer(pit->pid, pit->currentremoteaddr, - NETASSIST_KNOWN_PEER_FOF | NETASSIST_KNOWN_PEER_OFFLINE); + NETASSIST_KNOWN_PEER_FOF | NETASSIST_KNOWN_PEER_OFFLINE); continue; } @@ -853,7 +853,11 @@ void p3disc::recvDiscReply(RsDiscReply *dri) } // add item to list for later process - mPendingDiscReplyInList.push_back(dri); // no delete + + if(mDiscEnabled || dri->aboutId == rsPeers->getGPGId(dri->PeerId())) + mPendingDiscReplyInList.push_back(dri); // no delete + else + delete dri ; }