Commit graph

22 commits

Author SHA1 Message Date
Jan Holesovsky
0674e87831 Implement a thread-safe websocket inherited from Poco::Net::WebSocket.
sendFrame() implemented in LOOLWebSocket is thread safe, and also deals with
large messages - sends the "nextmessage: size=..." frame before the actual
large frame.

The problem this is attempting to solve was that when sending a large frame,
it was split to multiple packets.  During that, another frame was sent from a
different thread; which lead to confusion, and the resulting frame was
corrupted (because it ended up composed from unrelated packets).

Change-Id: Ie85952e431b1cad2fdc6e3c64df8a444ea0ae971
2016-11-10 10:44:48 +01:00
Ashod Nakashian
773c15f710 loolwsd: consistent formatting
With the help of clang-format.
For reference, the following command was used,
but not all changes were commited:

clang-format-3.9 -style='{BasedOnStyle: WebKit,
 AlignAfterOpenBracket: Align,
 AlwaysBreakAfterReturnType: None,
 BreakBeforeBraces: Allman,
 DerivePointerAlignment: 'true',
 ExperimentalAutoDetectBinPacking: 'true',
 IndentWrappedFunctionNames: 'true',
 UseTab: Never}'

Change-Id: I0f7490c7ee38aeefeefcf9d5d4c3dab380cd63b8
Reviewed-on: https://gerrit.libreoffice.org/30416
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-31 06:06:35 +00:00
Michael Meeks
b6291f9cb5 Unit tests new-style now search for a free port pair. 2016-10-22 16:43:42 +01:00
Michael Meeks
0b93441eff Improving the built-in unit tests.
Connect sockets to the local process using the details we can introspect.
Implement unit test for storage / load failure.
Cleanup tile-cache test a little.
2016-10-22 16:43:41 +01:00
Michael Meeks
dcd68c1850 tests: re-direct output to the console for unit tests, to make logs useful. 2016-10-22 13:09:28 +01:00
Pranav Kant
edfd3266f8 loolwsd: Reuse storage object; kill superfluous WOPI calls
This reduces the number of fileinfo calls made to storage. These calls can
be expensive in storage such as WOPI where loolwsd needs to
interact with another server to get the file information. Use the
same storage object once created so that fileinfo can be
cached and returned quickly for subsequent such calls.

3 GetFileInfo WOPI calls are now merged into 1.

Change-Id: I56c3d23d3d6d7dc3a4b42433f51304dac28a12e8
2016-10-14 17:18:58 +05:30
Miklos Vajna
e4bbc15132 Avoid inclusion of deprecated C++ headers
Change-Id: I29abf3feeb8419f4e15ccb8dc7c34c086696ce07
2016-08-30 09:06:47 +02:00
Miklos Vajna
f209773f0a loolwsd: fix naming style of static members
README suggests not using an initial underscore for those. Rename the
few cases which don't respect this recommendation.

Change-Id: If36a36da9374597f6b9090e7f81a1b3fb2f23647
2016-06-07 09:18:49 +02:00
Ashod Nakashian
958f6ffcbd loolwsd: fix UnitPrefork deadlock/corruption
Reading from the socket in the test is not
thread-safe, and was causing all sorts of
problems.

The new code adds a test API and reads the
incoming data through it and not directly
from the socket. In addition, the read is
synchronized.

Change-Id: Id13821a40a59e32fd8a14f733a47306aee42ada8
Reviewed-on: https://gerrit.libreoffice.org/25244
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-21 03:43:15 +00:00
Michael Meeks
6b88e97b63 Add unit test hook for libreofficekit. 2016-05-02 05:40:24 +01: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
Pranav Kant
3e93a212f0 loolwsd: Admin console unit tests
Change-Id: Id0baa51c2adb14b77080b5acd2abf0658ee54b2b
2016-04-19 14:40:03 +05:30
Ashod Nakashian
a70c5300b1 loolwsd: childConnected event added to UnitWSD
Change-Id: I3d19465229b434d07f50290f08462e9c9c66a6ca
Reviewed-on: https://gerrit.libreoffice.org/24160
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-17 15:26:09 +00:00
Ashod Nakashian
ea83ed2374 loolwsd: configuration manipulation UT hook added
Change-Id: If5ab75ee3630e629179dfc8d3c3374795bd2a221
Reviewed-on: https://gerrit.libreoffice.org/24156
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-17 15:20:14 +00:00
Michael Meeks
25a092d7de Add memory accounting metric to UnitPrefork.
Also add hooks to allow custom LOK <-> WSD message for this test.
2016-04-12 21:58:27 +01:00
Michael Meeks
5b8f49423d More kit unit testing tentacles. 2016-04-09 18:29:20 +01:00
Michael Meeks
b308792801 Add infrastructure to inject test pieces into loolforkit. 2016-04-09 18:17:12 +01:00
Michael Meeks
3e618a97e3 Tests: add timeout, and test for timeout. 2016-04-08 17:36:08 +01:00
Tor Lillqvist
f6d9b2c099 Consistency is a virtue
(But sure, tons of much more annoying inconsistencies in style
remain.)
2016-04-08 11:09:46 +03:00
Michael Meeks
7d62c74b83 Fix segv on failure to create a storage, and add unit test infra. 2016-04-07 22:21:14 +01:00
Michael Meeks
a454a3c407 Improve test API, and handle failure better. 2016-04-07 19:39:11 +01:00
Michael Meeks
ad13dca8f8 First cut at adding integration and unit test hooks into loolwsd.
Add new configure parameter --with-lo-path= which can be used to
auto-populate a system template as required.
2016-04-07 19:38:33 +01:00