mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-03 14:45:12 -04:00
Merged v0.5-netupgrade branch back into the trunk ( --- Merging r4410 through r4465 into '.' )
This brings lots of improvements: * UDP Connection Code - this it the majority of the new code. * Simplification of p3ConnectMgr => p3LinkMgr, p3PeerMgr & p3NetMgr. * Notifications of Failed Connection Attempts * Addition of a "Getting Started Guide". git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4466 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
commit
69c14461cb
108 changed files with 16142 additions and 5985 deletions
|
@ -23,7 +23,8 @@
|
|||
|
||||
#include "dbase/cachestrapper.h"
|
||||
#include "serialiser/rsconfigitems.h"
|
||||
#include "pqi/p3connmgr.h"
|
||||
#include "pqi/p3linkmgr.h"
|
||||
#include "pqi/p3peermgr.h"
|
||||
#include "util/rsdir.h"
|
||||
|
||||
#include <iostream>
|
||||
|
@ -542,8 +543,8 @@ void CacheStore::locked_storeCacheEntry(const CacheData &data)
|
|||
*
|
||||
********************************* CacheStrapper ********************************/
|
||||
|
||||
CacheStrapper::CacheStrapper(p3ConnectMgr *cm)
|
||||
:p3Config(CONFIG_TYPE_CACHE), mConnMgr(cm), csMtx("CacheStrapper")
|
||||
CacheStrapper::CacheStrapper(p3LinkMgr *lm)
|
||||
:p3Config(CONFIG_TYPE_CACHE), mLinkMgr(lm), csMtx("CacheStrapper")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -595,7 +596,7 @@ void CacheStrapper::refreshCache(const CacheData &data)
|
|||
std::list<std::string> ids;
|
||||
std::list<std::string>::iterator it;
|
||||
|
||||
mConnMgr->getOnlineList(ids);
|
||||
mLinkMgr->getOnlineList(ids);
|
||||
|
||||
RsStackMutex stack(csMtx); /******* LOCK STACK MUTEX *********/
|
||||
for(it = ids.begin(); it != ids.end(); it++)
|
||||
|
@ -607,7 +608,7 @@ void CacheStrapper::refreshCache(const CacheData &data)
|
|||
mCacheUpdates.push_back(std::make_pair(*it, data));
|
||||
}
|
||||
|
||||
mCacheUpdates.push_back(std::make_pair(mConnMgr->getOwnId(), data));
|
||||
mCacheUpdates.push_back(std::make_pair(mLinkMgr->getOwnId(), data));
|
||||
|
||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||
}
|
||||
|
@ -688,7 +689,7 @@ void CacheStrapper::listCaches(std::ostream &out)
|
|||
{
|
||||
/* can overwrite for more control! */
|
||||
std::map<uint16_t, CachePair>::iterator it;
|
||||
out << "CacheStrapper::listCaches() [" << mConnMgr->getOwnId();
|
||||
out << "CacheStrapper::listCaches() [" << mLinkMgr->getOwnId();
|
||||
out << "] " << " Total Caches: " << caches.size();
|
||||
out << std::endl;
|
||||
for(it = caches.begin(); it != caches.end(); it++)
|
||||
|
@ -781,7 +782,7 @@ bool CacheStrapper::saveList(bool &cleanup, std::list<RsItem *>& saveData)
|
|||
std::list<CacheData>::iterator cit;
|
||||
std::list<CacheData> ownCaches;
|
||||
std::list<CacheData> remoteCaches;
|
||||
std::string ownId = mConnMgr->getOwnId();
|
||||
std::string ownId = mLinkMgr->getOwnId();
|
||||
|
||||
std::map<uint16_t, CachePair>::iterator it;
|
||||
for(it = caches.begin(); it != caches.end(); it++)
|
||||
|
@ -861,11 +862,11 @@ bool CacheStrapper::loadList(std::list<RsItem *>& load)
|
|||
#endif
|
||||
std::list<CacheData> ownCaches;
|
||||
std::list<CacheData> remoteCaches;
|
||||
std::string ownId = mConnMgr->getOwnId();
|
||||
std::string ownId = mLinkMgr->getOwnId();
|
||||
|
||||
peerConnectState ownState;
|
||||
mConnMgr->getOwnNetStatus(ownState);
|
||||
std::string ownName = ownState.name+" ("+ownState.location+")";
|
||||
//peerConnectState ownState;
|
||||
//mPeerMgr->getOwnNetStatus(ownState);
|
||||
//std::string ownName = ownState.name+" ("+ownState.location+")";
|
||||
|
||||
std::map<std::string, std::list<std::string> > saveFiles;
|
||||
std::map<std::string, std::list<std::string> >::iterator sit;
|
||||
|
@ -885,6 +886,7 @@ bool CacheStrapper::loadList(std::list<RsItem *>& load)
|
|||
|
||||
cd.pid = rscc->pid;
|
||||
|
||||
#if 0
|
||||
if(cd.pid == ownId)
|
||||
{
|
||||
cd.pname = ownName;
|
||||
|
@ -892,9 +894,10 @@ bool CacheStrapper::loadList(std::list<RsItem *>& load)
|
|||
else
|
||||
{
|
||||
peerConnectState pca;
|
||||
mConnMgr->getFriendNetStatus(rscc->pid, pca);
|
||||
mPeerMgr->getFriendNetStatus(rscc->pid, pca);
|
||||
cd.pname = pca.name+" ("+pca.location+")";
|
||||
}
|
||||
#endif
|
||||
|
||||
cd.cid.type = rscc->cachetypeid;
|
||||
cd.cid.subid = rscc->cachesubid;
|
||||
|
|
|
@ -92,7 +92,7 @@ class CacheData
|
|||
public:
|
||||
|
||||
RsPeerId pid; /// peer id
|
||||
std::string pname; /// peer name (can be used by cachestore)
|
||||
/// REMOVED as a WASTE to look it up everywhere! std::string pname; /// peer name (can be used by cachestore)
|
||||
CacheId cid; /// cache id
|
||||
std::string path; /// file system path where physical cache data is located
|
||||
std::string name;
|
||||
|
@ -408,6 +408,9 @@ bool operator<(const CachePair &a, const CachePair &b);
|
|||
* CacheStrapper: maintains a set of CacheSources, and CacheStores,
|
||||
* queries and updates as new information arrives.
|
||||
*/
|
||||
|
||||
class p3LinkMgr;
|
||||
|
||||
class CacheStrapper: public pqiMonitor, public p3Config
|
||||
{
|
||||
public:
|
||||
|
@ -416,7 +419,7 @@ class CacheStrapper: public pqiMonitor, public p3Config
|
|||
* @param cm handle used by strapper for getting peer connection information (online peers, sslids...)
|
||||
* @return
|
||||
*/
|
||||
CacheStrapper(p3ConnectMgr *cm);
|
||||
CacheStrapper(p3LinkMgr *lm);
|
||||
virtual ~CacheStrapper() { return; }
|
||||
|
||||
/************* from pqiMonitor *******************/
|
||||
|
@ -489,7 +492,7 @@ virtual bool loadList(std::list<RsItem *>& load);
|
|||
private:
|
||||
|
||||
/* these are static - so shouldn't need mutex */
|
||||
p3ConnectMgr *mConnMgr;
|
||||
p3LinkMgr *mLinkMgr;
|
||||
|
||||
std::map<uint16_t, CachePair> caches;
|
||||
|
||||
|
|
|
@ -435,7 +435,7 @@ bool FileIndexMonitor::loadLocalCache(const CacheData &data) /* called with sto
|
|||
std::cerr << std::endl;
|
||||
#endif
|
||||
fi.root->row = 0;
|
||||
fi.root->name = data.pname ;
|
||||
fi.root->name = data.pid; // XXX Hack here - TODO
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -24,12 +24,12 @@
|
|||
#include "dbase/fistore.h"
|
||||
#include "retroshare/rsexpr.h"
|
||||
#include "serialiser/rsserviceids.h"
|
||||
#include "pqi/p3connmgr.h"
|
||||
#include "pqi/p3peermgr.h"
|
||||
|
||||
FileIndexStore::FileIndexStore(CacheStrapper *cs, CacheTransfer *cft,
|
||||
NotifyBase *cb_in,p3ConnectMgr *cnmgr, RsPeerId ownid, std::string cachedir)
|
||||
NotifyBase *cb_in,p3PeerMgr *cnmgr, RsPeerId ownid, std::string cachedir)
|
||||
:CacheStore(RS_SERVICE_TYPE_FILE_INDEX, false, cs, cft, cachedir),
|
||||
localId(ownid), localindex(NULL), cb(cb_in),mConnMgr(cnmgr)
|
||||
localId(ownid), localindex(NULL), cb(cb_in),mPeerMgr(cnmgr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ int FileIndexStore::loadCache(const CacheData &data)
|
|||
|
||||
FileIndex *finew = new FileIndex(data.pid);
|
||||
|
||||
if(mConnMgr->isFriend(data.pid))
|
||||
if(mPeerMgr->isFriend(data.pid))
|
||||
{
|
||||
// We discard file lists from non friends. This is the place to remove file lists of deleted friends
|
||||
// from the cache. Doing this, the file list still shows in a session where we deleted a friend, but will be removed
|
||||
|
@ -95,7 +95,7 @@ int FileIndexStore::loadCache(const CacheData &data)
|
|||
std::cerr << "FileIndexStore::loadCache() Succeeded!" << std::endl;
|
||||
#endif
|
||||
/* set the name */
|
||||
finew->root->name = data.pname;
|
||||
finew->root->name = data.pid; // HACK HERE TODO XXX. name;
|
||||
|
||||
if (local)
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class p3ConnectMgr ;
|
||||
class p3PeerMgr ;
|
||||
|
||||
#include "dbase/findex.h"
|
||||
#include "dbase/cachestrapper.h"
|
||||
|
@ -65,7 +65,7 @@ class FileIndexStore: public CacheStore
|
|||
{
|
||||
public:
|
||||
|
||||
FileIndexStore(CacheStrapper *cs, CacheTransfer *cft, NotifyBase *cb_in,p3ConnectMgr *cmgr, RsPeerId ownid, std::string cachedir);
|
||||
FileIndexStore(CacheStrapper *cs, CacheTransfer *cft, NotifyBase *cb_in,p3PeerMgr *pmgr, RsPeerId ownid, std::string cachedir);
|
||||
virtual ~FileIndexStore();
|
||||
|
||||
/* virtual functions overloaded by cache implementor */
|
||||
|
@ -96,7 +96,7 @@ virtual int loadCache(const CacheData &data); /* actual load, once data availa
|
|||
FileIndex *localindex;
|
||||
|
||||
NotifyBase *cb;
|
||||
p3ConnectMgr *mConnMgr ;
|
||||
p3PeerMgr *mPeerMgr ;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue