[Libreoffice-commits] online.git: loolwsd/ChildProcessSession.cpp loolwsd/ChildProcessSession.hpp loolwsd/LOOLWSD.cpp

Henry Castro hcastro at collabora.com
Wed Dec 23 09:10:31 PST 2015


 loolwsd/ChildProcessSession.cpp |    5 ++++-
 loolwsd/ChildProcessSession.hpp |   11 ++++++++++-
 loolwsd/LOOLWSD.cpp             |    2 +-
 3 files changed, 15 insertions(+), 3 deletions(-)

New commits:
commit 03f33c71d9c5cde5e56e8d49a2f6fa84912b17f5
Author: Henry Castro <hcastro at collabora.com>
Date:   Sun Dec 13 14:25:57 2015 -0500

    loolwsd: Multiple views in ChildProcessSession
    
    Change-Id: I07359c97acc1e5e48dbbd35dc21ed08471c0697e
    Reviewed-on: https://gerrit.libreoffice.org/20899
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/ChildProcessSession.cpp b/loolwsd/ChildProcessSession.cpp
index 5d73230..dfa179f 100644
--- a/loolwsd/ChildProcessSession.cpp
+++ b/loolwsd/ChildProcessSession.cpp
@@ -42,9 +42,11 @@ using Poco::Util::Application;
 
 ChildProcessSession::ChildProcessSession(std::shared_ptr<WebSocket> ws,
                                          LibreOfficeKit *loKit,
+                                         LibreOfficeKitDocument * loKitDocument,
                                          const std::string& childId) :
     LOOLSession(ws, Kind::ToMaster),
-    _loKitDocument(NULL),
+    _loKitDocument(loKitDocument),
+    _viewId(0),
     _loKit(loKit),
     _childId(childId),
     _clientPart(0)
@@ -57,6 +59,7 @@ ChildProcessSession::~ChildProcessSession()
     std::cout << Util::logPrefix() << "ChildProcessSession dtor this=" << this << std::endl;
     if (LIBREOFFICEKIT_HAS(_loKit, registerCallback))
         _loKit->pClass->registerCallback(_loKit, 0, 0);
+    Util::shutdownWebSocket(*_ws);
 }
 
 bool ChildProcessSession::handleInput(const char *buffer, int length)
diff --git a/loolwsd/ChildProcessSession.hpp b/loolwsd/ChildProcessSession.hpp
index 24bebc5..5b7baef 100644
--- a/loolwsd/ChildProcessSession.hpp
+++ b/loolwsd/ChildProcessSession.hpp
@@ -18,9 +18,16 @@
 class ChildProcessSession final : public LOOLSession
 {
 public:
+    /// Create a new ChildProcessSession
+    /// ws The socket to our counterparty (Child or Master).
+    /// loKit The LOKit instance.
+    /// loKitDocument The instance to an existing document (when opening
+    ///                 a new view) or nullptr (when first view).
+    /// childId The id of the child, used by downloadas to construct jailed path.
     ChildProcessSession(std::shared_ptr<Poco::Net::WebSocket> ws,
                         LibreOfficeKit *loKit,
-                        const std::string& _childId);
+                        LibreOfficeKitDocument * loKitDocument,
+                        const std::string& childId);
     virtual ~ChildProcessSession();
 
     virtual bool handleInput(const char *buffer, int length) override;
@@ -33,6 +40,8 @@ public:
 
     LibreOfficeKitDocument *_loKitDocument;
     std::string _docType;
+    /// View ID, returned by createView() or 0 by default.
+    int _viewId;
 
  protected:
     virtual bool loadDocument(const char *buffer, int length, Poco::StringTokenizer& tokens) override;
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 8bdc377..f02d7e5 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -1026,7 +1026,7 @@ void LOOLWSD::componentMain()
         HTTPResponse response;
         std::shared_ptr<WebSocket> ws(new WebSocket(cs, request, response));
 
-        std::shared_ptr<ChildProcessSession> session(new ChildProcessSession(ws, loKit, std::to_string(_childId)));
+        std::shared_ptr<ChildProcessSession> session(new ChildProcessSession(ws, loKit, nullptr, std::to_string(_childId)));
 
         ws->setReceiveTimeout(0);
 


More information about the Libreoffice-commits mailing list