[Libreoffice-commits] online.git: loleaflet/src loolwsd/LOOLWSD.cpp loolwsd/PROBLEMS loolwsd/protocol.txt

Jan Holesovsky kendy at collabora.com
Tue Mar 15 09:40:18 UTC 2016


 loleaflet/src/core/Socket.js |    2 +-
 loolwsd/LOOLWSD.cpp          |    5 ++++-
 loolwsd/PROBLEMS             |    9 +++++++--
 loolwsd/protocol.txt         |    2 +-
 4 files changed, 13 insertions(+), 5 deletions(-)

New commits:
commit 6b15dfd552535eeb8bd1ac3e1a6c5afeb1f08873
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Tue Mar 15 10:32:28 2016 +0100

    loolwsd, loleaflet: Rename 'connectionclose' to 'disconnect'.

diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index ce953f9..9ca9b53 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -24,7 +24,7 @@ L.Socket = L.Class.extend({
 
 	close: function () {
 		// mark this as a deliberate shutdown
-		this.sendMessage('closeconnection');
+		this.sendMessage('disconnect');
 
 		this.socket.onerror = function () {};
 		this.socket.onclose = function () {};
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 767f8b0..f98429b 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -577,8 +577,11 @@ private:
                 const std::string firstLine = getFirstLine(data, size);
                 if (singleLine || firstLine.find("paste") == 0)
                 {
-                    if (firstLine == "closeconnection")
+                    if (firstLine.compare(0, 10, "disconnect") == 0) // starts with "disconnect"
+                    {
                         normalShutdown = true;
+                        return true;
+                    }
 
                     queue.put(std::string(data, size));
                     return true;
diff --git a/loolwsd/PROBLEMS b/loolwsd/PROBLEMS
index 38fc312..86626dd 100644
--- a/loolwsd/PROBLEMS
+++ b/loolwsd/PROBLEMS
@@ -31,8 +31,13 @@
   situations anyway, especially for the socket talking to the
   client. For the internal communication in the process tree,
   "disconnect" messages are barely acceptable, if the code is already
-  written to generate and expect them. But they should never be sent
-  to a client (or expected from it).
+  written to generate and expect them.
+
+  For the moment, we send them from the client too - to distinguish the
+  browser crash or connection loss from a deliberate shutdown.
+  We are saving the document in the case we don't get the explicit
+  'disconnect'.  When we move to actually saving the document all
+  the time automatically, the 'disconnect' message should be removed.
 
 - 'make check' does not work, or fails randomly, unless you have a
   freshly started loolwsd with a --numprespawn option that is big
diff --git a/loolwsd/protocol.txt b/loolwsd/protocol.txt
index 3537a64..ae92db0 100644
--- a/loolwsd/protocol.txt
+++ b/loolwsd/protocol.txt
@@ -17,7 +17,7 @@ canceltiles
     dropped and will not be handled. There is no guarantee of exactly
     which tile: messages might still be sent back to the client.
 
-closeconnection
+disconnect
 
     The socket is going to be shut down normally.  This is to distinguish
     deliberate shutdown from the case when the connection was lost, or


More information about the Libreoffice-commits mailing list