[Libreoffice-commits] online.git: wsd/DocumentBroker.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Mon Jan 2 06:02:23 UTC 2017
wsd/DocumentBroker.cpp | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
New commits:
commit f3a90ef77a55a2a2efafeb20bb873779b4a65e1f
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sun Jan 1 12:08:12 2017 -0500
wsd: always notify threads waiting on save
And check for save-failed first before finding
the session, as otherwise the session is useless.
Change-Id: I3eb45e54872547eb36765b2c8409e1aa51aee589
Reviewed-on: https://gerrit.libreoffice.org/32611
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 6c42fd2..e1242b4 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -367,25 +367,26 @@ bool DocumentBroker::save(const std::string& sessionId, bool success, const std:
{
std::unique_lock<std::mutex> lock(_saveMutex);
+ // If save requested, but core didn't save because document was unmodified
+ // notify the waiting thread, if any.
+ if (!success && result == "unmodified")
+ {
+ LOG_DBG("Save skipped as document was not modified.");
+ _saveCV.notify_all();
+ return true;
+ }
+
const auto it = _sessions.find(sessionId);
if (it == _sessions.end())
{
LOG_ERR("Session with sessionId [" << sessionId << "] not found while saving.");
+ _saveCV.notify_all();
return false;
}
const Poco::URI& uriPublic = it->second->getPublicUri();
const auto uri = uriPublic.toString();
- // If save requested, but core didn't save because document was unmodified
- // notify the waiting thread, if any.
- if (!success && result == "unmodified")
- {
- LOG_DBG("Save skipped as document was not modified");
- _saveCV.notify_all();
- return true;
- }
-
// If we aren't destroying the last editable session just yet, and the file
// timestamp hasn't changed, skip saving.
const auto newFileModifiedTime = Poco::File(_storage->getLocalRootPath()).getLastModified();
@@ -394,6 +395,7 @@ bool DocumentBroker::save(const std::string& sessionId, bool success, const std:
// Nothing to do.
LOG_DBG("Skipping unnecessary saving to URI [" << uri << "]. File last modified " <<
_lastFileModifiedTime.elapsed() / 1000000 << " seconds ago.");
+ _saveCV.notify_all();
return true;
}
@@ -432,7 +434,6 @@ bool DocumentBroker::save(const std::string& sessionId, bool success, const std:
LOG_DBG("Timestamp now: " << Poco::DateTimeFormatter::format(Poco::DateTime(_documentLastModifiedTime),
Poco::DateTimeFormat::ISO8601_FORMAT));
_saveCV.notify_all();
-
return true;
}
else if (storageSaveResult == StorageBase::SaveResult::DISKFULL)
@@ -454,6 +455,7 @@ bool DocumentBroker::save(const std::string& sessionId, bool success, const std:
it->second->sendTextFrame("error: cmd=storage kind=savefailed");
}
+ _saveCV.notify_all();
return false;
}
More information about the Libreoffice-commits
mailing list