From 334f423a89bf817ea7ff60e3c4174131105a1910 Mon Sep 17 00:00:00 2001 From: Egor Kichin Date: Wed, 18 Jan 2023 09:35:00 +0300 Subject: [PATCH] Skip searching update time of non-existing files. --- server/src/Synchronizer.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/server/src/Synchronizer.cpp b/server/src/Synchronizer.cpp index a659bea4b..8fdc5d346 100644 --- a/server/src/Synchronizer.cpp +++ b/server/src/Synchronizer.cpp @@ -64,7 +64,12 @@ bool Synchronizer::isProbablyOutdatedStubs(const fs::path &srcFilePath) const { } catch (...) { return true; } - srcTimestamp = Synchronizer::getFileOutdatedTime(srcFilePath); + if (!fs::exists(srcFilePath)){ + srcTimestamp = time(NULL); + } + else { + srcTimestamp = Synchronizer::getFileOutdatedTime(srcFilePath); + } return stubTimestamp <= srcTimestamp; } @@ -75,7 +80,12 @@ bool Synchronizer::isProbablyOutdatedWrappers(const fs::path &srcFilePath) const } long long wrapperTimestamp, srcTimestamp; wrapperTimestamp = Synchronizer::getFileOutdatedTime(wrapperFilePath); - srcTimestamp = Synchronizer::getFileOutdatedTime(srcFilePath); + if (!fs::exists(srcFilePath)){ + srcTimestamp = time(NULL); + } + else { + srcTimestamp = Synchronizer::getFileOutdatedTime(srcFilePath); + } return wrapperTimestamp <= srcTimestamp; }