attempt at improving file list losses on windows: reduced auto-save delay for file list to 5 mins, removed auto-save when new sources are added, added WRITE_THROUGH flag for call to MoveFileEx to ensure the write is finished before moving the file. To be tested.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5.5@7487 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2014-08-08 14:30:25 +00:00
parent a54224e3e0
commit 17b6b5f16e
2 changed files with 3 additions and 5 deletions

View file

@ -69,7 +69,7 @@
* #define DEBUG_DWLQUEUE 1
*****/
static const int32_t SAVE_TRANSFERS_DELAY = 61 ; // save transfer progress every 61 seconds.
static const int32_t SAVE_TRANSFERS_DELAY = 301 ; // save transfer progress every 301 seconds.
static const int32_t INACTIVE_CHUNKS_CHECK_DELAY = 240 ; // time after which an inactive chunk is released
static const int32_t MAX_TIME_INACTIVE_REQUEUED = 120 ; // time after which an inactive ftFileControl is bt-queued
static const int32_t TIMOUT_CACHE_FILE_TRANSFER = 800 ; // time after which cache transfer gets cancelled if inactive.
@ -1220,8 +1220,6 @@ bool ftController::FileRequest(const std::string& fname, const std::string& has
#endif
(dit->second)->mTransfer->addFileSource(*it);
setPeerState(dit->second->mTransfer, *it, rate, mLinkMgr->isOnline(*it));
IndicateConfigChanged(); /* new peer for transfer -> save */
}
if (srcIds.size() == 0)

View file

@ -896,7 +896,7 @@ bool RsDirUtil::renameFile(const std::string& from, const std::string& to)
std::wstring t;
librs::util::ConvertUtf8ToUtf16(to, t);
while (!MoveFileEx(f.c_str(), t.c_str(), MOVEFILE_REPLACE_EXISTING))
while (!MoveFileEx(f.c_str(), t.c_str(), MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH))
#else
std::string f(from),t(to) ;
@ -1512,7 +1512,7 @@ bool RsDirUtil::renameWideFile(const std::wstring& from, const std::wstring& to)
#else
std::wstring f(from),t(to) ;
#endif
while (!MoveFileEx(f.c_str(), t.c_str(), MOVEFILE_REPLACE_EXISTING))
while (!MoveFileEx(f.c_str(), t.c_str(), MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH))
#else
/***** XXX TO MAKE WIDE SYSTEM CALL ******************************************************/
std::string f(from.begin(), from.end());