From 17b6b5f16e603043cbb0445b59c474162d7c125f Mon Sep 17 00:00:00 2001 From: csoler Date: Fri, 8 Aug 2014 14:30:25 +0000 Subject: [PATCH] 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 --- libretroshare/src/ft/ftcontroller.cc | 4 +--- libretroshare/src/util/rsdir.cc | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/libretroshare/src/ft/ftcontroller.cc b/libretroshare/src/ft/ftcontroller.cc index 5f3769e05..fa8d4a5cc 100644 --- a/libretroshare/src/ft/ftcontroller.cc +++ b/libretroshare/src/ft/ftcontroller.cc @@ -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) diff --git a/libretroshare/src/util/rsdir.cc b/libretroshare/src/util/rsdir.cc index b23652b56..eb1ef7025 100644 --- a/libretroshare/src/util/rsdir.cc +++ b/libretroshare/src/util/rsdir.cc @@ -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());