Commit graph

32 commits

Author SHA1 Message Date
Pranav Kant
6a7a014d14 loolwsd: Remove cached 'status' command output on 'setclientpart'
Otherwise we have a problem when cached information is different than
the actual one maintained by LOKitDocument, keeping the whole
server setup in an inconsistent state.

For example, when client reloads the browser session quickly
after setting the current part (to say 3) of an opened part document.
If the reload occurs soon enough before the 'setclientpart'
message originated from the client is acknowledged by the server,
then the next reload would get the cached 'status' entry asking
the client to set 'currentpart' to something else leading to the
generation of another 'setclientpart' message. This thing would
go on, and we would run into a loop, as I have for the last few
hours.

Change-Id: Ia6260dfb772f2e3f023572aa060fd7da92b196c8
Reviewed-on: https://gerrit.libreoffice.org/22272
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-02-11 05:04:22 +00:00
Miklos Vajna
de7823744e loolwsd: fix naming style of LOOLWSD static members 2016-01-15 09:44:07 +01:00
Ashod Nakashian
d26944b715 loolwsd: safely remove files and directories
Change-Id: Ie017a9da720a470a6b8ed340bd4ea5ffc279cf4b
Reviewed-on: https://gerrit.libreoffice.org/20949
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2015-12-26 03:59:20 +00:00
Ashod Nakashian
8fc1e3c65b loolwsd: better error handling and resilience
Change-Id: Ic0208ccb72cb35cb8f8b3c1f36b636dd3a467dc1
Reviewed-on: https://gerrit.libreoffice.org/20948
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2015-12-26 03:59:05 +00:00
Ashod Nakashian
ea0ddcf738 loolwsd: Nominal logger and fixes
Nominal logging interface and a fix to using Poco
Application from LOOLKit, which is not a Poco App,
which caused core dump.

Logs now include process name.
Added logs to strategic places and some cleanups.

Change-Id: Ib7dcc4f1033dddf7c87cd2e786a91f5b482fb312
Reviewed-on: https://gerrit.libreoffice.org/20906
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2015-12-23 17:23:10 +00:00
Ashod Nakashian
50e6272440 Fixes to get a consistently working state
Fixed a javascript error and a more serious referencing
of the memory of a temp string, which resulted in
random behavior.

When the memory was null, it failed to load any
documents in the browser. Otherwise, accidentally,
when it wasn't, it would load the document (rarely).
2015-12-10 21:32:16 +01:00
Mihai Varga
aa405d3836 loolwsd: cache rendered fonts 2015-11-30 11:16:53 +02:00
Mihai Varga
34401c94f6 loolwsd: switch to editing dir when invalidating the cursor 2015-09-30 17:17:03 +03:00
Mihai Varga
1cfd1352ce loolwsd: renamed getStatus/saveStatus to getTextFile/saveTextFile
And added a getStyles method that uses the above methods to cache
document styles
2015-08-19 11:48:49 +03:00
Mihai Varga
3e0a3d9ed6 loolwsd: use a mutex when moving/removing tiles form the cache 2015-08-12 16:07:44 +03:00
Jan Holesovsky
527821597f Make the timestamps work also for non-file:// URLs. 2015-08-04 20:39:33 +02:00
Mihai Varga
b0282a2a03 Revert "loolwsd: LRU expiry persistent cache"
This reverts commit 74dcec1d3f.
The cronjob replaces this
2015-08-03 21:51:55 +03:00
Henry Castro
74dcec1d3f loolwsd: LRU expiry persistent cache
When tile requests from the cache, update time stamp file
so LRU tiles are removed.
2015-07-25 20:12:07 -04:00
Mihai Varga
c9fff5d8e3 loolwsd: updated tileCache::invalidateTiles 2015-07-21 14:53:53 +03:00
Jan Holesovsky
fbcbc462d6 One more place where we need to adapt to the new payload format. 2015-06-25 17:35:33 +02:00
Jan Holesovsky
7c48ea1fe3 Change the tiles cache to 2-level cache.
Now we have 2 caching directories: 'persistent', and 'editing'.

The Persistent cache always represents the document as it is saved, the
Editing one caches the current edits.  The Editing state is copied to
Persistent on save.  The Editing state is destroyed on reload.
2015-06-24 22:07:58 +02:00
Tor Lillqvist
ea2141ffe7 Take the tile cache directory as an option, too 2015-06-04 17:09:19 +03:00
Tor Lillqvist
4303f1ee38 Improve tile cache handling for file: documents
Handle also documents specified with a file: URI. Move creating the
modtime.txt file to the constructor of the TileCache object for the document.
2015-05-29 12:26:54 +03:00
Tor Lillqvist
1b85e8eaaa Be more consistent in using 'using' 2015-05-29 08:49:49 +03:00
Tor Lillqvist
26161d6063 Handle the EMPTY case of LOK_CALLBACK_INVALIDATE_TILES, too 2015-05-29 08:39:21 +03:00
Henry Castro
ba70f2a050 Fixed invalidatetiles assertion. 2015-05-28 16:22:27 -04:00
Tor Lillqvist
bf985624f1 Handle LOK_CALLBACK_INVALIDATE_TILES in the server too
Remove any intersecting cached tiles. It is the parent process that handles
the tile cache, so it must look for invalidatetiles: messages, too, before
passing them on to the client. To know for which part we should remove tiles,
add an "ephemeral" curpart: message that the child process sends to the parent
process before the invalidatetils: message.
2015-05-28 18:48:51 +03:00
Tor Lillqvist
09b261d57b Handle LOK_CALLBACK_DOCUMENT_SIZE_CHANGED even better
Just call the getStatus() function directly in the child process, which will
always cause a complete status: message to be sent to the client. No
documentsizechanged: messages now sent to the client at all.
2015-05-28 16:46:37 +03:00
Tor Lillqvist
0092414470 Handle LOK_CALLBACK_DOCUMENT_SIZE_CHANGED callbacks more cleverly
When a child process sends a documentsizechanged: message to the parent, to be
forwarded to the client, parse it and update a cached status of the doucment,
if available, and send an updated status: message to the client instead.

Note that clients should not rely on getting only status: messages and never
documentsizechanged: messages, though; the cache might be cleaned at any time
even while the server is running. If there is no cached status of the document
to update and re-use, we have to forward the documentsizechanged: message as
such to the client.
2015-05-28 12:53:14 +03:00
Tor Lillqvist
cb65bbbc36 Include <string> for completeness
Sure, it seems to get included indirectly already, but we can't be sure that
holds for all compilers.
2015-05-06 17:58:00 +03:00
Tor Lillqvist
af1821bb3b Temporarily bypass modification time things for actual URLs
The code works only for pathnames currently. Need to fix soon.
2015-04-30 21:12:33 +03:00
Tor Lillqvist
1b06290d2b Add a part parameter to the tile messages
The JS code always passes in 0 for now. The server parses the parameter and
calls LibreOfficeKitDocument::setPart() before calling paintTile().

Probably also the status, key, mouse and selection messages will need a part
number. The intent is after all that the protocol is as stateless as
possible. (So maybe we should also pass the document URL in each message?)
2015-04-27 21:30:26 +03:00
Tor Lillqvist
0a60ea9dcc Bump Emacs fill-column to 100
The default 70 is so last century.
2015-04-22 21:43:11 +03:00
Tor Lillqvist
ff8ceac560 Caller expects empty string as failure, not nullptr
Fixes crash.
2015-03-16 21:08:14 +02:00
Tor Lillqvist
ea01aa2002 Cache also document status 2015-03-13 14:17:51 +02:00
Tor Lillqvist
ad3fda27af Further hacking on tile cache 2015-03-13 01:34:42 +02:00
Tor Lillqvist
08583f8ebe Add first cut at caching of tiles 2015-03-12 17:26:35 +02:00