Commit graph

51 commits

Author SHA1 Message Date
Miklos Vajna
b066c91c8f loolwsd: factor out LOOLSession::parseDocOptions() from *ProcessSession 2015-11-19 10:30:45 +01:00
Miklos Vajna
e6f0abf763 loolwsd: support getting load options
This is a single json that contains both load and rendering options.
Currently only the rendering ones are added to it by the client.

Also, just accept the options string for now, a later commit will have
to actually pass the rendering part to
lok::Document::initializeForRendering().
2015-11-18 18:12:27 +01:00
Mihai Varga
242870cb9f use setClientZoom() before postMouse/Key event 2015-11-12 16:54:45 +02:00
Jan Holesovsky
6a1477d8a9 loolwsd: Specialize the MessageQueue a bit.
Introduce a bit of hierarchy there, at some stage we'll want to re-order the
tile requests a bit so that it works better for collaborative editing; for the
moment, removing the duplicate entries is enough.
2015-11-09 11:54:09 +01:00
Miklos Vajna
cc24463f08 loolwsd: wrap lok::Document::paste() 2015-10-27 11:53:32 +01:00
Mihai Varga
58d7c99f19 loolwsd: added getChildId and insertFile methods
getChildId is used to get the chroot's name and insertFile inserts a the
/user/thedocument/insertfile/file_name file in the document
2015-10-22 18:32:19 +03:00
Miklos Vajna
4feb29d1df LOOLSession: inform to-client session about completed save-as 2015-10-20 14:03:39 +02:00
Mihai Varga
676c6d60d1 tdf#94607 downloadAs command that generates an URL for the doc
When requested, the document is exported under
/jail_path/CHILD_ID/user/thedocument/RANDOMDIR/filename
and CHILD_ID, RANDOMDIR and the filename are communicated to the client.

When the client requests
http://server:port/CHILD_ID/RANDOMDIR/filename, the exported document
is served and then RANDOMDIR is removed
2015-10-09 16:11:38 +03:00
Miklos Vajna
80ec8a5b4f loolwsd: parse the partpagerectangles command and cache the values 2015-09-29 12:51:19 +02:00
Mihai Varga
d1ecdbc3df loolwsd: parse the commandvalues command and cache the values
The values are chaced in the file named
"cmdValues" + unoCmd + ".txt"
2015-09-09 20:23:49 +03:00
Henry Castro
b32b407714 loolwsd: add an optional parameter to load url= ...
load part=X url="http" is required to re-establish the connection
2015-08-27 00:18:44 -04: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
6812c6aa0b goToPage API
in loleaflet, this is achived by invalidating the cursor and centering
the viewing area around it
2015-08-03 19:07:02 +03:00
Mihai Varga
992f19e6e8 loolwsd: handle parts in Writer
In Writer a part is a page and we only notify the client about the
current page in which the cursor is. Internally (invalidation and
caching) we work with a single part (0)
2015-08-03 17:29:23 +03:00
Henry Castro
ec094f1601 loolwsd: remove _pendingPreSpawnedChildren.
_pendingPreSpawnedChildren is no longer need it, because
fork() is used.
Also adjusted time sleep to 1 second.
2015-07-24 15:17:46 -04: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
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
bb3611399b loolwsd: Use fork but no execve 2015-07-13 10:13:06 -04:00
Mihai Varga
e8007ea405 Server getTextSelection implementation 2015-06-24 18:08:15 +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
316bfe487d Correct documentation for _docURL 2015-06-05 13:05:51 +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
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
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
Tor Lillqvist
0ca7f3129b Add code to wait for a child session to become available
Not sure it is completely correct. Lots of testing needed.
2015-05-07 16:29:36 +03:00
Tor Lillqvist
b49d4d8885 Use shared_ptr and weak_ptr in attempt to make the pointer dance more robust
It was obviously very wrong to use both a unique_ptr to the
MasterProcessSession in WebSocketRequestHandler::handleRequest(), and then a
bare pointers to the peer object in the MasterProcessSession object. We got
crashes here and there related to the destructors.

Let's see if we can manage without mutexes.
2015-04-22 21:50:17 +03:00
Tor Lillqvist
59bd08299c _childId is used only in MasterProcessSession 2015-04-22 21:49:53 +03:00
Tor Lillqvist
08f53df08a _childIdToChildSession[childId] is not used 2015-04-22 21:49:37 +03:00
Tor Lillqvist
8534aebf8e Only the MasterProcessSession class uses a tile cache 2015-04-22 21:49:12 +03:00
Tor Lillqvist
fcea475bb5 Use separate classes derived from LOOLSession for parent and child processes
Work in progress. Does not work properly yet.
2015-04-22 21:48:04 +03:00
Tor Lillqvist
39b6258aa9 Clean up the jail after the prisoner has died 2015-04-22 21:46:33 +03:00
Tor Lillqvist
b760359bda Terminology change: s/fork/spawn
We aren't doing any fork-but-not-exec trick anyway, just a straightforward
start of a child process.
2015-04-22 21:45:31 +03:00
Tor Lillqvist
3abb6d0307 Now the chroot etc re-work is getting closer to working
Works now for the trivial 'connect' test program. Still need to add
pre-spawning of a new child process as soon as an existing one from the pool
has been taking into use. And need to test with the actual JS client.
2015-04-22 21:44:17 +03:00
Tor Lillqvist
652580a761 Another intermediate commit, code still in a non-working state 2015-04-22 21:43:44 +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
7f50f06bf4 Add some comments 2015-04-22 21:42:47 +03:00
Tor Lillqvist
f9d93ea57c Work in progress: "pre-forking", chroot, etc. Non-working state
Lots of changes to the server code, LOOLWSD and LOOLSession mainly. This is an
intermediate commit.
2015-04-22 21:42:17 +03:00
Tor Lillqvist
422dfd1767 Start on load testing
Add a new program, loadtest, that runs a requested number of client sessions
in parallel to a loolwsd server. A client session loads one of a list of test
documents, and does some operations on it.

Move the getTokenInteger() and getTokenString() functions out from LOOLSession
into a new namespace LOOLProtocol, as they are neeeded also in the loadtest
program.

Add, also in LOOLProtocol, functions to parse some of the messages from the
server. (In general that is done in client JavaScript code, of course; only
for testing purposes needed in C++ code.)
2015-03-26 17:04:08 +02:00
Tor Lillqvist
425cae6b29 No need for <unistd.h> as far as I see 2015-03-26 17:04:08 +02:00
Tor Lillqvist
eb695513de Use const reference parameter 2015-03-26 17:04:08 +02:00
Tor Lillqvist
97fbe8e857 Add 'saveas' 2015-03-23 22:14:11 +02:00
Tor Lillqvist
e05092ece2 Obviously need to handle input events etc in the child process
I need to re-factor this stuff, too much copypasta.
2015-03-20 15:52:43 +02:00
Tor Lillqvist
215fda0235 Add key and mouse event handling, uno command, and selection handling
Not "handled" here of course, just pass them on to LibreOfficeKit.
2015-03-20 13:18:01 +02:00
Tor Lillqvist
e8ea0f0d2e Use separate child processes for LibreOfficeKit
For now, each LOOL client has a separate child process (or none at all, if it
has accessed only information found in the cache). This will obviously have to
chnage to handle collaboration. Etc.

The parent process talks the same Websocket protocol with the child
processes. When there is a child process for a client, traffic from the client
is forwarded as such to the child process and vice versa.
2015-03-18 15:38:01 +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
Tor Lillqvist
7e363f6058 Add a few more fields for future 2015-03-09 17:45:51 +02:00