add check for case that should not have happened:
complete callback fired for file fetching, but objectsToLocalFile failed
Change-Id: I19012535a93754977ba07c0f2e1ad8e3d140aeec
diff --git a/src/dispatcher.cc b/src/dispatcher.cc
index fb3a025..0a2bb82 100644
--- a/src/dispatcher.cc
+++ b/src/dispatcher.cc
@@ -400,12 +400,20 @@
_LOG_ERROR ("File operations failed on [" << filePath << "] (ignoring)");
}
- m_objectManager.objectsToLocalFile (deviceName, hash, filePath);
+ if (ObjectDb::DoesExist (m_rootDir / ".chronoshare", deviceName, boost::lexical_cast<string>(hash)))
+ {
+ m_objectManager.objectsToLocalFile (deviceName, hash, filePath);
- last_write_time (filePath, file->mtime ());
- permissions (filePath, static_cast<filesystem::perms> (file->mode ()));
+ last_write_time (filePath, file->mtime ());
+ permissions (filePath, static_cast<filesystem::perms> (file->mode ()));
- m_actionLog->SetFileComplete (file->filename ());
+ m_actionLog->SetFileComplete (file->filename ());
+ }
+ else
+ {
+ _LOG_ERROR (filePath << " supposed to have all segments, but not");
+ // should abort for debugging
+ }
}
}