Commit graph

117 commits

Author SHA1 Message Date
Miklos Vajna
2bb596a256 loolwsd: coding style
If README says "spaces, not tabs" and "braces go on separate lines",
then be consistent about it before it gets normal to not respect those
rules.
2015-11-24 09:43:17 +01:00
Henry Castro
41d94bc9da loolwsd: clear queue before socket shutdown
This cause broke pipe exception
2015-11-19 07:32:48 -04:00
Miklos Vajna
bc38b2c265 loolwsd: -Werror,-Wshadow
With this, loolwsd builds with clang.
2015-11-19 11:23:45 +01:00
Mihai Varga
d18667d000 ccu#1273 support utf8 characters in the message passing server <-> client 2015-11-17 20:07:48 +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
Jan Holesovsky
dfcaaf91aa loolwsd: Remove the tiles also from the child's queue.
The commands leave the parent's queue very quickly, the child's queue is the
critical one, so remove them also from there.  This speeds up the typing
experience very considerably.
2015-11-06 18:27:32 +01:00
Miklos Vajna
1409ef11ec loolwsd: allow duplicate messages for all message types expect tile
To be on the safe side, I only allowed "uno" previously, but Mihai
confirmed that the intention was to filter out "tile" duplicates, so
filter out only that.
2015-10-28 17:29:51 +01:00
Miklos Vajna
0fe05e6d91 loolwsd: -Werror=shadow 2015-10-28 10:55:27 +01:00
Miklos Vajna
b5ed22c4d9 loolwsd: avoid filtering out "duplicated" uno commands
Problem since commit 8f48dabf28 (loolwsd:
discard requests that are in the queue already, 2015-07-21), e.g.
"select-all, paste, select-all" doesn't have the same meaning as
"select-all, paste".

Quite possibly the condition should be inverted, and filtering out
should be done only for a few commands, like "tile"; but at least
filtering out "uno" is definitely problematic.
2015-10-28 10:28:27 +01:00
Mihai Varga
28f3555180 loolwsd: insert file HTTP request handler
The client send a file through an http post request, the handler saves
the file in a temporary directory then moves it in the specified chroot
2015-10-22 18:27:29 +03:00
Miklos Vajna
8f90c38844 loolwsd convert-to: implement actual conversion 2015-10-20 15:41:42 +02:00
Miklos Vajna
355362f519 loolwsd convert-to: clean up temp directory in case format would be empty 2015-10-20 15:35:43 +02:00
Miklos Vajna
cdc0783c27 LOOLWSD: put file we get from convert-to to a temp. dir
Having a URL like file:///tmp/tmp13630baaaaa/test.txt allows retaining
the filename given by the user and still work with a URL.

We could try carrying around a memory buffer, but we would still have to
send it over the WS, so it's easier if we always work with URLs instead.
2015-10-20 15:00:20 +02:00
Miklos Vajna
cc18cc702f loolwsd: extraft filename from convert-to parameters 2015-10-19 16:03:55 +02:00
Mihai Varga
0ea00afb99 loolwsd: allow the specification of the mime type 2015-10-16 19:45:57 +03:00
Miklos Vajna
fed0cbc77c loolwsd: -Werror=unused-parameter 2015-10-16 17:45:03 +02:00
Miklos Vajna
9212c1c321 loolwsd: convert-to handler skeleton 2015-10-16 17:38:24 +02:00
Miklos Vajna
63bf9a1329 loolwsd: invert this condition, so it's possible to add other cases 2015-10-16 15:47:39 +02:00
Miklos Vajna
700b7d08b7 loolwsd: allow frame size of 200K
I got:

WebSocketException: Insufficient buffer for payload size 113579

So double the allocated size: that seems to help.
2015-10-16 15:24:19 +02:00
Tor Lillqvist
7e78f3f0c6 bugs.ccu#1248: If locale is C, set it to en_US.utf8 2015-10-13 20:05:42 +03:00
Mihai Varga
c4825f5492 loolwsd: allow cross origin requests 2015-10-12 20:33:29 +03: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
Henry Castro
8a10a16855 loolwsd: restore interactive testing 2015-09-11 16:31:43 -04:00
Mihai Varga
564572e561 loolwsd: also add /etc/host.conf in chroot 2015-09-08 13:03:14 +03:00
Mihai Varga
e17598e866 loolwsd: also copy /etc/nsswitch.conf 2015-09-08 11:31:49 +03:00
Mihai Varga
5396a83c26 loolwsd: copy /etc/hosts when running the server 2015-09-07 15:56:47 +03:00
Mihai Varga
515e6f7fea loolwsd: copy /etc/resolv.conf in the jail
Because sometimes the hostname is not resolved
2015-09-04 18:43:47 +03:00
Henry Castro
7aeca2f92b loolwsd: destroy LOKit when child finished 2015-08-08 08:20:16 -04:00
Henry Castro
54b1e1b612 loolwsd: set thread name to debug socket 2015-08-08 07:55:54 -04:00
Henry Castro
ee928f9af1 loolwsd: create lokit process id logs
Also, when used with --test option, create lokit PID log
so it is attached to the debugger.

gdb loolwsd $(cat /tmp/lokit.pid)
2015-08-05 20:20:05 -04:00
Henry Castro
1c0153d5e0 loolwsd: ensure one child when debugging
when used with --test option:
./loolwsd --test --systemplate=${SYSTEMPLATE} --lotemplate=${MASTER}/instdir
--childroot=${ROOTFORJAILS}

ensure that one child is created and attach to it easily to debug lokit
messages
2015-08-05 20:05:30 -04:00
Henry Castro
0ec12fe11e loolwsd: fix child fork when debugging one child 2015-08-05 18:19:51 -04: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
Henry Castro
6dafcc753f loolwsd: process sleep for amount of time ...
specified by MAINTENANCE_INTERVAL
2015-07-24 14:10:24 -04:00
Mihai Varga
8f48dabf28 loolwsd: discard requests that are in the queue already 2015-07-21 11:08:36 +03:00
Henry Castro
de3d97d5a4 loolwsd: create PID log file.
The PID log file is used by external utilities
to report processes, threads, etc.
2015-07-19 16:49:11 -04:00
Henry Castro
66756a77a9 loolwsd: change named mutex to private static. 2015-07-18 12:35:16 -04:00
Henry Castro
161e5534ec loolwsd: mutex lock when loKit initialization. 2015-07-17 21:54:26 -04:00
Henry Castro
63a33b39f6 loolwsd: moved server socket to main function. 2015-07-17 17:55:57 -04: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
Henry Castro
061a2bfc3d loolwsd: rework child monitor status. 2015-07-16 18:05:28 -04:00
Henry Castro
fd5b676b2d loolwsd: set RTLD_NOW, all undefined symbols in
the library are resolved before dlopen() returns.
Also remove unnecessary commented code.
2015-07-15 20:57:39 -04:00
Henry Castro
3f3b9f7675 loolwsd: remove WSTOPSIG(status).
No child returns status process stop. This cause problems
when we attach one child to debug.
2015-07-15 09:15:12 -04:00
Mihai Varga
0d80d63cb4 loolwsd: don't cancel special tile requests that have an ID 2015-07-14 19:46:29 +03:00
Henry Castro
bb3611399b loolwsd: Use fork but no execve 2015-07-13 10:13:06 -04: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
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