wsd/DocumentBroker.cpp |   15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

New commits:
commit 37f499a7f631d1909a71a026c8ae8853d7d65fc3
Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk>
Date:   Thu Apr 6 23:38:54 2017 -0400

    wsd: merge DocumentBroker poll exit conditions
    
    These conditions must be checked together. Otherwise we might
    set _stop prematurely.
    
    Change-Id: I3de0d2b3833959593315669ad245f94c1243f7f7
    Reviewed-on: https://gerrit.libreoffice.org/36242
    Reviewed-by: Ashod Nakashian <ashnak...@gmail.com>
    Tested-by: Ashod Nakashian <ashnak...@gmail.com>

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index eb53f195..f7bbd9f1 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -234,19 +234,14 @@ void DocumentBroker::pollThread()
             last30SecCheckTime = std::chrono::steady_clock::now();
         }
 
-        // If all sessions have been removed, no reason to linger.
-        if (_sessions.empty() && 
std::chrono::duration_cast<std::chrono::milliseconds>
-            (std::chrono::steady_clock::now() - _lastSaveRequestTime).count() 
> COMMAND_TIMEOUT_MS)
-        {
-            LOG_INF("No more sessions in doc [" << _docKey << "]. 
Terminating.");
-            _stop = true;
-        }
+        const bool notSaving = 
(std::chrono::duration_cast<std::chrono::milliseconds>
+                                (std::chrono::steady_clock::now() - 
_lastSaveRequestTime).count() > COMMAND_TIMEOUT_MS);
 
         // Remove idle documents after 1 hour.
-        const bool idle = getIdleTimeSecs() >= 3600;
+        const bool idle = (getIdleTimeSecs() >= 3600);
 
-        // Cleanup used and dead entries.
-        if ((isLoaded() || _markToDestroy) &&
+        // If all sessions have been removed, no reason to linger.
+        if ((isLoaded() || _markToDestroy) && notSaving &&
             (_sessions.empty() || !isAlive() || idle))
         {
             LOG_INF("Terminating " << (idle ? "idle" : "dead") <<
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to