[Libreoffice-commits] online.git: Branch 'distro/collabora/cloudsuite-rc1' - loleaflet/src loolwsd/LOOLWSD.cpp loolwsd/MasterProcessSession.cpp loolwsd/MasterProcessSession.hpp

Pranav Kant pranavk at collabora.com
Mon Apr 4 18:49:38 UTC 2016


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

New commits:
commit e7b1326625ea5553014b524e984a2c3a156131ec
Author: Pranav Kant <pranavk at collabora.com>
Date:   Tue Apr 5 00:09:54 2016 +0530

    Fixed a regression in opening password protected docs
    
    Change-Id: Ife378538c98f091e271e0c474fb271c513887774

diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 9ca9b53..8b939f7 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -113,6 +113,8 @@ L.Socket = L.Class.extend({
 			}
 		}
 		else if (textMsg.startsWith('error:') && command.errorCmd === 'load') {
+			this.close();
+
 			var errorKind = command.errorKind;
 			var passwordNeeded = false;
 			if (errorKind.startsWith('passwordrequired')) {
@@ -139,7 +141,7 @@ L.Socket = L.Class.extend({
 					input: '<input name="password" type="password" required />',
 					callback: L.bind(function(data) {
 						this._map._docPassword = data.password;
-						this._onOpen();
+						this.initialize(this._map);
 					}, this)
 				});
 				return;
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 1dd6eef..e59bb53 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -494,11 +494,10 @@ private:
             "Client_ws_" + id
             );
 
-        if (docBroker->getSessionsCount() == 1 && !normalShutdown)
+        if (docBroker->getSessionsCount() == 1 && !normalShutdown && !session->_bLoadError)
         {
             //TODO: This isn't this simple. We need to wait for the notification
             // of save so Storage can persist the save (if necessary).
-            // In addition, we shouldn't issue save when opening of the doc fails.
             Log::info("Non-deliberate shutdown of the last session, saving the document before tearing down.");
             queue->put("uno .uno:Save");
         }
diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp
index 432e751..4544063 100644
--- a/loolwsd/MasterProcessSession.cpp
+++ b/loolwsd/MasterProcessSession.cpp
@@ -169,12 +169,8 @@ bool MasterProcessSession::_handleInput(const char *buffer, int length)
                             errorKind == "passwordrequired:to-modify" ||
                             errorKind == "wrongpassword")
                         {
-                            _isDocPasswordProtected = true;
-                            // Reset docURL so that client can send another load request with password
-                            peer->_docURL = "";
-                            // disconnect 'ToPrisoner' after letting client know that password is required
                             forwardToPeer(buffer, length);
-                            LOOLSession::disconnect();
+                            peer->_bLoadError = true;
                             return false;
                         }
                     }
diff --git a/loolwsd/MasterProcessSession.hpp b/loolwsd/MasterProcessSession.hpp
index 7838fd4..da7105f 100644
--- a/loolwsd/MasterProcessSession.hpp
+++ b/loolwsd/MasterProcessSession.hpp
@@ -64,6 +64,9 @@ public:
     time_t _idleSaveTime;
     time_t _autoSaveTime;
 
+    // Raise this flag on ToClient from ToPrisoner to let ToClient know of load failures
+    bool _bLoadError = false;
+
  protected:
     bool invalidateTiles(const char *buffer, int length, Poco::StringTokenizer& tokens);
 


More information about the Libreoffice-commits mailing list