Commit graph

4329 commits

Author SHA1 Message Date
Jan Holesovsky
9842f3239f Make sure we don't use the jitter / delay in production builds.
And default to 0 even for debug; who wants to use that for debugging, they
know what to do.

Change-Id: I23dd0c5f806b2b31a883b7a2b8d822ea8c0bb6c5
2016-11-28 11:31:06 +01:00
Miklos Vajna
752372a2b0 IoUtil: remove never read write of 'n'
Change-Id: I2dfd85696b39ae1f1c7bbc33cec544bc04f980ac
2016-11-28 09:11:11 +01:00
Ashod Nakashian
b8c9163ac8 loolwsd: combine tiles strictly in the same row only
Change-Id: I1d2ba647deac8da749e7cf7b56a1c9a19fe840f8
Reviewed-on: https://gerrit.libreoffice.org/31299
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 05:27:55 +00:00
Ashod Nakashian
2b9ea3d4a6 loolwsd: notify clients before recycling wsd
Change-Id: Ib2733a6af1c27fe39c54f5c3bc6f5bd3acb72a2b
Reviewed-on: https://gerrit.libreoffice.org/31298
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 05:27:34 +00:00
Ashod Nakashian
c0f9ccee42 loleaflet: activate and dismiss dialogs only upon reconnection
Change-Id: I2d8b3d9788b7f66bc746537e34c90493a7cb408a
Reviewed-on: https://gerrit.libreoffice.org/31296
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 05:04:49 +00:00
Ashod Nakashian
68519f0927 loolwsd: destroy DocBrokers sooner
Change-Id: I10d8ea57083c3b785748062a927574a63e0dd250
Reviewed-on: https://gerrit.libreoffice.org/31297
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 05:04:35 +00:00
Ashod Nakashian
2239f25684 Renamed 'shutdown' to 'shuttingdown'
Change-Id: Idae53a59af13eb54b1f18f1a8cd1dde06421b426
Reviewed-on: https://gerrit.libreoffice.org/31295
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 05:03:54 +00:00
Ashod Nakashian
b35725ab70 loolwsd: support more efficient full-buffer hashing
Change-Id: Ie30929ad4665b51e280c1126adde645742814dad
Reviewed-on: https://gerrit.libreoffice.org/31294
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 05:03:17 +00:00
Ashod Nakashian
da30dc3df3 loolwsd: factor out the png cache lookup
Change-Id: Id287b136b687d9bc4f49a3583e18cb820f4eb21e
Reviewed-on: https://gerrit.libreoffice.org/31293
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 05:02:34 +00:00
Ashod Nakashian
47fa3b1b10 loolwsd: use a better hash function for png caching
We need a fast and good (high avalanche properties)
hash function for the png caching to avoid collissions
(even in the very limited samples we have, since tiles
are likely to have patters, such as all 0's and all 1's
etc.).

Bob Jenkins's public domain SpookyV2 is used here.
It has great avalanache properties and is fast at
~3-bytes / cycle for large messages.

Only trailing whitespace was removed from original
sources and 4 tabs converted to spaces.

Change-Id: Ife57237321625c836d85c894d939fd04a8f577bb
Reviewed-on: https://gerrit.libreoffice.org/31292
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 05:00:37 +00:00
Ashod Nakashian
ef9ab94580 loolwsd: less aggressive png cache eviction
The overall hit-rate improves significantly
when we don't remove entries too soon.
Here we give entries more time to show their
merrit.

There are now two limits, soft and hard.
The former is used to remove entries with no
hits at all, while the latter is used to
avoid overflowing the cache footprint too
much. Entries also get started with a single
hit, which prevents them getting evicted
too soon (i.e. right after getting added).

Finally, there is no longer need to reduce
the hit count of entries too agressively
since we have two tiers (soft and hard limits)
and zero-hit entries are removed before others.

The average cache size while auto-typing in
Writer doc is less than 180kb, which is 1.4x
the original size of 128kb.

Change-Id: I946318151638c9c64c714190084c492f9098852b
Reviewed-on: https://gerrit.libreoffice.org/31291
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 04:58:51 +00:00
Ashod Nakashian
9608935a7c loolwsd: png cache hit rate and cosmetics
Change-Id: I66ab1738503618002bb05504c608969d5aa7b9a9
Reviewed-on: https://gerrit.libreoffice.org/31290
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 04:57:45 +00:00
Ashod Nakashian
f4dd9c1e11 loolwsd: use vector instead of deque for MessageQueue
Change-Id: I879d248e54748916b30c64874ddc237fb662ac11
Reviewed-on: https://gerrit.libreoffice.org/31289
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 04:57:10 +00:00
Ashod Nakashian
db996c7e90 loolwsd: retry shutting down the WS upon exception
Change-Id: I3dc4b6f73c1ef5641c32e756099428a8ef38ee82
Reviewed-on: https://gerrit.libreoffice.org/31288
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 04:56:43 +00:00
Ashod Nakashian
b16fb68ec6 loolwsd: shrink SocketProcessor buffer when too large
When receiving large messages the dynamic socket buffer
is resized to accomodate the incoming large message.

This buffer was previously never reduced in size.
This is an obvious leak that is now avoided.

When the buffer grows beyond quadruple the default
size, it is shrunk back to the default. This gives
a decent balance between memory waste and unnecessary
resizing up and down after each large message received.

Change-Id: Ic3996c80e96592af6f12c4abd1dd737bdc07b814
Reviewed-on: https://gerrit.libreoffice.org/31287
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 04:56:11 +00:00
Ashod Nakashian
6ab32e0aa9 loolwsd: use larger threshold to large messages
Messages larger than a certain size are preambled
with a 'nextmessage' message that hold the size
of the subsequent message.

This is a workaround to a limitation the Poco
WebSocket API where if the buffer size is
smaller than the received frame the socket
ends up in a bad state and must be closed.
Unfortunately the new API that avoids this
workaround is not yet released by Poco.

Here we minimize the need for 'nextmessage'
to truely large messages. The limit is now
raised from above 1KB to over 63KB.

We may raise this limit further, but that will
cost each socket that much dedicated buffer size.

Change-Id: I01e4c68cdbe67e413c04a9725152224a87ab8267
Reviewed-on: https://gerrit.libreoffice.org/31286
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 04:54:37 +00:00
Ashod Nakashian
a8f3263132 loolwsd: use more efficient matchPrefix
Change-Id: I6f34b314295335270ff4da2827517d818c6a62ab
Reviewed-on: https://gerrit.libreoffice.org/31285
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 04:53:04 +00:00
Ashod Nakashian
86b38a29de loolwsd: fast in-place getTokenStringFromMessage
Change-Id: I5a7a7402c9394ac72aca907fc8b1072f6d2df5ad
Reviewed-on: https://gerrit.libreoffice.org/31284
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 04:50:57 +00:00
Ashod Nakashian
456c666cc9 .gitignore editor dot files
Change-Id: If48670b2fb0c5c9eb71dedccfc7e1b46706c109c
Reviewed-on: https://gerrit.libreoffice.org/31283
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 04:50:32 +00:00
Henry Castro
02095a3387 loleaflet: notify repair document when exists a conflict of multiple ..
.. users undo/redo
2016-11-27 23:39:58 -04:00
Henry Castro
ddd91b4251 kit: enable notify undo/redo commands 2016-11-27 23:39:37 -04:00
Henry Castro
2c2d460172 loleaflet: forgot remove console.log
only debugging purpose
2016-11-27 23:06:58 -04:00
Henry Castro
6947e914e1 loleaflet: re-work special character dialog to render all glyphs
.. on server side
2016-11-27 22:47:36 -04:00
Henry Castro
7234db9317 wsd: fix sending wrong UTF-8 string to the client
Client side console error "ws stopped cannot read
utf8 string", the cause it is sending special character '{',
'}',
2016-11-27 22:45:14 -04:00
Henry Castro
7760d6d6d5 wsd: fix URL encoded char parameter 2016-11-27 22:24:45 -04:00
Michael Meeks
85583f0a89 Avoid PNG compression for un-changed tiles. 2016-11-25 15:48:56 +00:00
Andras Timar
0f2e5ef3fe loolwsd: add common/FileUtil.hpp to tarball 2016-11-25 12:58:13 +01:00
Andras Timar
3e98b1d139 loolwsd: add common/SigUtil.hpp to tarball 2016-11-25 12:56:04 +01:00
Pranav Kant
d0929fb2f6 loleaflet: Popup keyboard on mobile devices
Change-Id: I4f0d1928633f5f0be4148fffd2c68c7aad1a0508
2016-11-25 16:57:06 +05:30
Andras Timar
3402546fae adapt maketarballfordeb.sh script to new dir layout 2016-11-25 12:21:30 +01:00
Michael Meeks
bbe0723e78 Tweak code to use new paths. 2016-11-25 09:59:03 +00:00
Michael Meeks
c1a398977f Adapt makefiles, includes etc. to new locations. 2016-11-25 09:58:57 +00:00
Michael Meeks
cca657c8f2 Apply the pre-branch rename script to re-organize the source. 2016-11-25 09:58:48 +00:00
Michael Meeks
4432aba25b Revert "loolwsd: support reading long messages directly"
This reverts commit 84607b43a3.

LOOLWebSocket piece requires a much too recent Poco.
2016-11-25 09:48:59 +00:00
Michael Meeks
a2058341a3 Revert "loolwsd: kill receiveFrame with char* and cleanup usage cases"
This reverts commit 45c1856c6a.

This patch requires a very bleeding edge Poco, reverting for now.
2016-11-25 09:46:01 +00:00
Pranav Kant
47699cd908 tdf#98484: Handle spaces in chrome when IME is enabled
When IME is enabled and user presses the space button, firefox
sends 'compositionend' event with data = ' '. However, chrome
instead fires 'textInput'
event. Lets listen for 'textInput' event too and treat it like
'compositionend' event when data = ' '.

Change-Id: Icbebdf2e89f608f790e6ce68c49f474364e7d5ab
2016-11-25 14:42:12 +05:30
Pranav Kant
e9dbfa3953 tdf#98484: IME support - handle full string in compositions
Parse the compositionend event's string, convert each into a char
code and pass them individually to server.

Change-Id: If79d538ccaebaa29749a5ca48a1f6ed5e0689ed5
2016-11-25 10:08:27 +05:30
Ashod Nakashian
45c1856c6a loolwsd: kill receiveFrame with char* and cleanup usage cases
Change-Id: I64585f8992407e0a3ff26fba1dccd327de13b7ff
Reviewed-on: https://gerrit.libreoffice.org/31185
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-25 03:50:09 +00:00
Ashod Nakashian
84607b43a3 loolwsd: support reading long messages directly
Since Poco receiveFrame expected the buffer to be
at least as large as the frame, otherwise the socket
had to be closed, we sent a 'nextmessage' frame
before sending large frames with the payload size.

This caused many problems, not least related to threading
and lack of atomicity when sending large frames.

There is another API in Poco that doesn't have this
strict requirement, one that expects Poco::Buffer
and resizes it as necessary.

One potential issue is the possibility that a malicious
attacker might send very large frames to force the
server into allocating large buffers to read them,
thereby destibilizing the server, if not bringing it
down altogether.

Change-Id: I05014d54c3a1464f629ed82d761a7a65e4941985
Reviewed-on: https://gerrit.libreoffice.org/31184
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-25 03:48:32 +00:00
Ashod Nakashian
96a1a796c4 loolwsd: AdminModel cleanup
Change-Id: I2f73b0063b905b641e14110af6421191bc9b2533
Reviewed-on: https://gerrit.libreoffice.org/31183
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-25 03:47:32 +00:00
Ashod Nakashian
c8c8407e00 loolwsd: move ver field in tile to the end
tile and tilecombine have grown organically
and gained optional fields when originally
all fields were required.

Since internally we deduplicate them, we need
to compare the required fields and not the
optional ones. By moving all optional ones
after the landmark ver, we make comparison
easier and, hopefully, less error prone.

Change-Id: I309185d3e19a45c7d59bc872e8a76acd3c511c14
Reviewed-on: https://gerrit.libreoffice.org/31182
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-25 03:46:10 +00:00
Ashod Nakashian
f7ee76cbde loolwsd: simplify duplicate message detection
Change-Id: I54b9d7905a429c35c60062b51203db56d639b6b5
Reviewed-on: https://gerrit.libreoffice.org/31119
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-25 03:40:23 +00:00
Henry Castro
63e002d695 loleaflet: fix default image path 2016-11-24 23:24:31 -04:00
Henry Castro
8317cd46f1 loleaflet: scrollable special character dialog 2016-11-24 14:00:41 -04:00
Henry Castro
0ba3c23c87 loleaflet: do not allow empty option element 2016-11-24 10:19:54 -04:00
Andras Timar
c8fa6cb5b0 loleaflet: disable zoom for spreadsheet even on touchscreens 2016-11-24 15:12:14 +01:00
Pranav Kant
b8a21852b7 loleaflet: Display menu items always in a straight line
... even if the screen size is smaller than the menu size.

Change-Id: I93c579b7503ec98fadd62718ca8062ed7a564042
2016-11-24 16:51:24 +05:30
Pranav Kant
33393a4254 loolwsd: Handle zero jitter
While some value of jitter is default in debug builds, one should
easily be able to disable this latency stuff using env. variables
LOOL_WS_DELAY=0 LOOL_WS_JITTER=0

Change-Id: I345df8f48adc69b5f237f18c981172441d21c757
2016-11-24 15:09:23 +05:30
Ashod Nakashian
430e0cf021 loolwsd: alert users of low disk space after loading
Change-Id: I01426aafb353ac8e291969936afc4d276898f0f0
Reviewed-on: https://gerrit.libreoffice.org/31121
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-23 14:44:52 +00:00
Ashod Nakashian
c26e180c08 loolwsd: correct locking of DocBrokers
Change-Id: I52f10e06cf91db451eb34d6540d17db2e0d14385
Reviewed-on: https://gerrit.libreoffice.org/31120
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-23 14:44:38 +00:00