From 99860c1eb07e7ac63538593fc5df15981bd22618 Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 15 Nov 2016 20:10:18 +0100 Subject: [PATCH] only allocate a remote directory entry if the peer is online, or the file already exists --- libretroshare/src/file_sharing/p3filelists.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libretroshare/src/file_sharing/p3filelists.cc b/libretroshare/src/file_sharing/p3filelists.cc index 2e8921af2..71a87d6fd 100644 --- a/libretroshare/src/file_sharing/p3filelists.cc +++ b/libretroshare/src/file_sharing/p3filelists.cc @@ -476,8 +476,10 @@ void p3FileDatabase::cleanup() // for(std::set::const_iterator it(friend_set.begin());it!=friend_set.end();++it) { - // Check if a remote directory exists for that friend, possibly creating the index. - locked_getFriendIndex(*it) ; + // Check if a remote directory exists for that friend, possibly creating the index if the file does not but the friend is online. + + if(rsPeers->isOnline(*it) || RsDirUtil::fileExists(makeRemoteFileName(*it))) + locked_getFriendIndex(*it) ; } // cancel existing requests for which the peer is offline