[Libreoffice-commits] online.git: loleaflet/src loolwsd/ChildProcessSession.cpp loolwsd/LOOLWSD.cpp loolwsd/MasterProcessSession.cpp

Pranav Kant pranavk at collabora.com
Wed Apr 13 12:06:20 UTC 2016


 loleaflet/src/core/Socket.js     |    3 ---
 loolwsd/ChildProcessSession.cpp  |    6 ------
 loolwsd/LOOLWSD.cpp              |   18 ++++--------------
 loolwsd/MasterProcessSession.cpp |    7 -------
 4 files changed, 4 insertions(+), 30 deletions(-)

New commits:
commit 68b3a2c81e92de7be3d1b6bd503ff78b5c924422
Author: Pranav Kant <pranavk at collabora.com>
Date:   Wed Apr 13 16:31:15 2016 +0530

    Always save irrespective of nature of socket close
    
    Do not distinguish between normal shutdown or abnormal shutdown.
    Also remove 'disconnect' frame to indicate normal shutdown.
    
    Change-Id: I98fd9f5a219feb1097c57302dba14e08ad9bf143

diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 8b939f7..ccb63be 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -23,9 +23,6 @@ L.Socket = L.Class.extend({
 	},
 
 	close: function () {
-		// mark this as a deliberate shutdown
-		this.sendMessage('disconnect');
-
 		this.socket.onerror = function () {};
 		this.socket.onclose = function () {};
 		this.socket.onmessage = function () {};
diff --git a/loolwsd/ChildProcessSession.cpp b/loolwsd/ChildProcessSession.cpp
index ac6b53a..aeb4219 100644
--- a/loolwsd/ChildProcessSession.cpp
+++ b/loolwsd/ChildProcessSession.cpp
@@ -408,7 +408,6 @@ bool ChildProcessSession::_handleInput(const char *buffer, int length)
 
         assert(tokens[0] == "clientzoom" ||
                tokens[0] == "clientvisiblearea" ||
-               tokens[0] == "disconnect" ||
                tokens[0] == "downloadas" ||
                tokens[0] == "getchildid" ||
                tokens[0] == "gettextselection" ||
@@ -443,11 +442,6 @@ bool ChildProcessSession::_handleInput(const char *buffer, int length)
         {
             return clientVisibleArea(buffer, length, tokens);
         }
-        else if (tokens[0] == "disconnect")
-        {
-            // This was the last we would hear from the client on this socket.
-            return handleDisconnect(tokens);
-        }
         else if (tokens[0] == "downloadas")
         {
             return downloadAs(buffer, length, tokens);
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 6d68747..51ac2fe 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -584,28 +584,18 @@ private:
 
         Thread queueHandlerThread;
         queueHandlerThread.start(handler);
-        bool normalShutdown = false;
 
         IoUtil::SocketProcessor(ws, response,
-                [&session, &queue, &normalShutdown](const std::vector<char>& payload)
+                [&session, &queue](const std::vector<char>& payload)
             {
-                const auto token = LOOLProtocol::getFirstToken(payload);
-                if (token == "disconnect")
-                {
-                    normalShutdown = true;
-                }
-                else
-                {
-                    queue->put(payload);
-                }
-
+                queue->put(payload);
                 return true;
             },
             []() { return TerminationFlag; });
 
-        if (docBroker->getSessionsCount() == 1 && !normalShutdown && !session->_bLoadError)
+        if (docBroker->getSessionsCount() == 1 && !session->_bLoadError)
         {
-            Log::info("Non-deliberate shutdown of the last session, saving the document before tearing down.");
+            Log::info("Shutdown of the last session, saving the document before tearing down.");
 
             // Use auto-save to save only when there are modifications since last save.
             // We also need to wait until the save notification reaches us
diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp
index 93aa859..bd96572 100644
--- a/loolwsd/MasterProcessSession.cpp
+++ b/loolwsd/MasterProcessSession.cpp
@@ -314,7 +314,6 @@ bool MasterProcessSession::_handleInput(const char *buffer, int length)
              tokens[0] != "clientzoom" &&
              tokens[0] != "clientvisiblearea" &&
              tokens[0] != "commandvalues" &&
-             tokens[0] != "disconnect" &&
              tokens[0] != "downloadas" &&
              tokens[0] != "getchildid" &&
              tokens[0] != "gettextselection" &&
@@ -405,12 +404,6 @@ bool MasterProcessSession::_handleInput(const char *buffer, int length)
         {
             forwardToPeer(buffer, length);
         }
-
-        if (tokens[0] == "disconnect")
-        {
-            // This was the last we would hear from the client on this socket.
-            return handleDisconnect(tokens);
-        }
     }
     return true;
 }


More information about the Libreoffice-commits mailing list