From c45582738eb06ad1878332b1e402fc81c9fe810b Mon Sep 17 00:00:00 2001 From: joss17 Date: Wed, 13 Jan 2010 21:34:28 +0000 Subject: [PATCH] send just connected peer info to all others git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2027 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/services/p3disc.cc | 26 +++++++++++++++++++++++--- libretroshare/src/services/p3disc.h | 3 ++- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/libretroshare/src/services/p3disc.cc b/libretroshare/src/services/p3disc.cc index 720b00bd6..671556dd2 100644 --- a/libretroshare/src/services/p3disc.cc +++ b/libretroshare/src/services/p3disc.cc @@ -228,17 +228,18 @@ void p3disc::statusChange(const std::list &plist) // sendPeerDetails(pit->id, pit->id); // /* send our details to them */ sendOwnVersion(pit->id); - sendAllInfoToPeer(pit->id); + sendAllInfoToJustConnectedPeer(pit->id); + sendJustConnectedPeerInfoToAllPeer(pit->id); } } } -void p3disc::sendAllInfoToPeer(std::string id) +void p3disc::sendAllInfoToJustConnectedPeer(std::string id) { /* get a peer lists */ #ifdef P3DISC_DEBUG - std::cerr << "p3disc::respondToPeer() id: " << id; + std::cerr << "p3disc::sendAllInfoToJustConnectedPeer() id: " << id; std::cerr << std::endl; #endif @@ -272,6 +273,25 @@ void p3disc::sendAllInfoToPeer(std::string id) } } +void p3disc::sendJustConnectedPeerInfoToAllPeer(std::string connectedPeerId) +{ + /* get a peer lists */ + +#ifdef P3DISC_DEBUG + std::cerr << "p3disc::sendJustConnectedPeerInfoToAllPeer() connectedPeerId : " << connectedPeerId << std::endl; +#endif + std::string gpg_connectedPeerId = rsPeers->getGPGId(connectedPeerId); + std::list onlineIds; + std::list::iterator onlineIdsIt; + + rsPeers->getOnlineList(onlineIds); + + /* send them a list of all friend's details */ + for(onlineIdsIt = onlineIds.begin(); onlineIdsIt != onlineIds.end(); onlineIdsIt++) { + sendPeerDetails(*onlineIdsIt, gpg_connectedPeerId); + } +} + /* (dest (to), source (cert)) */ void p3disc::sendPeerDetails(std::string to, std::string about) { { diff --git a/libretroshare/src/services/p3disc.h b/libretroshare/src/services/p3disc.h index 6474d869a..f557fb770 100644 --- a/libretroshare/src/services/p3disc.h +++ b/libretroshare/src/services/p3disc.h @@ -94,7 +94,8 @@ void getversions(std::map &versions); private: -void sendAllInfoToPeer(std::string id); +void sendAllInfoToJustConnectedPeer(std::string id); +void sendJustConnectedPeerInfoToAllPeer(std::string id); /* Network Output */ //void sendOwnDetails(std::string to);