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

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


 loolwsd/ClientSession.cpp        |    3 +-
 loolwsd/ClientSession.hpp        |   13 ++++------
 loolwsd/DocumentBroker.hpp       |    4 +--
 loolwsd/LOOLWSD.cpp              |    1 
 loolwsd/Makefile.am              |    2 -
 loolwsd/MasterProcessSession.cpp |   46 --------------------------------------
 loolwsd/MasterProcessSession.hpp |   47 ---------------------------------------
 loolwsd/PrisonerSession.hpp      |    6 ----
 8 files changed, 9 insertions(+), 113 deletions(-)

New commits:
commit 7f767e7cf6a5a22c01227f60d0b5d1b758d9bd21
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Mon May 16 23:02:05 2016 -0400

    loolwsd: MasterProcessSession splitting: removed MasterProcessSession
    
    Change-Id: If132e8787f6ed7fa21d235cc355d7a29395b3c4d
    Reviewed-on: https://gerrit.libreoffice.org/25049
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/ClientSession.cpp b/loolwsd/ClientSession.cpp
index c1f4023..33615ed 100644
--- a/loolwsd/ClientSession.cpp
+++ b/loolwsd/ClientSession.cpp
@@ -40,6 +40,7 @@ ClientSession::ClientSession(const std::string& id,
     LOOLSession(id, Kind::ToClient, ws),
     _docBroker(docBroker),
     _queue(queue),
+    _haveEditLock(false),
     _loadFailed(false),
     _loadPart(-1)
 {
@@ -242,7 +243,7 @@ bool ClientSession::getStatus(const char *buffer, int length)
 void ClientSession::setEditLock(const bool value)
 {
     // Update the sate and forward to child.
-    _bEditLock = value;
+    _haveEditLock = value;
     const auto msg = std::string("editlock: ") + (value ? "1" : "0");
     forwardToPeer(msg.data(), msg.size());
 }
diff --git a/loolwsd/ClientSession.hpp b/loolwsd/ClientSession.hpp
index b884e72..65891f7 100644
--- a/loolwsd/ClientSession.hpp
+++ b/loolwsd/ClientSession.hpp
@@ -10,11 +10,6 @@
 #ifndef INCLUDED_CLIENTSSESSION_HPP
 #define INCLUDED_CLIENTSSESSION_HPP
 
-#include <time.h>
-
-#include <Poco/Random.h>
-
-#include "MasterProcessSession.hpp"
 #include "LOOLSession.hpp"
 #include "MessageQueue.hpp"
 
@@ -32,8 +27,8 @@ public:
     virtual ~ClientSession();
 
     void setEditLock(const bool value);
-    void markEditLock(const bool value) { _bEditLock = value; }
-    bool isEditLocked() const { return _bEditLock; }
+    void markEditLock(const bool value) { _haveEditLock = value; }
+    bool isEditLocked() const { return _haveEditLock; }
 
     void setPeer(const std::shared_ptr<PrisonerSession>& peer) { _peer = peer; }
     bool shutdownPeer(Poco::UInt16 statusCode, const std::string& message);
@@ -94,7 +89,9 @@ private:
     // If this document holds the edit lock.
     // An edit lock will only allow the current session to make edits,
     // while other session opening the same document can only see
-    bool _bEditLock = false;
+    bool _haveEditLock;
+
+    /// Our peer that connects us to the child.
     std::weak_ptr<PrisonerSession> _peer;
 
     /// Store URLs of completed 'save as' documents.
diff --git a/loolwsd/DocumentBroker.hpp b/loolwsd/DocumentBroker.hpp
index 7092b55..c64e0e7 100644
--- a/loolwsd/DocumentBroker.hpp
+++ b/loolwsd/DocumentBroker.hpp
@@ -15,6 +15,7 @@
 #include <atomic>
 #include <chrono>
 #include <memory>
+#include <condition_variable>
 #include <mutex>
 #include <string>
 #include <thread>
@@ -24,12 +25,11 @@
 #include <Poco/Net/WebSocket.h>
 
 #include "IoUtil.hpp"
-#include "MasterProcessSession.hpp"
+#include "TileCache.hpp"
 #include "Util.hpp"
 
 // Forwards.
 class StorageBase;
-class TileCache;
 class DocumentBroker;
 
 /// Represents a new LOK child that is read
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 34da033..e9f44ab 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -90,7 +90,6 @@
 #include "LOOLWSD.hpp"
 #include "ClientSession.hpp"
 #include "PrisonerSession.hpp"
-#include "MasterProcessSession.hpp"
 #include "QueueHandler.hpp"
 #include "Storage.hpp"
 #include "UserMessages.hpp"
diff --git a/loolwsd/Makefile.am b/loolwsd/Makefile.am
index 8127013..98e9960 100644
--- a/loolwsd/Makefile.am
+++ b/loolwsd/Makefile.am
@@ -44,7 +44,6 @@ loolwsd_SOURCES = Admin.cpp \
                   LOOLWSD.cpp \
                   ClientSession.cpp \
                   PrisonerSession.cpp \
-                  MasterProcessSession.cpp \
                   Storage.cpp \
                   TileCache.cpp \
                   $(shared_sources)
@@ -92,7 +91,6 @@ noinst_HEADERS = Admin.hpp \
                  LOOLProtocol.hpp \
                  LOOLSession.hpp \
                  LOOLWSD.hpp \
-                 MasterProcessSession.hpp \
                  ClientSession.hpp \
                  PrisonerSession.hpp \
                  MessageQueue.hpp \
diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp
deleted file mode 100644
index 6f77822..0000000
--- a/loolwsd/MasterProcessSession.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include "config.h"
-
-#include <Poco/FileStream.h>
-#include <Poco/JSON/Object.h>
-#include <Poco/JSON/Parser.h>
-#include <Poco/URI.h>
-#include <Poco/URIStreamOpener.h>
-
-#include "Common.hpp"
-#include "LOOLProtocol.hpp"
-#include "LOOLSession.hpp"
-#include "LOOLWSD.hpp"
-#include "MasterProcessSession.hpp"
-#include "Rectangle.hpp"
-#include "Storage.hpp"
-#include "TileCache.hpp"
-#include "IoUtil.hpp"
-#include "Util.hpp"
-
-using namespace LOOLProtocol;
-
-using Poco::Path;
-using Poco::StringTokenizer;
-
-MasterProcessSession::MasterProcessSession(const std::string& id,
-                                           const Kind kind,
-                                           std::shared_ptr<Poco::Net::WebSocket> ws) :
-    LOOLSession(id, kind, ws)
-{
-    Log::info("MasterProcessSession ctor [" + getName() + "].");
-}
-
-MasterProcessSession::~MasterProcessSession()
-{
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/loolwsd/MasterProcessSession.hpp b/loolwsd/MasterProcessSession.hpp
deleted file mode 100644
index e284c2e..0000000
--- a/loolwsd/MasterProcessSession.hpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#ifndef INCLUDED_MASTERPROCESSSESSION_HPP
-#define INCLUDED_MASTERPROCESSSESSION_HPP
-
-#include <time.h>
-
-#include <Poco/Random.h>
-
-#include "LOOLSession.hpp"
-#include "MessageQueue.hpp"
-
-class DocumentBroker;
-
-class MasterProcessSession : public LOOLSession
-{
- public:
-    MasterProcessSession(const std::string& id,
-                         const Kind kind,
-                         std::shared_ptr<Poco::Net::WebSocket> ws);
-    virtual ~MasterProcessSession();
- private:
-    bool shutdownPeer(Poco::UInt16 statusCode, const std::string& message);
-
- protected:
-    void forwardToPeer(const char *buffer, int length);
-
-    // If _kind==ToPrisoner and the child process has started and completed its handshake with the
-    // parent process: Points to the WebSocketSession for the child process handling the document in
-    // question, if any.
-
-    // In the session to the child process, points to the LOOLSession for the LOOL client. This will
-    // obvious have to be rethought when we add collaboration and there can be several LOOL clients
-    // per document being edited (i.e., per child process).
-    std::weak_ptr<MasterProcessSession> _peer;
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/loolwsd/PrisonerSession.hpp b/loolwsd/PrisonerSession.hpp
index e0beb87..e351f2f 100644
--- a/loolwsd/PrisonerSession.hpp
+++ b/loolwsd/PrisonerSession.hpp
@@ -10,13 +10,7 @@
 #ifndef INCLUDED_PRISONERSESSION_HPP
 #define INCLUDED_PRISONERSESSION_HPP
 
-#include <time.h>
-
-#include <Poco/Random.h>
-
-#include "MasterProcessSession.hpp"
 #include "LOOLSession.hpp"
-#include "MessageQueue.hpp"
 
 class DocumentBroker;
 class ClientSession;


More information about the Libreoffice-commits mailing list