Commit graph

105 commits

Author SHA1 Message Date
Mihai Varga
e29d7c8468 loolwsd: save the whole status not only the fst line 2015-07-22 15:09:14 +03:00
Mihai Varga
b9884a470a loolwsd: be aware of the client's current part
And set lok's part to match the client's when they start editing or
selecting
2015-07-21 16:56:02 +03:00
Mihai Varga
c9fff5d8e3 loolwsd: updated tileCache::invalidateTiles 2015-07-21 14:53:53 +03:00
Mihai Varga
47790d9d5d loolwsd: use the new invalidate x y widht height command 2015-07-21 11:08:36 +03:00
Mihai Varga
19d6dec3f7 loolwsd: log timestamp in microseconds
Also, separate messages by comma so we can parse them easily
2015-07-20 12:54:08 +03:00
Henry Castro
404b5edbc9 loolwsd: FileTransferHandler no longer need it. 2015-07-17 16:55:49 -04:00
Henry Castro
99ca81a944 loolwsd: move server socket to parent process 2015-07-17 14:04:40 -04:00
Mihai Varga
5085fd4e0c loolwsd: move tiles to persistent folder on save 2015-07-16 12:51:07 +03:00
Mihai Varga
2ebe9f1be1 loolwsd: format and options in 'saveas' are optional 2015-07-16 12:51:07 +03:00
Mihai Varga
675cfb8c4a loolwsd: send part names with the status message
Also disabled the status length assertion because part names
are separated by new-line characters ('\n')
2015-07-15 18:49:32 +03:00
Mihai Varga
97191d985b loolwsd: allow an extra paramater to the tile command (ID) 2015-07-14 19:46:04 +03:00
Henry Castro
bb3611399b loolwsd: Use fork but no execve 2015-07-13 10:13:06 -04:00
Mihai Varga
6d2d8361b6 loolwsd: the third argument in postUnoCommand must be null not space 2015-07-08 09:09:58 +03:00
Jan Holesovsky
767d6a0a32 Create /dev/*random in the chroot so that ssl works.
Also add the missing library to the systemplate.
2015-07-06 19:35:50 +02:00
Henry Castro
e50e302839 loolwsd: Handle file URI schema
In the file:// case, if it is on linux, hard link function is used
and copy only if hard link fails.
2015-07-04 20:46:13 -04:00
Henry Castro
d788fa92e9 loolwsd: let libreoffice handle http protocol 2015-07-03 10:04:24 -04:00
Tor Lillqvist
f4da368a52 Add a FIXME, found by looking, no time to investigate 2015-07-02 16:26:09 +03:00
Jan Holesovsky
4071022305 The payload format has changed, swap the parameters accondingly. 2015-06-25 17:03:18 +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
Mihai Varga
e8007ea405 Server getTextSelection implementation 2015-06-24 18:08:15 +03:00
Tor Lillqvist
f7a769ef28 Avoid assertion when the --lotemplate parameter ends with a slash 2015-06-17 16:52:54 +03:00
Tor Lillqvist
6804750463 Don't bother with storing a ref to Application::instance() in a variable in some places 2015-06-09 18:30:21 +03:00
Tor Lillqvist
d3f4ddd355 Use a queue also in the child processes 2015-06-09 18:30:12 +03:00
Tor Lillqvist
629ba87139 Add a "canceltiles" message to the protocol and handle it
Implementing this Was harder than I first expected. The basic idea is as
follows: The master process puts each message arriving from a client that
isn't "canceltiles" into a (client-specific) queue. A separate thread that
pulls messages from the queue at its own pace and handles them as
before. Incoming "canceltiles" messages are handled specially, though: The
queue is emptied of "tile" messages.

The above sounds simple but there are several details that were a bit tricky
to get right.
2015-06-09 18:29:48 +03:00
Tor Lillqvist
a7f2e5aa29 The buffer parameter to handleInput() can be const 2015-06-08 17:56:10 +03:00
Tor Lillqvist
a608aaee90 Add an invalidate: message that is in LOOL style with named parameters
The invalidatetiles: message as generated directly from the
LOK_CALLBACK_INVALIDATE_TILES will be dropped soon.
2015-05-29 09:44:39 +03:00
Tor Lillqvist
1b85e8eaaa Be more consistent in using 'using' 2015-05-29 08:49:49 +03: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
f6a00edbee Use shared_ptr to the WebSockets for increased robustness
Why did I wait so long to do this? This is obviously the right thing to do, I
hope, and has a very significant impact on the robustness of the server...
2015-05-28 16:46:37 +03:00
Tor Lillqvist
d0dbc5e1dd Send a nextmessage: message also preceding a tile: message from the cache 2015-05-28 16:46:37 +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
13645eb769 There should be whitespace after the message keyword and colon 2015-05-28 12:59:11 +03:00
Tor Lillqvist
cedee8f1a9 Log the input to MasterProcessSession::handleInput() earlier 2015-05-28 12:58:08 +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
84819b6f0c Improve error handling 2015-05-27 21:44:39 +03:00
Miklos Vajna
d8d054fa47 LOOLSession: PAGE_COUNT -> DOCUMENT_SIZE 2015-05-27 17:34:10 +02:00
Miklos Vajna
6453f130c0 LOOLSession: handle LOK_CALLBACK_SET_PART 2015-05-27 11:36:21 +02:00
Jan Holesovsky
029a41ba81 Fix non-debug build. 2015-05-26 10:11:06 +02:00
Henry Castro
d33d1afcf3 Added missing rectangle to invalidate cursor. 2015-05-25 00:40:08 -04:00
Tor Lillqvist
0053f18e2d Handle LOK_CALLBACK_PAGE_COUNT_CHANGED 2015-05-23 11:26:11 +01:00
Tor Lillqvist
180f8fcba0 Pass the --uid option to the child too 2015-05-22 17:42:36 +01:00
Tor Lillqvist
9af39d189a Add some fairly hackish things to make this run better on OS X 2015-05-22 14:34:21 +01:00
Tor Lillqvist
0440a908fa For some reason linking the PkgInfo file fails in OS X
No idea. Does not even work from the command line...  But after
"fixing" this, we run into other weird problems anyway. (Maybe one
needs to use lower-level (Mach) APIs for esoteric stuff like chroot?)
So, getting loolwsd to work on OS X seems unexpectedly hard even
before considering what changes might be needed to LibreOfficeKit. Oh
well.
2015-05-22 12:43:00 +01:00
Mihai Varga
c62ee92519 Search not found callback handler 2015-05-20 16:54:40 +03:00
Tor Lillqvist
058416b9d7 Handle arbitrarily large tile: messages from child to parent
The parent currently uses a fixed-size 100000 byte buffer to receive
messages. Even with a tile size of 256x256 pixels, that is not enough for some
tiles that compress badly as PNG. Add a nextmessage: message that gives the
size of the immediately following message. Send a such before each tile:
message, and handle it appropriately. The nextmessage: message is used only
from child to parent process, it is never sent to the Websocket client.

Once Poco 1.6.1 is released, this will not be necessary.
2015-05-18 11:24:32 +03:00
Tor Lillqvist
b6c36e23f3 Improve error handling for documents that can't be opened
Catch IOException when trying to copy the document and send error message.
Otherwise, the exception will just propagate up to handleRequest() and the
connection will be silently closed. Closing the connection is fine as such, I
think, but we need to send an error message first.
2015-05-12 12:44:19 +03:00
Tor Lillqvist
3e9c4d4bf3 Use a separate HTTPServer listening for child processes connnecting
Otherwise, if we use the same port number and same HTTPServer, if enough
clients try to contact us and, we won't be able to accept child processes
having been spawned.

Also add some temporary debugging output here and there to debug lifecycle
management issues.
2015-05-08 21:30:32 +03:00
Tor Lillqvist
3a23186217 If we run out of pre-spawned children, spawn one more
Just a stopgap measure so far. Clearly will need some logic to get rid of too
many children if they are just hanging around with no clients incoming. Also,
we need some sanity check not to spawn an unlimited number of children.
2015-05-08 21:30:17 +03:00
Tor Lillqvist
e22e1da038 Must use thread-local storage for the variables used by the nftw callback
Otherwise two or more linkOrCopy() functions running simultaneously will lead
to a mess.

Actually nftw() is not guaranteed to be thread-safe, I think, so we should
really use something that is, like Poco's SimpleRecursiveDirectoryIterator.
2015-05-07 20:24:14 +03:00
Tor Lillqvist
c69fc09a1b Use just one RNG for the MasterProcessSession objects
It probably is not a good idea to keep depleting the entropy source needlessly
by having a separate RNG in the preSpawn(). Use just one shared RNG and
protect access to it with a mutex.
2015-05-07 20:24:06 +03:00