Commit graph

3825 commits

Author SHA1 Message Date
Henry Castro
0ccbf8b235 loolwsd: bccu#2022, User warning on hitting limit 2016-09-27 17:28:30 -04:00
Henry Castro
c3568a6a41 loleaflet: refactor L.Control.Attribution.js 2016-09-27 17:28:30 -04:00
László Németh
459b5e585c loleaflet: show latency and other data in tile debugging mode
- show best, average, worst, last times of
  - server ping round trip
  - times between key press and invalidation message
  - tile based and total tile update latencies

- show data of the last five invalidation:
  - tilecombine messages, if they exist
  - otherwise the invalidation message
  - border of the last five invalidation rectangles

- visual fixes:
  - more transparent red color for better text typing
  - small letters over tiles with transparent background
  - black attribution text instead of gray + bottomleft position
2016-09-27 20:49:13 +02:00
László Németh
9c9c98b89f loolwsd: add ping support to the protocol
The client message 'ping' requests a 'pong' server message.
2016-09-27 20:49:13 +02:00
Jan Holesovsky
feb359e3a9 CPPUNIT_ASSERT_EQUAL.
Change-Id: Ifb0fe46101e243b5f562fb6a63ea350b42f445c0
2016-09-27 19:27:15 +02:00
Jan Holesovsky
26bec64e20 Make the advice about gdb actually useful.
Change-Id: I5b95c79cce5c3b30b3d07210ec7b7a04fdb3067d
2016-09-27 18:18:23 +02:00
Jan Holesovsky
bfbc56f045 JWT token generation does not work without SSL, disable the appropriate tests.
Change-Id: Id25a6507ea11a1e3cfacc8b833d4fd404eaeae27
2016-09-27 18:08:34 +02:00
Jan Holesovsky
dd9aeb8637 Use cppunit macros.
Change-Id: Ie56113a95dfc07b39f64a7ed0ce50efb1fa7081b
2016-09-27 17:38:17 +02:00
Jan Holesovsky
da061317ff Trivial tilecombine unit test for TileQueue.
Fails with any of 137e677eb0 or
fb0e041232 reverted.

Change-Id: Ib025e5d943eef1306e89167260ad352b0ecaf65b
2016-09-27 17:11:06 +02:00
Miklos Vajna
27f541549c Util: add missing include 2016-09-27 17:07:52 +02:00
Ashod Nakashian
56924299c9 loolwsd: restore Poco regex and old initialization
Unfortunately, std::regex is not well supported by old
compilers, namely gcc 4.8 doesn't seem to pass tests.

In addition, newer gcc versions, such as 5.2, don't like
{0,0} initialization.

For now we agreed on restoring the original Poco regex
and the old initialization of {}. When we move to
newer gcc, we can revert this commit so we get std::regex.

This commit reverts the following 3 commits:

Revert "Util: fix -Werror=shadow"
This reverts commit 01c6cb40ef.

Revert "loolwsd: replace Poco regex with std"
This reverts commit 1fdb4bf862.

Revert "Fix gcc-4.8 build"
This reverts commit 92ff278997.

Change-Id: I04912055d1143a2aeebb8d853c4d0c7fe74a40cc
Reviewed-on: https://gerrit.libreoffice.org/29324
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-27 15:00:33 +00:00
Tor Lillqvist
891b942e7c Handle disk full situations more gracefully
Introduce new API in our Util namespace to save data to a file
safely. The data is written to a temporary file in the same directory
and after that has succeeded, it is renamed atomicaly to the intended
name. If any step of the saving fails, neither the temporay file or
the intended target (if one exists before) is left behind.

Also add an API intended to alert the sysadmin in cases where their
attention and action are required. This is not yet properly
implemented. See FIXME comment for discussion.
2016-09-27 15:53:48 +03:00
Tor Lillqvist
8c404e700e Add FIXME about systemd logging mechanism considerations
If we can find out that we are running under systemd, we probably
shouldn't bother with any timestamps in our logging. Systemd does
that, doesn't it?
2016-09-27 15:53:48 +03:00
Jan Holesovsky
0409243683 Log either to file or the console, not to both.
Change-Id: Iac1e74d0624c2bbac4ffaf99b11488f02e626a2a
2016-09-27 14:36:39 +02:00
Jan Holesovsky
0cb07b22e3 Set less verbose logging for non-debug builds.
For debugging builds, use a logfile instead of the console.

Change-Id: I0d5654a568115c054c7439fe1358f5613dc432bf
2016-09-27 14:34:41 +02:00
Jan Holesovsky
0467f84a6f Actually move the check for tty where we check for various envvars etc.
Change-Id: Ib05208770f9e1865fd322302b861108f351607da
2016-09-27 14:34:41 +02:00
Tor Lillqvist
db1733e70d We don't need to check LOOL_NO_LOGCOLOR any more
Since 429cc9d49b, we use colour only
when stderr is going to a terminal.
2016-09-27 12:38:43 +03:00
Jan Holesovsky
429cc9d49b Only use color output if we are not redirected to a file.
Change-Id: I494a6bcfa4505d28e0f028c3e8de955c18bb58dd
2016-09-27 11:30:52 +02:00
Tor Lillqvist
f437ffa47e Bin pointless non-informative copy-pasta
(A cppunit-based test program already itself outputs what tests in it
failed, if any.)
2016-09-27 12:07:18 +03:00
Tor Lillqvist
7922948142 Get rid of some fragile string literal length counts
Basically, instead of foo.compare(0, 3, "bar") use
LOOLProtocol::getFirstToken(foo)!="bar". Using a separate length of a
string literal is very fragile, it is easy to get the length wrong, or
forget to change it in case the string changes. See
137e677eb0.

It isn't entirely sure to me whether was is kept in a message queue
follows LOOL protocol message syntax, but it seems to be so in
practice, so we can use LOOLProtocol::getFirstToken().

Also, calls like msg.compare(0, 4, "tile") add undocumented implicit
requirements that the token in question must be unique as an initial
substring of the first tokens of all messages. It actually isn't,
there is also "tilecombine". But in this case, that was taken care of
by checking for "tilecombine" first. Ugh. Whether that was by accident
or design is hard to say, but at least there was no comment indicating
intentionality.

We still have lots of similar fragile mis-use of std::string::find().
2016-09-27 11:41:27 +03:00
Miklos Vajna
01c6cb40ef Util: fix -Werror=shadow
gcc-4.8 still doesn't allow using the same name for a member function
and a local variable.

Change-Id: I9c327331b5c3460ec0e6d986a0543b17ba92c7ac
2016-09-27 09:48:06 +02:00
Miklos Vajna
fed97b97a7 LOOLKit: remove unused unsing declarations
Change-Id: I6a0efca4dd87694aaa3d32500a56c3a5d246b028
2016-09-27 09:46:24 +02:00
Tor Lillqvist
fa697d843e Remove reference to non-public bugzilla 2016-09-27 09:29:18 +03:00
Ashod Nakashian
d03f460f5f loolwsd: remove debugging logs
Change-Id: I031d8b265f503a26a345901ddec26c801da0d8c8
Reviewed-on: https://gerrit.libreoffice.org/29310
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-27 02:33:12 +00:00
Ashod Nakashian
1fdb4bf862 loolwsd: replace Poco regex with std
Change-Id: Id761d964708bf34b58146b8a3d5ff19df7452b67
Reviewed-on: https://gerrit.libreoffice.org/29309
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-27 02:32:36 +00:00
Pranav Kant
bd40df2c97 loleaflet: Update view cursors when zoom changes
Change-Id: I58c8e71379b11c334c7a3cdd2d0b767d5b9d023c
2016-09-27 07:59:00 +05:30
Tor Lillqvist
6081160bd4 Add LOOLProtocol::getToken*FromMessage()
Tokenizes a string and looks for the requested named parameter (in the
form name=value, like the other getToken* functions).

Also add a unit test for the getToken* functions.
2016-09-26 19:32:15 +03:00
Tor Lillqvist
e0c5f26015 bccu#2035: Work around crash by just exiting before it happens 2016-09-26 17:31:49 +03:00
Jan Holesovsky
fb0e041232 De-duplicate the tiles resulting from the tilecombine split.
Change-Id: I836915c06685f94b01a4d3af66092b9f45e82217
2016-09-26 10:55:14 +02:00
Jan Holesovsky
137e677eb0 Fix a typo that prevented tilecombines from being split.
Change-Id: Iceecfcff3b547485a94a0b9ac356d634505ccbb4
2016-09-26 10:55:14 +02:00
Andras Timar
89ee9fd94b loolwsd: poco 1.7.5 as dependency of binary packages 2016-09-26 10:18:34 +02:00
Jan Holesovsky
5320b94c60 Avoid starving when we are getting way too many priority tiles.
Change-Id: If06d6c2b99ca38894e74154aaffdc25a1c54d2b6
2016-09-26 10:14:09 +02:00
Miklos Vajna
92ff278997 Fix gcc-4.8 build 2016-09-26 10:09:44 +02:00
Tor Lillqvist
a4290ec4da Add FIXME comment 2016-09-26 10:19:46 +03:00
Miklos Vajna
3629113e59 httpwstest: add tolerance, so that testCursorPosition actually passes
I got:

httpwstest.cpp:2198:Assertion
Test name: HTTPWSTest::testCursorPosition
equality assertion failed
- Expected: 1418
- Actual  : 1425

If we want exact equality, then the underlying difference has to be
fixed first.

Change-Id: I82600fc738ca0923d81d1b59521e1a46167bb781
2016-09-26 09:13:02 +02:00
Miklos Vajna
025c212ab8 LOOLStress: fix -Werror,-Wunused-const-variable
Change-Id: I93e70ea9703f8fded99ea186d606773fc1693c96
2016-09-26 08:54:40 +02:00
Miklos Vajna
8ded538d40 Admin: fix uninitialized members
Change-Id: I8b88af167bf26e485e6d9600f88f015c65c1359b
2016-09-26 08:49:19 +02:00
Ashod Nakashian
5905c3b3f2 loolwsd: combine single rows only
Combining as much as possible is too aggressive and
seems to harm performance where large areas are
invalidated during editing (f.e. inserting text
at the begining of a paragraph).

With this patch we only combine a single row at a
time. This is reasonable since rows almost always are
invalidated when a line is edited. Larger blocks
are typically less important.

This is experimental and might get reverted if proves
to harm more than help.

Change-Id: I6e4420e07a031805c1e2729b3f32de580ae4806e
Reviewed-on: https://gerrit.libreoffice.org/29289
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-26 02:51:05 +00:00
Ashod Nakashian
5daf4ab341 loolwsd: don't process callbacks or queue messages if terminating
Change-Id: I1ff75d01a0f24ba3b9d7ca2003f1633d0aa494e0
Reviewed-on: https://gerrit.libreoffice.org/29288
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-26 02:50:51 +00:00
Ashod Nakashian
e9a7f8c6c6 loolwsd: split tilecombined in the TileQueue
Delaying the splitting maximizes the chances
that we will deduplicate and combine them
in the queue optimally.

Change-Id: Ib721fe7596de7ad5d34159949fe75f16e861eb24
Reviewed-on: https://gerrit.libreoffice.org/29287
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-26 02:50:17 +00:00
Ashod Nakashian
d9c90e30fd loolwsd: move the editing view to the front
Swapping the views makes the current front
go to some random location, which isn't fair.

Change-Id: I147aceb6bc5e5eb751a86d557d72ecdedb34af23
Reviewed-on: https://gerrit.libreoffice.org/29286
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-26 02:49:48 +00:00
Ashod Nakashian
552a8a6f9b loolwsd: removed BasicTileQueue which served no purpose
Change-Id: If0a768dcc71e6a9957f52abe1f44b242ab3c836f
Reviewed-on: https://gerrit.libreoffice.org/29285
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-26 02:49:36 +00:00
Jan Holesovsky
4e7ba53a2b Prioritize the views where the cursor moved the most recently.
Even the order of the views matters when the editing is happening.

Change-Id: Id0868a8198f9fa955512fccba57fa063eab46e8c
Reviewed-on: https://gerrit.libreoffice.org/29284
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-26 02:48:49 +00:00
Jan Holesovsky
c97ebfc585 Prioritize the tile requests when extracting from the TileQueue.
When putting tiles into the queue, do only the de-duplication,
reprioritization is better at the get() time - no need to keep shuffling
the priorities according to the cursor moves etc. all the time.

The tile combination then does the rest of the work for us :-)

Change-Id: I100c433dd3b24228d1ca8e4c89891635db1115c1
Reviewed-on: https://gerrit.libreoffice.org/29283
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-26 02:46:59 +00:00
Jan Holesovsky
61b0ad4933 Fix a race between the tile rendering and invalidation callbacks.
Instead of 2 queues and 2 threads, merge those to one - which gives a perfect
ordering of the invalidations and rendering.

Change-Id: I229dfc08b43e6ce7e4f08ea8059d3298d9bf8f8a
Reviewed-on: https://gerrit.libreoffice.org/29282
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-26 02:44:19 +00:00
Ashod Nakashian
f6a9de1b2d Revert "loolwsd: TileCache is told to save or not before...
This reverts commit 01718c5c68.

Change-Id: I6fa49f8d1f5c6ba7bdcd8cfa0866e0e15380607d
Reviewed-on: https://gerrit.libreoffice.org/29281
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-26 02:38:29 +00:00
Ashod Nakashian
9d883bfc71 Revert "bccu#2018 - Missing tiles when finished typing"
This reverts commit 342125b8ea.

Change-Id: I2f509f5044b7a432c978138e31edef679f2aca78
Reviewed-on: https://gerrit.libreoffice.org/29280
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-26 02:36:33 +00:00
Ashod Nakashian
720f1260a7 loolstress: more accurate stats and other improvements
Change-Id: Ib4960fa2770ba783eb969c5a356f0bfa01b96dc9
Reviewed-on: https://gerrit.libreoffice.org/29279
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-26 02:35:48 +00:00
Pranav Kant
5891371dca loleaflet: Show usercolor in userlist
Change-Id: I6be05f36ffc4c00aa986b3873fce1bc5acc6fbf0
2016-09-25 23:36:51 +05:30
Andras Timar
50bf2ce246 Fix a few lintian errors and warnings 2016-09-25 19:24:07 +02:00