Commit graph

73 commits

Author SHA1 Message Date
Henry Castro
c29944a386 loolwsd: fix close after close
The closing handshake.
Either peer can send a control frame with data containing
a specified control sequence to begin the closing handshake.

Upon receiving such a frame, the other peer sends a
Close frame in response, if it hasn't already sent one.
2016-04-18 20:27:27 -04:00
Tor Lillqvist
4087ac8089 With "disconnect" messages gone, no need for a 'reason' to disconnect()
YAGNI.
2016-04-13 15:56:23 +03:00
Ashod Nakashian
b6d2edb0e3 loolwsd: moved activity tracking into LOOLSession
Change-Id: I87d5afc43bea29ede2ad6e2871c594c4746bc3d5
Reviewed-on: https://gerrit.libreoffice.org/23948
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-10 03:32:58 +00:00
Tor Lillqvist
b6419ee915 Include only what you use 2016-04-04 09:31:52 +03:00
Tor Lillqvist
e55df2d021 The jailed processes are not "loolwsd" in any sense any more 2016-03-20 21:52:27 +02:00
Tor Lillqvist
e8a5ba1b29 _bShutdown is always false 2016-03-08 09:45:23 +02:00
Tor Lillqvist
e7e1ef58ae Cosmetics: Sort and prune #include and 'using' lines 2016-03-08 09:44:04 +02:00
Pranav Kant
b71ebb8dfc loolwsd: Ask for password for multiple views also
This is possible by moving all the password handling logic to
Document container class. When a user opens a password protected
document the first time, it saves all possible data such as
password, password type etc. Upon opening the same document
again, password is matched with the cached password saved in the
document container class before allowing the new view access to
this document.

Change-Id: Id1f2b6e06de806564bf865e83fed51b01c9a0fbc
Reviewed-on: https://gerrit.libreoffice.org/22208
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-02-19 22:00:46 +00:00
Pranav Kant
3667bef9a6 loolwsd: Handle password protected documents
Change-Id: Iceb5bb598ef1517bf640994c27bad4ca36bd72c1
Reviewed-on: https://gerrit.libreoffice.org/21894
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-02-19 21:49:45 +00:00
Miklos Vajna
4b3c5ea8ff loolwsd: doxygenize class comments 2016-01-28 19:16:32 +01:00
Ashod Nakashian
dd374d8aec loolwsd: disconnect command to gracefully shutdown a socket
Change-Id: I8beb4c14fc95bdb2a98c7e5da44408511bce5e28
Reviewed-on: https://gerrit.libreoffice.org/21683
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-21 16:05:55 +00:00
Tomaž Vajngerl
721cbbcbb3 Add "tilecombine" command to render more tiles in one call
When invalidating we need to rerender more tiles at once.
This change optimizes that with a new command which rerenders a
larger area once and then separates the rendered buffer into more
tiles. This generally decreases the invalidation time by 2-4 times
and in some cases (when invalidating images in document) up to 9
times.
2016-01-14 13:11:57 +01:00
Ashod Nakashian
06c20923c5 loolwsd: Kit is given the jailed path
Change-Id: I5b475798c7f654aaa3e0032332d5aa97a103a4c8
Reviewed-on: https://gerrit.libreoffice.org/21185
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-07 05:58:08 +00:00
Ashod Nakashian
900c344a7e loolwsd: refactored JailedDocumentRoot path
Change-Id: Ibee16e6ebde0ae1945be53903a0b0bad4f3300ed
Reviewed-on: https://gerrit.libreoffice.org/21179
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-07 05:53:39 +00:00
Henry Castro
7fc04b6e71 loolwsd: stop dispatch child when closed websocket prison 2015-12-28 17:05:01 -04:00
Ashod Nakashian
3811abb40a loolwsd: replaced threadId with globally unique sessionId
Change-Id: I55b16d4baa1753bc67dcd72de13e7a516da27abe
Reviewed-on: https://gerrit.libreoffice.org/20981
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2015-12-28 04:14:15 +00:00
Ashod Nakashian
42d07b2aea loolwsd: refactored LOOLSession::handleInput to handle errors
Change-Id: I3be929242317f4fafcb62c55d3532b2fbfd6591b
Reviewed-on: https://gerrit.libreoffice.org/20947
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2015-12-26 03:58:51 +00:00
Henry Castro
1f43e99ac7 loolwsd: Refactored ChildProcessSession
ChildProcessSession class now moved to own files.

Change-Id: Ic67c8563ada51f23c83e06631ad913af610d395c
Reviewed-on: https://gerrit.libreoffice.org/20895
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Henry Castro <hcastro@collabora.com>
2015-12-23 17:03:43 +00:00
Henry Castro
894ab66d8c loolwsd: Refactored MasterProcessSession
MasterProcessSession class now moved to own files.

Change-Id: Ic1a980295b9bb4b28ec9e205de1544fb98ad98f8
Reviewed-on: https://gerrit.libreoffice.org/20893
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Henry Castro <hcastro@collabora.com>
2015-12-23 17:02:57 +00:00
Henry Castro
4617a93e5c loolwsd: create a child workspace based on process id 2015-12-03 10:50:03 -04:00
Henry Castro
f5b6aa6515 loolwsd: shut down web sockets that are not yet assigned a document to work on 2015-12-02 20:20:05 -04:00
Mihai Varga
862cfe29a0 loolwsd: renderfont command handler
Renders the requested font and sends it back to the client as a png
image
2015-11-30 11:16:53 +02:00
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