From 5926c79822b6c0f7e31f36054c1b55e4c5aaa417 Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 13 Feb 2010 20:42:49 +0000 Subject: [PATCH] corrected bug in file completion git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2301 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/ft/ftchunkmap.cc | 4 +++- libretroshare/src/ft/ftcontroller.cc | 11 +++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/libretroshare/src/ft/ftchunkmap.cc b/libretroshare/src/ft/ftchunkmap.cc index 349ee7f17..bcba5103e 100644 --- a/libretroshare/src/ft/ftchunkmap.cc +++ b/libretroshare/src/ft/ftchunkmap.cc @@ -351,12 +351,14 @@ uint32_t ChunkMap::getAvailableChunk(uint32_t start_location,const std::string& { uint32_t j = (start_location+i)%(int)_map.size() ; // index of the chunk + if(_map[j] != FileChunksInfo::CHUNK_DONE) + file_is_complete = false ; + if(_map[j] == FileChunksInfo::CHUNK_OUTSTANDING && (peer_chunks->is_full || peer_chunks->cmap[j])) { #ifdef DEBUG_FTCHUNK std::cerr << "ChunkMap::getAvailableChunk: returning chunk " << j << " for peer " << peer_id << std::endl; #endif - file_is_complete = false ; return j ; } } diff --git a/libretroshare/src/ft/ftcontroller.cc b/libretroshare/src/ft/ftcontroller.cc index 820ac4616..ea09b655b 100644 --- a/libretroshare/src/ft/ftcontroller.cc +++ b/libretroshare/src/ft/ftcontroller.cc @@ -1560,10 +1560,17 @@ std::list ftController::saveList(bool &cleanup) rft->file.path = RsDirUtil::removeTopDir(fit->second.mDestination); /* remove fname */ rft->flags = fit->second.mFlags; rft->state = fit->second.mState; - rft->transferred = fit->second.mCreator->getRecvd(); - fit->second.mTransfer->getFileSources(rft->allPeerIds.ids); + // just avoid uninitialised memory reads + rft->in = 0 ; + rft->cPeerId = "" ; + rft->transferred = fit->second.mCreator->getRecvd(); + rft->crate = 0 ; + rft->lrate = 0 ; + rft->trate = 0 ; + rft->ltransfer = 0 ; + // Remove turtle peers from sources, as they are not supposed to survive a reboot of RS, since they are dynamic sources. // Otherwize, such sources are unknown from the turtle router, at restart, and never get removed. //