[Libreoffice-commits] online.git: loolwsd/ClientSession.hpp loolwsd/LOOLWSD.cpp loolwsd/MasterProcessSession.hpp loolwsd/PrisonerSession.cpp loolwsd/PrisonerSession.hpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Tue May 17 03:19:08 UTC 2016


 loolwsd/ClientSession.hpp        |   28 ++++++++++------------------
 loolwsd/LOOLWSD.cpp              |    2 +-
 loolwsd/MasterProcessSession.hpp |    4 ----
 loolwsd/PrisonerSession.cpp      |    2 +-
 loolwsd/PrisonerSession.hpp      |    6 ------
 5 files changed, 12 insertions(+), 30 deletions(-)

New commits:
commit 8acc293af567ac1f3cb5d3c59afe65aac4d2ccd6
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Mon May 16 19:37:11 2016 -0400

    loolwsd: MasterProcessSession splitting: mark document load failure
    
    Change-Id: I3167b9ddb985e20ff500962a856a70888abf0684
    Reviewed-on: https://gerrit.libreoffice.org/25044
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/ClientSession.hpp b/loolwsd/ClientSession.hpp
index 8bc7bec..13692c2 100644
--- a/loolwsd/ClientSession.hpp
+++ b/loolwsd/ClientSession.hpp
@@ -49,6 +49,13 @@ public:
         _saveAsQueue.put(url);
     }
 
+    bool isLoadFailed() const { return _loadFailed; }
+    void setLoadFailed(const std::string& reason)
+    {
+        Log::warn("Document load failed: " + reason);
+        _loadFailed = true;
+    }
+
 private:
 
     virtual bool _handleInput(const char *buffer, int length) override;
@@ -73,32 +80,17 @@ private:
 
     /// Store URLs of completed 'save as' documents.
     MessageQueue _saveAsQueue;
-#if 0
- public:
-    MasterProcessSession(const std::string& id,
-                         const Kind kind,
-                         std::shared_ptr<Poco::Net::WebSocket> ws,
-                         std::shared_ptr<DocumentBroker> docBroker,
-                         std::shared_ptr<BasicTileQueue> queue);
-    virtual ~MasterProcessSession();
 
-    /**
-     * Return the URL of the saved-as document when it's ready. If called
-     * before it's ready, the call blocks till then.
-     */
-    std::string getSaveAs();
+    /// Marks if document loading failed.
+    bool _loadFailed;
 
+#if 0
     std::shared_ptr<DocumentBroker> getDocumentBroker() const { return _docBroker; }
 
     std::shared_ptr<BasicTileQueue> getQueue() const { return _queue; }
 
     bool shutdownPeer(Poco::UInt16 statusCode, const std::string& message);
 
-public:
-    // Raise this flag on ToClient from ToPrisoner to let ToClient know of load failures
-    bool _bLoadError = false;
-
- protected:
  private:
     void dispatchChild();
     void forwardToPeer(const char *buffer, int length);
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 0c923eb..1be3f94 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -686,7 +686,7 @@ private:
                 }
             }
 
-            if (session->_bLoadError)
+            if (session->isLoadFailed())
             {
                 Log::info("Clearing the queue.");
                 queue->clear();
diff --git a/loolwsd/MasterProcessSession.hpp b/loolwsd/MasterProcessSession.hpp
index 5dc23db..cc3debe 100644
--- a/loolwsd/MasterProcessSession.hpp
+++ b/loolwsd/MasterProcessSession.hpp
@@ -39,10 +39,6 @@ class MasterProcessSession : public LOOLSession, public std::enable_shared_from_
 
     bool shutdownPeer(Poco::UInt16 statusCode, const std::string& message);
 
-public:
-    // Raise this flag on ToClient from ToPrisoner to let ToClient know of load failures
-    bool _bLoadError = false;
-
  protected:
     void dispatchChild();
     void forwardToPeer(const char *buffer, int length);
diff --git a/loolwsd/PrisonerSession.cpp b/loolwsd/PrisonerSession.cpp
index 4078d71..8b658a9 100644
--- a/loolwsd/PrisonerSession.cpp
+++ b/loolwsd/PrisonerSession.cpp
@@ -96,7 +96,7 @@ bool PrisonerSession::_handleInput(const char *buffer, int length)
                         errorKind == "wrongpassword")
                     {
                         forwardToPeer(buffer, length);
-                        peer->_bLoadError = true;
+                        peer->setLoadFailed(errorKind);
                         return false;
                     }
                 }
diff --git a/loolwsd/PrisonerSession.hpp b/loolwsd/PrisonerSession.hpp
index 5d8fddd..0de9c87 100644
--- a/loolwsd/PrisonerSession.hpp
+++ b/loolwsd/PrisonerSession.hpp
@@ -44,18 +44,12 @@ private:
 
     bool shutdownPeer(Poco::UInt16 statusCode, const std::string& message);
 
-public:
-    // Raise this flag on ToClient from ToPrisoner to let ToClient know of load failures
-    bool _bLoadError = false;
-
  private:
     void dispatchChild();
     void forwardToPeer(const char *buffer, int length);
 
     int _curPart;
     int _loadPart;
-    /// Kind::ToClient instances store URLs of completed 'save as' documents.
-    MessageQueue _saveAsQueue;
     std::shared_ptr<DocumentBroker> _docBroker;
     std::shared_ptr<BasicTileQueue> _queue;
 #endif


More information about the Libreoffice-commits mailing list