mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
set delay between directory sweep to 60 secs and a-synced sweeps for different friends. Set drop time to 600 for un-answered dir sync requests
This commit is contained in:
parent
ffcf44b3fe
commit
1e919a141c
@ -756,7 +756,9 @@ RemoteDirectoryStorage::RemoteDirectoryStorage(const RsPeerId& pid,const std::st
|
||||
{
|
||||
load(fname) ;
|
||||
|
||||
std::cerr << "Loaded remote directory for peer " << pid << std::endl;
|
||||
mLastSweepTime = time(NULL) - (RSRandom::random_u32() % DELAY_BETWEEN_REMOTE_DIRECTORIES_SWEEP) ;
|
||||
|
||||
std::cerr << "Loaded remote directory for peer " << pid << ", inited last sweep time to " << time(NULL) - mLastSweepTime << " secs ago." << std::endl;
|
||||
#ifdef DEBUG_REMOTE_DIRECTORY_STORAGE
|
||||
mFileHierarchy->print();
|
||||
#endif
|
||||
|
@ -194,8 +194,15 @@ public:
|
||||
*/
|
||||
void checkSave() ;
|
||||
|
||||
/*!
|
||||
* \brief lastSweepTime
|
||||
* returns the last time a sweep has been done over the directory in order to check update TS.
|
||||
* \return
|
||||
*/
|
||||
time_t& lastSweepTime() { return mLastSweepTime ; }
|
||||
private:
|
||||
time_t mLastSavedTime ;
|
||||
time_t mLastSweepTime ;
|
||||
bool mChanged ;
|
||||
std::string mFileName;
|
||||
};
|
||||
|
@ -28,7 +28,8 @@
|
||||
|
||||
static const uint32_t DELAY_BETWEEN_DIRECTORY_UPDATES = 600 ; // 10 minutes
|
||||
static const uint32_t DELAY_BETWEEN_REMOTE_DIRECTORY_SYNC_REQ = 120 ; // 2 minutes
|
||||
static const uint32_t DELAY_BETWEEN_LOCAL_DIRECTORIES_TS_UPDATE = 20 ; // 20 sec. Buy we only update for real if something has changed.
|
||||
static const uint32_t DELAY_BETWEEN_LOCAL_DIRECTORIES_TS_UPDATE = 20 ; // 20 sec. But we only update for real if something has changed.
|
||||
static const uint32_t DELAY_BETWEEN_REMOTE_DIRECTORIES_SWEEP = 60 ; // 60 sec.
|
||||
|
||||
static const std::string HASH_CACHE_DURATION_SS = "HASH_CACHE_DURATION" ; // key string to store hash remembering time
|
||||
static const std::string WATCH_FILE_DURATION_SS = "WATCH_FILES_DELAY" ; // key to store delay before re-checking for new files
|
||||
@ -43,3 +44,8 @@ static const uint32_t MIN_INTERVAL_BETWEEN_REMOTE_DIRECTORY_SAVE = 23 ; //
|
||||
|
||||
static const uint32_t MAX_DIR_SYNC_RESPONSE_DATA_SIZE = 20000 ; // Maximum RsItem data size in bytes for serialised directory transmission
|
||||
static const uint32_t DEFAULT_HASH_STORAGE_DURATION_DAYS = 30 ; // remember deleted/inaccessible files for 30 days
|
||||
|
||||
static const uint32_t NB_FRIEND_INDEX_BITS = 10 ; // Do not change this!
|
||||
static const uint32_t NB_ENTRY_INDEX_BITS = 22 ; // Do not change this!
|
||||
static const uint32_t ENTRY_INDEX_BIT_MASK = 0x003fffff ; // used for storing (EntryIndex,Friend) couples into a 32bits pointer. Depends on the two values just before. Dont change!
|
||||
static const uint32_t DELAY_BEFORE_DROP_REQUEST = 600; // every 10 min
|
||||
|
@ -46,11 +46,6 @@ static const uint32_t P3FILELISTS_UPDATE_FLAG_REMOTE_MAP_CHANGED = 0x0001 ;
|
||||
static const uint32_t P3FILELISTS_UPDATE_FLAG_LOCAL_DIRS_CHANGED = 0x0002 ;
|
||||
static const uint32_t P3FILELISTS_UPDATE_FLAG_REMOTE_DIRS_CHANGED = 0x0004 ;
|
||||
|
||||
static const uint32_t NB_FRIEND_INDEX_BITS = 10 ;
|
||||
static const uint32_t NB_ENTRY_INDEX_BITS = 22 ;
|
||||
static const uint32_t ENTRY_INDEX_BIT_MASK = 0x003fffff ; // used for storing (EntryIndex,Friend) couples into a 32bits pointer.
|
||||
static const uint32_t DELAY_BEFORE_DROP_REQUEST = 55 ; // every 55 secs, for debugging. Should be evey 10 minutes or so.
|
||||
|
||||
p3FileDatabase::p3FileDatabase(p3ServiceControl *mpeers)
|
||||
: mServCtrl(mpeers), mFLSMtx("p3FileLists")
|
||||
{
|
||||
@ -209,7 +204,7 @@ int p3FileDatabase::tick()
|
||||
for(uint32_t i=0;i<mRemoteDirectories.size();++i)
|
||||
if(mRemoteDirectories[i] != NULL)
|
||||
{
|
||||
if(online_peers.find(mRemoteDirectories[i]->peerId()) != online_peers.end())
|
||||
if(online_peers.find(mRemoteDirectories[i]->peerId()) != online_peers.end() && mRemoteDirectories[i]->lastSweepTime() + DELAY_BETWEEN_REMOTE_DIRECTORIES_SWEEP < now)
|
||||
{
|
||||
#ifdef DEBUG_FILE_HIERARCHY
|
||||
P3FILELISTS_DEBUG() << "Launching recurs sweep of friend directory " << mRemoteDirectories[i]->peerId() << ". Content currently is:" << std::endl;
|
||||
@ -217,6 +212,7 @@ int p3FileDatabase::tick()
|
||||
#endif
|
||||
|
||||
locked_recursSweepRemoteDirectory(mRemoteDirectories[i],mRemoteDirectories[i]->root(),0) ;
|
||||
mRemoteDirectories[i]->lastSweepTime() = now ;
|
||||
}
|
||||
|
||||
mRemoteDirectories[i]->checkSave() ;
|
||||
@ -497,7 +493,6 @@ void p3FileDatabase::cleanup()
|
||||
#ifdef DEBUG_P3FILELISTS
|
||||
P3FILELISTS_DEBUG() << " removing pending request " << std::hex << it->first << std::dec << " for peer " << it->second.peer_id << ", because peer is offline or request is too old." << std::endl;
|
||||
#endif
|
||||
|
||||
std::map<DirSyncRequestId,DirSyncRequestData>::iterator tmp(it);
|
||||
++tmp;
|
||||
mPendingSyncRequests.erase(it) ;
|
||||
|
Loading…
Reference in New Issue
Block a user