[Libreoffice-commits] online.git: Branch 'distro/collabora/milestone-4' - 11 commits - loleaflet/Makefile loleaflet/src loolwsd/configure.ac loolwsd/LOOLSession.cpp loolwsd/LOOLSession.hpp
Andras Timar
andras.timar at collabora.com
Thu Aug 27 02:14:09 PDT 2015
loleaflet/Makefile | 2 -
loleaflet/src/layer/tile/GridLayer.js | 2 -
loleaflet/src/layer/tile/TileLayer.js | 40 +++++++++++++++++++++++++++++++++-
loolwsd/LOOLSession.cpp | 30 +++++++++++++++++++++----
loolwsd/LOOLSession.hpp | 1
loolwsd/configure.ac | 2 -
6 files changed, 68 insertions(+), 9 deletions(-)
New commits:
commit 73665b033270122f6f130a08bca81e5026f2c042
Author: Andras Timar <andras.timar at collabora.com>
Date: Thu Aug 27 11:13:48 2015 +0200
loolwsd: bump version after tarball
diff --git a/loolwsd/configure.ac b/loolwsd/configure.ac
index 1525f5d..07db4eb 100644
--- a/loolwsd/configure.ac
+++ b/loolwsd/configure.ac
@@ -3,7 +3,7 @@
AC_PREREQ([2.69])
-AC_INIT([loolwsd], [1.2.12], [libreoffice at collabora.com])
+AC_INIT([loolwsd], [1.2.13], [libreoffice at collabora.com])
AM_INIT_AUTOMAKE([1.11 silent-rules])
commit 1264e929c3ec37c0b93659f8a9f94e5da3d94690
Author: Andras Timar <andras.timar at collabora.com>
Date: Thu Aug 27 11:13:21 2015 +0200
loleaflet: bump version after tarball
diff --git a/loleaflet/Makefile b/loleaflet/Makefile
index 6031d68..ec025f5 100644
--- a/loleaflet/Makefile
+++ b/loleaflet/Makefile
@@ -3,7 +3,7 @@
# ("micro") part: Between releases odd, even for releases (no other
# changes inbetween).
-VERSION=1.1.34
+VERSION=1.1.35
# Version number of the bundled 'draw' thing
DRAW_VERSION=0.2.4
commit 8484af5ff701c502d3014bcd1cac6bcc908564a1
Author: Andras Timar <andras.timar at collabora.com>
Date: Thu Aug 27 10:16:21 2015 +0200
loleaflet: bump version before tarball
diff --git a/loleaflet/Makefile b/loleaflet/Makefile
index 9697db2..6031d68 100644
--- a/loleaflet/Makefile
+++ b/loleaflet/Makefile
@@ -3,7 +3,7 @@
# ("micro") part: Between releases odd, even for releases (no other
# changes inbetween).
-VERSION=1.1.33
+VERSION=1.1.34
# Version number of the bundled 'draw' thing
DRAW_VERSION=0.2.4
commit 0d40086c5adaf1788434a37b728007a728db3cb0
Author: Andras Timar <andras.timar at collabora.com>
Date: Thu Aug 27 10:15:08 2015 +0200
loolwsd: bump version before tarball
diff --git a/loolwsd/configure.ac b/loolwsd/configure.ac
index 06752ab..1525f5d 100644
--- a/loolwsd/configure.ac
+++ b/loolwsd/configure.ac
@@ -3,7 +3,7 @@
AC_PREREQ([2.69])
-AC_INIT([loolwsd], [1.2.11], [libreoffice at collabora.com])
+AC_INIT([loolwsd], [1.2.12], [libreoffice at collabora.com])
AM_INIT_AUTOMAKE([1.11 silent-rules])
commit a292a2ce55af3cc1fc43d3e56b50a34187947de9
Author: Henry Castro <hcastro at collabora.com>
Date: Thu Aug 27 00:25:14 2015 -0400
loleaflet: update part= optional parameter
(cherry picked from commit 6da0b93e1651a42a7a863f660f2809a34e125627)
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 58ee666..833a252 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -536,11 +536,8 @@ L.TileLayer = L.GridLayer.extend({
// clear queue
this._msgQueue = [];
// reload interrupted document
- this._msgQueue.push({msg:'load url=' + this.options.doc +
+ this._msgQueue.push({msg:'load part='+ this._currentPart + ' url=' + this.options.doc +
( this.options.timestamp ? ' timestamp=' + this.options.timestamp : '') , coords: coords});
- // restore current part
- this._msgQueue.push({msg:"setclientpart part=" + this._currentPart, coords: coords});
- this._msgQueue.push({msg:"setpage page=" + this._currentPart, coords: coords});
// push next message
this._msgQueue.push({msg: msg, coords: coords});
}
commit 98787f4585b87f6ea0531517894a4703db12a483
Author: Henry Castro <hcastro at collabora.com>
Date: Thu Aug 27 00:18:44 2015 -0400
loolwsd: add an optional parameter to load url= ...
load part=X url="http" is required to re-establish the connection
(cherry picked from commit b32b407714d1d51c6530c6f140b11f9758979f54)
diff --git a/loolwsd/LOOLSession.cpp b/loolwsd/LOOLSession.cpp
index 2d8ae2d..2545134 100644
--- a/loolwsd/LOOLSession.cpp
+++ b/loolwsd/LOOLSession.cpp
@@ -133,7 +133,8 @@ std::mutex MasterProcessSession::_rngMutex;
MasterProcessSession::MasterProcessSession(std::shared_ptr<WebSocket> ws, Kind kind) :
LOOLSession(ws, kind),
_childId(0),
- _curPart(0)
+ _curPart(0),
+ _loadPart(-1)
{
std::cout << Util::logPrefix() << "MasterProcessSession ctor this=" << this << " ws=" << _ws.get() << std::endl;
}
@@ -350,12 +351,15 @@ bool MasterProcessSession::invalidateTiles(const char *buffer, int length, Strin
bool MasterProcessSession::loadDocument(const char *buffer, int length, StringTokenizer& tokens)
{
- if (tokens.count() < 2 || tokens.count() > 3)
+ if (tokens.count() < 2 || tokens.count() > 4)
{
sendTextFrame("error: cmd=load kind=syntax");
return false;
}
+ if (tokens.count() > 2 )
+ getTokenInteger(tokens[1], "part", _loadPart);
+
std::string timestamp;
for (size_t i = 1; i < tokens.count(); ++i)
{
@@ -531,7 +535,7 @@ void MasterProcessSession::dispatchChild()
_peer = childSession;
childSession->_peer = shared_from_this();
- std::string loadRequest = "load url=" + _docURL;
+ std::string loadRequest = "load" + (_loadPart >= 0 ? " part=" + std::to_string(_loadPart) : "") + " url=" + _docURL;
forwardToPeer(loadRequest.c_str(), loadRequest.size());
}
@@ -740,13 +744,19 @@ extern "C"
bool ChildProcessSession::loadDocument(const char *buffer, int length, StringTokenizer& tokens)
{
- if (tokens.count() != 2)
+ int part = -1;
+ if (tokens.count() < 2 || tokens.count() > 4)
{
sendTextFrame("error: cmd=load kind=syntax");
return false;
}
- if (tokens[1].find("url=") == 0)
+ if (tokens.count() > 2 && tokens[2].find("url=") == 0)
+ {
+ getTokenInteger(tokens[1], "part", part);
+ _docURL = tokens[2].substr(strlen("url="));
+ }
+ else if (tokens[1].find("url=") == 0)
_docURL = tokens[1].substr(strlen("url="));
else
_docURL = tokens[1];
@@ -786,6 +796,12 @@ bool ChildProcessSession::loadDocument(const char *buffer, int length, StringTok
_loKitDocument->pClass->initializeForRendering(_loKitDocument);
+ if ( _docType != "text" && part != -1)
+ {
+ _clientPart = part;
+ _loKitDocument->pClass->setPart(_loKitDocument, part);
+ }
+
if (!getStatus(buffer, length))
return false;
diff --git a/loolwsd/LOOLSession.hpp b/loolwsd/LOOLSession.hpp
index 0030f28..3804a54 100644
--- a/loolwsd/LOOLSession.hpp
+++ b/loolwsd/LOOLSession.hpp
@@ -142,6 +142,7 @@ private:
static Poco::Random _rng;
static std::mutex _rngMutex;
int _curPart;
+ int _loadPart;
};
class ChildProcessSession final : public LOOLSession
commit 265b0ac45d9fc20f13d888f3c3320944de4158d8
Author: Henry Castro <hcastro at collabora.com>
Date: Thu Aug 27 00:07:11 2015 -0400
loolwsd: update status when switching parts
(cherry picked from commit 90f790d7add57d3b47db5539c9581b085a68fd35)
diff --git a/loolwsd/LOOLSession.cpp b/loolwsd/LOOLSession.cpp
index 592c7fd..2d8ae2d 100644
--- a/loolwsd/LOOLSession.cpp
+++ b/loolwsd/LOOLSession.cpp
@@ -615,6 +615,7 @@ bool ChildProcessSession::handleInput(const char *buffer, int length)
if (_docType != "text" && _loKitDocument->pClass->getPart(_loKitDocument) != _clientPart)
{
_loKitDocument->pClass->setPart(_loKitDocument, _clientPart);
+ getStatus("", 0);
}
if (tokens[0] == "gettextselection")
{
@@ -787,6 +788,7 @@ bool ChildProcessSession::loadDocument(const char *buffer, int length, StringTok
if (!getStatus(buffer, length))
return false;
+
_loKitDocument->pClass->registerCallback(_loKitDocument, myCallback, this);
return true;
@@ -844,6 +846,7 @@ void ChildProcessSession::sendTile(const char *buffer, int length, StringTokeniz
unsigned char *pixmap = new unsigned char[4 * width * height];
if (_docType != "text" && part != _loKitDocument->pClass->getPart(_loKitDocument)) {
_loKitDocument->pClass->setPart(_loKitDocument, part);
+ getStatus("", 0);
}
_loKitDocument->pClass->paintTile(_loKitDocument, pixmap, width, height, tilePosX, tilePosY, tileWidth, tileHeight);
@@ -1040,6 +1043,7 @@ bool ChildProcessSession::setPage(const char *buffer, int length, StringTokenize
return false;
}
_loKitDocument->pClass->setPart(_loKitDocument, page);
+ getStatus("", 0);
return true;
}
commit e81b3b68c68820d25184e2974928b8256264bd5d
Author: Henry Castro <hcastro at collabora.com>
Date: Wed Aug 26 22:09:11 2015 -0400
loleaflet: add timestamp when trying to ...
re-establish dropped connection.
(cherry picked from commit f109da69e49db2157ba4a57ecd931037b7096991)
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index e8dc62b..58ee666 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -536,7 +536,8 @@ L.TileLayer = L.GridLayer.extend({
// clear queue
this._msgQueue = [];
// reload interrupted document
- this._msgQueue.push({msg:'load url=' + this.options.doc, coords: coords});
+ this._msgQueue.push({msg:'load url=' + this.options.doc +
+ ( this.options.timestamp ? ' timestamp=' + this.options.timestamp : '') , coords: coords});
// restore current part
this._msgQueue.push({msg:"setclientpart part=" + this._currentPart, coords: coords});
this._msgQueue.push({msg:"setpage page=" + this._currentPart, coords: coords});
commit 27a9b650fe862dbb2e7fa2d7e9e1b1c2d535760e
Author: Henry Castro <hcastro at collabora.com>
Date: Wed Aug 26 00:28:11 2015 -0400
loleaflet: re-establish the connection
Based on a patch by Mihai Varga.
(cherry picked from commit b7bd11f58af670861b4c28eafac96358487b47d7)
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 46d6332..e8dc62b 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -91,6 +91,7 @@ L.TileLayer = L.GridLayer.extend({
draggable: true
});
this._emptyTilesCount = 0;
+ this._msgQueue = [];
},
_initDocument: function () {
@@ -517,9 +518,41 @@ L.TileLayer = L.GridLayer.extend({
}
},
+ _onOpenSocket: function () {
+ for (var i = 0; i < this._msgQueue.length; i++) {
+ this._map.socket.send(this._msgQueue[i].msg);
+ L.Log.log(this._msgQueue[i].msg, this._msgQueue[i].coords);
+ }
+ this._msgQueue = [];
+ },
+
sendMessage: function (msg, coords) {
- L.Log.log(msg, L.OUTGOING, coords);
+ var socketState = this._map.socket.readyState;
+ if (socketState === 2 || socketState === 3) {
+ var socket = this._map._initSocket();
+ if (socket) {
+ socket.onopen = L.bind(this._onOpenSocket, this);
+ socket.onmessage = L.bind(this._onMessage, this);
+ // clear queue
+ this._msgQueue = [];
+ // reload interrupted document
+ this._msgQueue.push({msg:'load url=' + this.options.doc, coords: coords});
+ // restore current part
+ this._msgQueue.push({msg:"setclientpart part=" + this._currentPart, coords: coords});
+ this._msgQueue.push({msg:"setpage page=" + this._currentPart, coords: coords});
+ // push next message
+ this._msgQueue.push({msg: msg, coords: coords});
+ }
+ }
+
+ if (socketState === 0) {
+ // push message while trying to connect socket again.
+ this._msgQueue.push({msg: msg, coords: coords});
+ }
+ else if (socketState === 1) {
this._map.socket.send(msg);
+ L.Log.log(msg, L.OUTGOING, coords);
+ }
},
_tileOnLoad: function (done, tile) {
commit ceaccbf15b6a628f18579fe4eb3187b99599f18f
Author: Henry Castro <hcastro at collabora.com>
Date: Wed Aug 26 00:16:48 2015 -0400
loleaflet: clear cursor and selection when ...
socket error.
(cherry picked from commit d60360dac3330f35e60d9fcf335e0a23c292d978)
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 76404e9..46d6332 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -112,6 +112,7 @@ L.TileLayer = L.GridLayer.extend({
this._map.on('zoomend', this._onUpdateCursor, this);
this._map.on('dragstart', this._onDragStart, this);
this._map.on('requestloksession', this._onRequestLOKSession, this);
+ this._map.on('error', this._mapOnError, this);
this._startMarker.on('drag dragend', this._onSelectionHandleDrag, this);
this._endMarker.on('drag dragend', this._onSelectionHandleDrag, this);
this._textArea = this._map._textArea;
@@ -533,6 +534,12 @@ L.TileLayer = L.GridLayer.extend({
done(e, tile);
},
+ _mapOnError: function (e) {
+ if (e.msg) {
+ this._map.setPermission('view');
+ }
+ },
+
_parseServerCmd: function (msg) {
var tokens = msg.split(/[ \n]+/);
var command = {};
commit 15d8bc4d93e6783ae54b41af83cf340d403c0bd7
Author: Henry Castro <hcastro at collabora.com>
Date: Tue Aug 25 23:58:32 2015 -0400
loleaflet: prefetch tiles if socket is opened
(cherry picked from commit a2037f94f1c7eb7321e0e2001f35b8e33673dd10)
diff --git a/loleaflet/src/layer/tile/GridLayer.js b/loleaflet/src/layer/tile/GridLayer.js
index 358e574..b90df32 100644
--- a/loleaflet/src/layer/tile/GridLayer.js
+++ b/loleaflet/src/layer/tile/GridLayer.js
@@ -671,7 +671,7 @@ L.GridLayer = L.Layer.extend({
}
if (!this._tileCache[key]) {
- if (this.options.useSocket && this._map.socket) {
+ if (this.options.useSocket && this._map.socket && this._map.socket.readyState === 1) {
var twips = this._coordsToTwips(coords);
var msg = 'tile ' +
'part=' + coords.part + ' ' +
More information about the Libreoffice-commits
mailing list