Commit graph

1668 commits

Author SHA1 Message Date
Pranav Kant
0559b58144 loolwsd: Use SocketProcessor from IoUtil in Admin
Change-Id: Ic89f04ee61f58ae13da9205e84d36ec06ed1d7ee
2016-05-03 12:59:02 +05:30
Tor Lillqvist
82f6a9a2ba Edit typo in comment to make it actually make sense 2016-05-03 09:56:33 +03:00
Tor Lillqvist
bfcf9756f5 Don't assert on PING frames that we send
UnitPrefork got what I assume is one of those PING frames that
ChildProcess::isAlive() sends before the actual reply when it sent the
"unit-memdump" message, and did not like it. Uncommenting the line
that outputs the "memory stats" message it expects showed:

Got memory stats 'PING'

Followed by:

Assertion `tokens.count() == 2' failed.

Fix by factoring out the handling of PING frames, PONG frames, and the
pseudo-PONG frames that we send ourselves in reply to PING frames into
a new function IoUtil::receiveFrame(). Use that in a couple of
places. (Probably should use in many more places.)

Getting past this then leads to later cppunit tests again being run,
and their failures then again showing up...
2016-05-03 09:50:38 +03:00
Tor Lillqvist
79968ccefb Clarify binary vs text frame non-distinction
Note that we currently have unit tests that incorrectly (IMHO) require
some frames sent by the server to indeed be 'text' ones from the
WebSocket perspective. That is an unnecessary restriction.
2016-05-03 08:23:06 +03:00
Tor Lillqvist
15e216ff7c Clarify that single-line don't need a newline terminator 2016-05-03 08:15:06 +03:00
Ashod Nakashian
431bab2824 loolwsd: fix autosave regression
Autosave should only save when the user has been idle
for a certain time, or the periodic autosave time elapses.

The document is considered for autosave only when it's modified.

Change-Id: Ia239173ff6636e52c1a2b7e1f6bf9bd6860175ed
Reviewed-on: https://gerrit.libreoffice.org/24602
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-03 03:05:44 +00:00
Ashod Nakashian
68f24e375a loolwsd: replenish the child reservoir and cleanup dead ones
Change-Id: I705ba01ca6254ff61ddd8ebc1248117b9fec7d20
Reviewed-on: https://gerrit.libreoffice.org/24601
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-03 03:05:29 +00:00
Ashod Nakashian
7d03ebdf85 loolwsd: corrections to terminate SocketProcessor
Change-Id: I3b08d1b2f734b8736ed35f667c1ca988490c4fa4
Reviewed-on: https://gerrit.libreoffice.org/24600
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-03 00:01:13 +00:00
Ashod Nakashian
6c57e9be4d loolwsd: helper to assert a lock is already taken
Change-Id: Id28f7a39a4d45ea6ad391015364467dc8ded3e66
Reviewed-on: https://gerrit.libreoffice.org/24599
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-03 00:00:13 +00:00
Ashod Nakashian
cf717152a7 loolwsd: bin_PROGRAMS -> noinst_PROGRAMS
Change-Id: Idfcfc9d21edafd094aa7c50b300b298e1ddfe6f5
Reviewed-on: https://gerrit.libreoffice.org/24598
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-02 23:54:50 +00:00
Jan Holesovsky
511b6c1039 Reduce #ifdef ENABLE_SSL's. 2016-05-02 18:41:57 +02:00
Jan Holesovsky
e2be97f14a Centralize the server URI. 2016-05-02 18:25:58 +02:00
Jan Holesovsky
c3cb14d258 Centralize the server URI. 2016-05-02 18:19:08 +02:00
Jan Holesovsky
a27a22b563 Add purpose comments. 2016-05-02 18:03:09 +02:00
Jan Holesovsky
b3dd2f31f9 Update the gdb command to match reality. 2016-05-02 15:03:16 +02:00
Jan Holesovsky
9df5ccc517 Make this unit test running without SSL too. 2016-05-02 15:03:16 +02:00
Andras Timar
faf7f5a167 redirect stderr to /dev/null (some search directories do not exist on all systems) 2016-05-02 13:17:13 +02:00
Jan Holesovsky
20ab6e8ae7 Revert "loolwsd: establish communication with child from DocumentBroker"
Unfortunately this causes a deadlock in the unit tests.

This reverts commit 10417c9447.
2016-05-02 11:49:58 +02:00
Michael Meeks
6b88e97b63 Add unit test hook for libreofficekit. 2016-05-02 05:40:24 +01:00
Ashod Nakashian
10417c9447 loolwsd: establish communication with child from DocumentBroker
The WebSocket that each child created with WSD is not used
except to request the child to load the document a client
requests. Beyond this point, it was not utilized for anything.

In fact, there are no handlers in WSD for messages coming
from the child; it is a one-way communication.

That is until now. With the move to unify communication
between WSD and each child, DocumentBroker can now
receive and handle messages from its ChildProcess.

Change-Id: Ie7f030a92db8303cd7087fff2325f136a49bc7fc
Reviewed-on: https://gerrit.libreoffice.org/24581
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-02 02:55:53 +00:00
Ashod Nakashian
c913e8e135 loolwsd: assert when we should be called with lock acquired
Change-Id: If784dbbfe6ca687fff181f623e413e9b86d51807
Reviewed-on: https://gerrit.libreoffice.org/24580
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-02 02:53:22 +00:00
Ashod Nakashian
1117be07c4 loolwsd: expose sending binary frame on Sessions
Change-Id: I5e81ced0511e44dc5f3445dae42f4354da164b3a
Reviewed-on: https://gerrit.libreoffice.org/24579
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-02 02:53:04 +00:00
Ashod Nakashian
c757253939 loolwsd: getAbbreviatedMessage from std::vector<char>
Change-Id: Ib901fb786839d48604a99a0eab0c7dd048e2004d
Reviewed-on: https://gerrit.libreoffice.org/24578
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-02 02:52:46 +00:00
Ashod Nakashian
3dc72cab18 loolwsd: ChildProcess cleanup
Change-Id: I1ae4911d3f5d527af86f39ed2723bbceef12cffe
Reviewed-on: https://gerrit.libreoffice.org/24577
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-02 02:52:28 +00:00
Ashod Nakashian
713cf3c067 loolwsd: return static data via static members
Change-Id: I083cdc921062ef518c9b39bae219caba6c99ee60
Reviewed-on: https://gerrit.libreoffice.org/24576
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-02 02:52:11 +00:00
Ashod Nakashian
516bad1942 loolwsd: TileCache whitebox tests
New unittests to verify TileCache logic on the unit level.

Change-Id: Ia36181e850b349abb88ba5f04f1e5244771bacc6
Reviewed-on: https://gerrit.libreoffice.org/24574
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-01 17:18:35 +00:00
Ashod Nakashian
b916543eef loolwsd: tests can be built with running using 'make'
Indeed, tests are built when invoking make in loolwsd
directory, thereby helping catch build errors in test
before committing.

Change-Id: I34cffcb5d0aed6485e578cf20f64217bee337d23
Reviewed-on: https://gerrit.libreoffice.org/24573
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-01 17:17:46 +00:00
Ashod Nakashian
a800d366ba loolwsd: missing header
Change-Id: Ib03f6fa048b0b38c0cba4216c4ca9b60f663f3f4
Reviewed-on: https://gerrit.libreoffice.org/24572
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-01 17:17:18 +00:00
Ashod Nakashian
461fd40b49 loolwsd: more support for TileCache unittest
Change-Id: I7b09fdde8179c855bbb1545f3a2188be1c929d20
Reviewed-on: https://gerrit.libreoffice.org/24571
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-01 17:17:05 +00:00
Ashod Nakashian
d16f44d7a2 loolwsd: TileCache unittest, hooks, and events
Change-Id: Id9e0539d2f920f15b0d0cb8e5924e480ed6d1e87
Reviewed-on: https://gerrit.libreoffice.org/24570
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-01 17:16:31 +00:00
Ashod Nakashian
b0eed75f05 loolwsd: differntiating Poco and std exceptions in logs adds little value
Change-Id: I1c571ef46d58b1f007cba58506a3fbfd460fb0f0
Reviewed-on: https://gerrit.libreoffice.org/24569
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-01 16:38:50 +00:00
Ashod Nakashian
e311e26641 loolwsd: private better than public
Change-Id: Ie4e9abf160a0a9d9c7de8e31358468ce154a30cd
Reviewed-on: https://gerrit.libreoffice.org/24568
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-01 16:38:31 +00:00
Michael Meeks
012593e375 Unit test cleanups. 2016-04-30 18:15:50 +01:00
Ashod Nakashian
8e31a512b1 loolwsd: fix a race between loading and setting part
Change-Id: Ib9a5b3dfe82ff5915208c420b8dc8124d08c5533
Reviewed-on: https://gerrit.libreoffice.org/24529
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-30 14:38:35 +00:00
Ashod Nakashian
59b475570d loolwsd: no need to sleep before running tests
Since lokit process counting waits until WSD
is ready (i.e. until it has created lokit processes,)
there is no need to sleep explicitly anymore.
Provided, of course, we always call the lokit
process counter before running any tests, which we
currently do.

Change-Id: Idf7ad925688251f1c81ef8628530714d2dc92d9c
Reviewed-on: https://gerrit.libreoffice.org/24528
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-30 14:37:36 +00:00
Ashod Nakashian
fd99834147 loolwsd: always run the lokit process count tests
Change-Id: I47365609850c23843624f714d6600f07629461ae
Reviewed-on: https://gerrit.libreoffice.org/24527
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-30 14:37:06 +00:00
Ashod Nakashian
5871ef32a9 loolwsd: log the pid in the backtrace
Change-Id: Ic0565f266f1ad56d855a76fb42fac8066066fd45
Reviewed-on: https://gerrit.libreoffice.org/24526
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-30 14:36:48 +00:00
Ashod Nakashian
bdfda58386 loolwsd: don't autosave when document not loaded
Change-Id: I44e9c2ad234ee05348b47415add3933c81fce968
Reviewed-on: https://gerrit.libreoffice.org/24525
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-30 14:36:28 +00:00
Ashod Nakashian
fc9df5db91 loolwsd: don't log memory usage if not changed
Change-Id: I98c43abb87e2291a304e77d6eb09ea1800545b72
Reviewed-on: https://gerrit.libreoffice.org/24524
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-30 14:36:02 +00:00
Ashod Nakashian
67fb02d277 loolwsd: formatting, logging, and comments
Change-Id: I0292c39b18d013829d20ef23afcf970eefbe7d42
Reviewed-on: https://gerrit.libreoffice.org/24523
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-30 14:35:38 +00:00
Ashod Nakashian
ce64895cee bccu#1751 deadlock during save
While there are two separate callbacks registered
(one with lokit and the other with lokitDocument,)
there is no reason why they should be handled
separately (and indeed differently).

The lokit callback only sends notifications on
status indicator (during loading and saving)
and document password type (if protected).

Due to the different callback handlers
the status indicator was only sent to the
first client, not all (as one expects).

Furthermore, because the lokit callback
was processed on the Core thread, it
was bound to cause performance and
thread-safety issues. Specifically it
deadlocked when another callback was
in flight when a save issued status
indicator callback.

By unifying the callbacks and putting
all callback messages on the message
queue we avoid all of the above and
simplify the code.

Change-Id: I5bd790b6ce88b7939186c1ec1dead7fb6cabf7e0
Reviewed-on: https://gerrit.libreoffice.org/24522
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-30 14:34:32 +00:00
Ashod Nakashian
4be73e5934 loolwsd: minor improvement to testing socket flags
Change-Id: I87d4d6a22fccef97bf69fce249ec0374db417714
Reviewed-on: https://gerrit.libreoffice.org/24502
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-29 21:20:11 +00:00
Ashod Nakashian
a007a7c1d4 loolwsd: improved LoKit process counting
Change-Id: I514ece4ce7f401a8996bc115ab00ddb7a8bec90d
Reviewed-on: https://gerrit.libreoffice.org/24501
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-29 21:19:46 +00:00
Jan Holesovsky
2b9295e8d7 countLoolKitProcesses() is more reliable here. 2016-04-29 22:02:21 +02:00
Jan Holesovsky
ce691601dd Need a longer default timeout for the httpwstest.cpp. 2016-04-29 22:02:21 +02:00
Jan Holesovsky
d906bba7d1 Added a FIXME explanatory comment. 2016-04-29 15:16:59 +02:00
Jan Holesovsky
9f5ca3f0ff Help the autodoc. 2016-04-29 13:42:01 +02:00
Ashod Nakashian
66392f4121 loolwsd: gitignore looltest
Change-Id: Icc90db9e98309db5348bf608662b5f34a1980a7e
Reviewed-on: https://gerrit.libreoffice.org/24492
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-29 11:31:55 +00:00
Ashod Nakashian
0e4c624f0b loolwsd: minor improvement to test assertions
Change-Id: I40da725919ae775d039217c258ecd28a743b5bc1
Reviewed-on: https://gerrit.libreoffice.org/24484
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-29 03:40:13 +00:00
Ashod Nakashian
afa3e7c4ed loolwsd: log error on failure, not success
Change-Id: Iac417c3779f3879697d056b5e402e91902bfd168
Reviewed-on: https://gerrit.libreoffice.org/24483
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-29 03:39:49 +00:00