Commit graph

416 commits

Author SHA1 Message Date
Ashod Nakashian
f25575181c kit: parse anonymized tokens in doc options
Also optimize the parsing in general.

Change-Id: Id1f5b5c12e867c98e523d1e32397853d7d4a6ee4
2018-10-16 20:12:23 -04:00
Ashod Nakashian
f12883bc07 wsd: add anonymization helpers
Change-Id: Ic479218ab1b6e580c288a984f35795e1d0d6e8ad
2018-10-16 20:12:23 -04:00
Ashod Nakashian
3158d4c31c wsd: always use signal-safe calls
The async-signal-safe functions to get thread-id
and thread-name, which cache the results, are
faster, cleaner, and signal-safe. No reason why
we shouldn't always use them.

Especially since it appears the logic was
inverted in Log::prefix, such that the signal
un-safe calls were made during signal-handling,
and the safe ones were called otherwise!

Instead of passing the signal-safe flag to
Log::prefix, we pass the buffer size, for
improved security.

Furthermore, reduce header dependencies
and reduce clutter.

Change-Id: I697689b2f0a290b6d8cce4babc3ac1e576141da6
2018-10-16 20:12:23 -04:00
Ashod Nakashian
63c3fce2c6 wsd: clang-format logging macros and pass logger explicitly
Change-Id: I37e7f4b5687b64b36e0985942627a4b84a8249eb
2018-10-16 20:12:23 -04:00
Ashod Nakashian
a7a03c3c5d wsd: send copied text to client upon .uno:Copy
Change-Id: I39181a0e29e00a0eae389fbab6ee253cf2f23f84
2018-10-16 20:12:23 -04:00
Tor Lillqvist
58db979291 Start on a gtk+-based workalike to the iOS app
The idea is that it would work sufficiently identically, so that even
people without a Mac and without an iOS device could participate in
development of the non-iOS-specific bits, like the JavaScript, or the
online MOBILEAPP-specific plumbing. Which would be great.

No, this doesn't do anything sane yet. It does compile the same online
C++ files as the iOS app, though. (Some minor tweaks were needed in a
couple of them to silence gcc warnings.)

There is a plain Makefile, but I should change to using autofoo, too.
Eventually, this will need to be built in a separate tree from a
normal online, just like when using the --enable-iosapp configure
switch. (But for now, doesn't matter.)

Change-Id: I13e4d921acb99d802d2f9da4b0df4a237ca60ad6
2018-10-17 00:45:35 +03:00
Tor Lillqvist
42948f6d75 On iOS, Util::getThreadId() just wraps std::this_thread::get_id() 2018-10-16 23:04:33 +03:00
Tor Lillqvist
f40e05de42 It's enough to document a variable in one place
Let's not have slightly different documentation for the same variables
in the SigUtil.hpp and SigUtil.cpp files. That is just silly.
2018-10-15 16:33:54 +03:00
Tor Lillqvist
e9acbe175d ShutdownRequestFlag can be a constant false in the mobile app
We don't have any user-generated signals to handle by shutting down in
an app.

One less thing to worry about. Now it's just the global
TerminationFlag that is problematic when the code runs in just one
process.
2018-10-15 16:33:54 +03:00
Tamás Zolnai
ac2cd92d25 Upper limit of sent out versions of the same tile
We try to decrease the network usage with avoiding sending out
to much tiles to the client. When we already sent out two versions
of the same tile without having the tileprocessed message from the
client we delay sending out the next version to avoid spamming tiles
on the network.

Change-Id: Ia47cd7c0d3fb829f6777f0c3265970433591df19
2018-09-29 09:27:06 +02:00
Tor Lillqvist
95eb849217 Still more iOS app and related Online C++ code hacking
Re-think the plumbing between the different parts of the C++ Online
code. Do try to have it work more like in real Online on all but the
lowest socket level. Except that we don't have multiple processes, but
threads inside the same process. And instead of using actual system
sockets for WebSocket traffic between the threads, we use our own
FakeSocket things, with no WebSocket framing of messages.

Reduce the amount of #ifdef MOBILEAPP a bit also by compiling in the
UnitFoo things. Hardcode that so that no unit testing is ever
attempted, though. We don't try to dlopen any library.

Corresponding changes in the app Objective-C code. Plus fixes and
functionality improvements.

Now it gets so far that the JavaScript code thinks it has the document
tiles presented, and doesn't crash. But it hangs occasionally. And all
tiles show up blank.

Anyway, progress.

Change-Id: I769497c9a46ddb74984bc7af36d132b7b43895d4
2018-09-19 11:31:18 +03:00
Tor Lillqvist
64c9115a75 Remove stray #include <ftw.h>
Change-Id: I1838ae1c40a6ddc8357963c32f5ccf2040e7da10
2018-09-17 18:05:43 +03:00
Tor Lillqvist
8d42e09559 Introduce LOG_TRC_NOFILE() that doesn't output __FILE__ and __LINE__
For use in callback type situations where the location of the
LOG_TRC() call as such is uninteresting.
2018-09-16 13:43:08 +03:00
Tor Lillqvist
83a7a6f744 s/StaticNames/StaticNameHelper
It is a container for one name (and used just once even), not several,
so no need for the plural.

Change-Id: I6d8b22f071d5136fb854e6f2c5a6be8b4572b535
2018-09-13 12:06:23 +03:00
Tor Lillqvist
b59d160a08 Intermediate commit of work in progress on an iOS app
The app is unimaginatively called "Mobile" for now.

Runs but crashes pretty quickly after loading the document by the LO
core. Will need some heavy changes to get a ClientSession object
created in there, too, to handle the (emulated) WebSocket messages
from the JavaScript. It would then handle some of these messages
itself, and forwards some to the ChildSession, which in this case is
in the same process. Now the messsages from the JavaScript go to a
ChildSession, which is wrong. As the assertion says, "Tile traffic
should go through the DocumentBroker-LoKit WS"
2018-09-12 18:32:05 +03:00
Tor Lillqvist
75438baa70 More mobile app stuff, very much early state of work in progress
Re-think Linux vs mobile ifdefs a bit. Use #ifdef __linux only to
surround code that actually is Linux-specific. Use #ifdef MOBILEAPP
for code that is for a mobile version (with no separste wsd, forkit,
and kit processes, and with no WebSocket protocol used).

Bypass UnitFoo for mobile. Possibly we do want the UnitFoo stuff after
all on mobile, to run in some special testing mode? Hard to say, let's
skipt it for now.
2018-09-10 15:13:43 +03:00
Tor Lillqvist
39072dbae5 Make this file compile for iOS 2018-08-29 20:41:16 +03:00
Tor Lillqvist
7d850bfa6e Make this file compile for iOS
Change-Id: I1d82fed408818a6945cbf2b7743ffcdbe67f6079
2018-08-29 20:41:07 +03:00
Tor Lillqvist
d3f0179c96 Make this file compile for iOS 2018-08-29 20:39:26 +03:00
Tor Lillqvist
8209d6cd0e Make this file compile for iOS 2018-08-29 20:38:40 +03:00
Tor Lillqvist
d7dea2ea51 Need to include <string> here 2018-08-29 19:57:58 +03:00
Tor Lillqvist
c184270934 Bin some unneeded #includes
Change-Id: I5957417b5f81cb373299f3386d509e475bed2b6e
2018-08-29 18:44:35 +03:00
Tor Lillqvist
57326ae27c Third parameter to prefix() is a bool
Passing syscall(SYS_gettid) as a bool is equivalent to passing true,
as far as I understand.

Change-Id: I31bb15000a9e6c95b657d58bc78df4f3da0fe687
2018-08-29 18:36:16 +03:00
Tamás Zolnai
25e1a01a3c Handle tiles hanging out the visible area
A problem comes up when only a part of the tile is visible
on the client side and invalidation affects the invisible
part of this tile. To get back the old / right behavior we
need to request this kind of tiles too.
2018-08-22 13:49:23 +02:00
Miklos Vajna
9ed7c1065c common, kit, test, wsd: these parameters are copied for each invocation ...
... but passing by const ref is enough
2018-08-13 09:26:15 +02:00
Michael Meeks
fabd928366 Mark LOOLWebSocket as deprecated, and dung it out a bit.
Change-Id: I4e1daff8a10092b8845971375ce83e09b78354ea
2018-07-26 09:23:37 +01:00
Tamás Zolnai
57cdd68fcf Request new tiles in wsd by invalidateTiles message
And don't wait for the client to send back a tilecombine
request.

Change-Id: I9ea5de0f6b12dfaaf61992d34735d5b78ea382ed
2018-07-19 14:09:49 +02:00
Tor Lillqvist
3352603011 Avoid cast that causes gcc warning
gcc 8 warns: cast between incompatible function types from ‘void
(*)(int, siginfo_t*, void*)’ to ‘__sighandler_t’ {aka ‘void (*)(int’}
[-Werror=cast-function-type].

The struct sigaction already has an appropriately typed field
sa_sigaction in a union with the sa_handler field, so use that. (If
that is not present in some older Linux and/or glibc that we still
need to support, this commit will have to be reverted then.)

Change-Id: I67667073c89b7b22e7de1933ccaaa60868685866
2018-07-19 12:46:54 +03:00
Tor Lillqvist
eae43a262b Drop unused LogPrefix variable
Also gets rid of a potentially problematic strncpy() use that causes a
gcc warning: specified bound 256 equals destination size
[-Werror=stringop-truncation].

(Whether that would have caused a problem or not depends on how
LogPrefix would have been used, and whether it ever would have been
filled completely, without any terminating nul character, by that
strncpy().)

Change-Id: I92dba3726e3f46777d9b4c8cf88f557c02788fe0
2018-07-19 12:16:19 +03:00
Tor Lillqvist
0c425c82d3 Be consistent, no space before the '|' in LOG_BODY()
Change-Id: Iecab73efcb19562c5a7ebee506f13668b1a827c3
2018-07-13 17:51:21 +03:00
Tor Lillqvist
b4192de6fa Output '|' before the source file name in LOG_END(), too, like in LOG_BODY()
Change-Id: I57d825d03321992d680670f3560e951bc0cb2005
2018-07-13 17:49:21 +03:00
Tor Lillqvist
3b4269a301 Use Util::symbolicErrno()
I think the general policy should be to always log errno using both
Util::symbolicErrno() and std::strerror(), never log a naked errno.
But only in cases where we know that it is highly likely that it is
the most recent system call that has failed, so errno makes sense.

Change-Id: I4a1fb31e375ea949e7da17687464361efe7c1761
2018-07-11 13:05:22 +03:00
Tor Lillqvist
40f4cf17c9 Add a symbolicErrno() function to Util
For a developer, it is much nicer to see "EXDEV" in a log than "18",
for instance. (Sure, we often also log strerror(), but might that
perhaps be localised? And the symbolic names are what one uses when
coding anyway.)

Change-Id: I456a8c2589147dcad87f1b4c3a20b3bd5a35d097
2018-07-11 12:54:27 +03:00
Ashod Nakashian
3d6e373992 wsd: reduce lock scope and log diskspace checks
Change-Id: If093670ae83de5596a86a116ba6224aa0badbcbe
Reviewed-on: https://gerrit.libreoffice.org/52415
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2018-06-11 22:15:57 +02:00
Tor Lillqvist
72baaa231c We seemed to have just two minor ASCII art instances, actually
Change-Id: I308cda537c26b1a9976e7bcf7634c67917a30163
2018-06-08 08:42:31 +03:00
Henry Castro
6ff069db62 respond different logo brands when it has support
Change-Id: Icddc8b67a20fd829c90c3c5d8eb6942da9c5e74d
Reviewed-on: https://gerrit.libreoffice.org/53583
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2018-05-24 15:10:45 -04:00
Miklos Vajna
eedfe0add4 UnitHTTP: make sure function defined in header is inline to avoid ODR violation
Change-Id: If81ecbe1a73a73c093614f0ad5285558302e13d0
2018-05-22 09:12:40 +02:00
Jan Holesovsky
088acf5e98 Before we kill the child, check it exists, ie. kill(pid, 0) == 0.
Also warn when anything was left out.

Without this, we leave abandoned children around.

Change-Id: I293a530ffceeb7f6bdc0cc775335c782945de6e7
2018-05-18 15:16:40 +02:00
Michael Meeks
071079a6a9 seccomp: allow socket shutdown in kit process.
Change-Id: Ie11f5eb278bcba8dcf13d6f095de2ffd6d23fcb3
2018-05-18 15:16:40 +02:00
Jan Holesovsky
6996139e5f Use correct path in the client websockets.
Change-Id: Ie0bf6646ff3f6e6cf99b505143a416c86a3a33b8
2018-05-18 15:16:40 +02:00
Ashod Nakashian
b59f5c2c65 wsd: log proper ISO date in YYYY-MM-DD format
Change-Id: I8851c044bad43a03a99f7471be97ea77c58f7be8
Reviewed-on: https://gerrit.libreoffice.org/53266
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/53316
(cherry picked from commit d50850337b1cad5ce93678079085a97316f1f48e)
Reviewed-on: https://gerrit.libreoffice.org/53318
2018-04-23 11:53:23 +02:00
Michael Meeks
81fd84cf4e Move UnitHTTP code to header to avoid linking trouble.
Change-Id: I430110e840fa8b3862c21c1d4e02288ed704e0a3
2018-04-17 16:50:48 +01:00
Michael Meeks
03bbe52665 Ensure the forkit does not have lingering threads after preinit.
Change-Id: I216a03a0ada628189355ebfd4016bf6033430eef
2018-04-16 20:04:23 +01:00
Jan Holesovsky
c8ef63253a Sanity-check the scheme and host for frame ancestor, POCO does not do that.
Change-Id: Ieea9532ccd2a11e74f370a340e68f46122469848
2018-04-04 12:50:53 +02:00
Miklos Vajna
5736f4c307 common: mark parseJSON() as inline explicitly
Otherwise this can lead to an ODR violation.

Change-Id: I1b195cb57d37a050755d7d3f6c922950ef8738c4
2018-03-19 11:58:18 +01:00
Michael Meeks
6803ee4087 Use a hard random /tmp directory for document intermediates.
Requires a lok tweak to reset the tmpdir globals on init.

Change-Id: I602705f20fa016ef415088be8d1ada6d465d2a8d
2018-03-15 11:01:51 +00:00
Rene Engelhard
abf489991f fix --disable-seccomp build
Change-Id: I32008de7745e106e4a633fb587f2837c59cdd541
Reviewed-on: https://gerrit.libreoffice.org/50652
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2018-03-03 12:07:07 +01:00
Ashod Nakashian
5befd0803a wsd: improved wopi info parsing
Better logging during wopi info parsing,
especially upon failures.
Refactored the code from Storage.cpp into
JsonUtil.hpp.
Minor optimizations.

Add unit-tests for the parsing logic.

Change-Id: Ifebc3f6b7030a6c7b3b399786633f6b5e8737478
Reviewed-on: https://gerrit.libreoffice.org/49927
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2018-02-23 16:54:39 +01:00
Ashod Nakashian
7be98efd93 ut: log timestamp to track timeouts better
And improve the logging support in unit-tests to
help troubleshoot issues faster and more accurately.
Also makes the code more readable (hopefully).

Change-Id: I4f8aafb5245e2f774b03231591a74544f9ec84aa
Reviewed-on: https://gerrit.libreoffice.org/48645
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2018-02-11 19:21:15 +01:00
Pranav Kant
39f11ab4f7 document conflict: unit test
Change-Id: I4ea310fe5adb198bc7b5e083f6bd4b0431c0cdef
2018-02-09 00:22:57 +05:30
Pranav Kant
ad1da235d3 IME support
Dialogs still need to be adapted to this. Only works for documents as of
now.

Change-Id: I0fb1114e279a9e563943f3f65dd5a577523e9841
2018-02-08 14:16:34 +05:30
Miklos Vajna
9eacfe4fcb common: spell out non-trivial autos to improve readability
Change-Id: Id13bc0e48cec845f5b05171128be5b4efc05c6bc
2018-02-07 10:18:12 +01:00
Henry Castro
f269a9321c follow up, avoid logging when closing file descriptors
Change-Id: I38432ae1d042094551d22c2512a416c3b345556b
2018-01-31 17:53:58 -04:00
Henry Castro
b1f1500b56 util: avoid logging when closing file descriptors
eventually the log file descriptor will be closed and unhandled exception it will throw it

"terminate called after throwing an instance of 'Poco::WriteFileException'
  what():  Cannot write file"

Change-Id: I1d6ae3a4d4d4910f2ed2cdc80b162c27f93d55d9
Reviewed-on: https://gerrit.libreoffice.org/49055
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2018-01-31 22:06:57 +01:00
Miklos Vajna
222399e99a common: avoid pointless copy in Util
Change-Id: I40097203eba6fede78a17caf057452f4704b2bd4
2018-01-30 16:09:33 +01:00
Michael Meeks
d3c17510ed Implement an improved fork/exec wrapper.
* logs helpful messages for various error corner-cases.
* optimized file descriptor closing for large fd counts.

Change-Id: I8cba9ecb3d71ddc6e22e20d89368d8c6b9b5097f
2018-01-29 15:20:10 +00:00
Pranav Kant
c16d198560 Print humanized bytes in the logs
Change-Id: I2ebdea0c3a360be1573ae13fa9cbe6f432436f29
2018-01-26 20:03:22 +05:30
Ashod Nakashian
c06376cc1d wsd: cleanup logging and remove unused helpers
Now all logging is done after checking if the
level in question is enabled or not (thanks to
the macros LOG_XXX), which saves unnecessary
conversions and stringification when said level
is disabled.

Change-Id: Icde31e067f60269563896f04f8b0d65643720766
Reviewed-on: https://gerrit.libreoffice.org/47885
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2018-01-19 00:33:40 +01:00
Tor Lillqvist
e834526983 Add FIXME 2018-01-15 14:22:56 +02:00
Tor Lillqvist
7bf59d8f64 Add Util::startsWith() to check whether a std::string starts with another
Odd that we have managed without such a helper for so long, or did I
just not find it?
2018-01-15 13:39:48 +02:00
Ashod Nakashian
5f175c5120 wsd: save documents before recycling
Change-Id: I24afc5c1bceca272f23a129609f73fc5a8d3caf2
Reviewed-on: https://gerrit.libreoffice.org/47739
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2018-01-11 08:13:16 +01:00
Ashod Nakashian
59398af621 wsd: simpler and more efficient OOM killing
Change-Id: I118abdffba4e7ab57fe6a29a3a9fc420d871bdc0
Reviewed-on: https://gerrit.libreoffice.org/47738
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2018-01-11 08:12:09 +01:00
Pranav Kant
1353408999 loplugin:includeform
Some files weren't rewritten from the last run.

Change-Id: I8c5beadaf2cf9b367158abe6f0a5460fa3054521
2017-12-21 20:09:03 +05:30
Pranav Kant
f63858433b loplugin:includeform
Change-Id: Ib62a7aa61062f00698aa3e8a144438de5c57e53d
2017-12-20 21:21:05 +05:30
Michael Meeks
864b07f5b3 Annotate string pointers in hex dumps to make sense of memory.
Change-Id: I7934ccf379dbca9862ddb911865aaeff692261bf
2017-12-15 22:45:04 +00:00
Pranav Kant
849eb0d500 lokdialog: Adapt to LOK dialog API changes
Change-Id: I653304e71573eb253e09a72bc87d54b8554ba7ff
2017-12-04 22:13:50 +05:30
Michael Meeks
26876e6165 loolmap - read the parent's page data for unshared pages too.
Change-Id: I23bb319fa4694638efc82c7af86224d2e041160c
2017-11-30 13:33:25 +00:00
Michael Meeks
0778b72697 Dump hex contents of un-shared memory.
Change-Id: I47dfa8a0b48d0ba34b7462301b83e2721617814d
2017-11-29 03:33:16 +00:00
Aron Budea
f6ec965dff rlimits: Friendlier and more precise logging of numbers
Unlimited settings were logged as huge numbers.
In two cases settings were logged via LOG_SYS (and as errors)
instead of LOG_INF.

Change-Id: I1da493c0126ecf9d2382956ac1e60e57988696ee
Reviewed-on: https://gerrit.libreoffice.org/44731
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2017-11-23 21:15:39 +01:00
Rene Engelhard
623b45a533 fix build with poco 1.8.0(.1) 2017-11-13 20:21:22 +01:00
Miklos Vajna
bb7ac21d44 Make sure that loop index type is never narrower than the length type
Change-Id: I19aac80850c0371085ca6364412d5ac9207220d0
2017-11-06 09:14:38 +01:00
Miklos Vajna
a3d6dee503 Remove unused strings
Change-Id: I621c462bca38222dcf26dfa1e414cf27e1a3e088
2017-11-03 15:25:09 +01:00
Jan Holesovsky
343c5bc690 tdf#99744 SaveAs: Extend test to check that the Save As result was sent.
Change-Id: I3788b87d2599c01000af97f496ee2b840c0cae3e
2017-10-26 11:11:38 +02:00
Tor Lillqvist
73d77a9f67 More -Werror=implicit-fallthrough=
Change-Id: I62164eef3a4f95bfe505b3b1a866495bde6c19b1
2017-10-26 11:51:53 +03:00
Pranav Kant
e9e162b35e lokdialog: Mouse/key events, canvas use & child window impl.
Change-Id: If8ae5c284e7166d4a01bd664644134f11197f988
2017-10-25 00:39:03 -07:00
Pranav Kant
de780f8253 lokdialog: wsd: first cut at lok dialog rendering api
Change-Id: Id522e0796428ed0a15ea3496e6726f51ed232e75
2017-10-25 00:37:41 -07:00
Miklos Vajna
7ab856b196 common, wsd: clean up redundant casts
Change-Id: Iad7e2417c6b1a154f6ad21839b841ca452e835c5
2017-10-24 09:23:54 +02:00
Jan Holesovsky
262916363d rlimits: The fsize and nofile need more tweaking...
Change-Id: Ifdb4d24f103f54fd286b8ffa715c0a61c2cff94f
2017-10-06 15:42:53 +02:00
Jan Holesovsky
92aca7f2dd Compile the support key in (when configured to use one).
Change-Id: Iffff0b95b245b91d9732a774a6026a3cec2b2222
Reviewed-on: https://gerrit.libreoffice.org/43185
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
2017-10-06 11:39:29 +02:00
Jan Holesovsky
783e3552c0 Support key logic in loolws + improvements in loolconfig.
To be able to set the support key directly from the command line, and to show
the option, etc.

Change-Id: Iac93bc47a6f4b9d5a5ad0ac8b06bda978e01b760
Reviewed-on: https://gerrit.libreoffice.org/43098
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2017-10-06 11:37:18 +02:00
Michael Meeks
79053911fc Support key logic and verification.
Change-Id: Ie55150b99df3e80239236571af185502196ad3e9
Reviewed-on: https://gerrit.libreoffice.org/43097
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
(cherry picked from commit 56385cb8ac2a57af4eb70bc8bc7313a9299533c3)
Reviewed-on: https://gerrit.libreoffice.org/43099
2017-10-03 21:52:45 +02:00
Jan Holesovsky
7f49b1eba6 PutFile ext: X-LOOL-WOPI-IsAutosave header to indicate autosave + unit test.
Change-Id: I65ed711dae5100467fe6ed9902bd7bad8c7f8d68
Reviewed-on: https://gerrit.libreoffice.org/43074
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2017-10-03 12:04:18 +02:00
Marco Cecchetti
e015c83957 fixed wrong logging text
Change-Id: Ife3bdf05e15a9f11227c37eec6af0719cd8b2e5a
Reviewed-on: https://gerrit.libreoffice.org/43033
Reviewed-by: Marco Cecchetti <mrcekets@gmail.com>
Tested-by: Marco Cecchetti <mrcekets@gmail.com>
(cherry picked from commit 8f9cff124763285e0bb7cc98d96770b98367eafb)
Reviewed-on: https://gerrit.libreoffice.org/43034
2017-10-02 10:55:27 +02:00
Marco Cecchetti
ee6e64528d wsd: support for FSIZE and NOFILE system limits
The routine for handling the configuration for the max file size
limit, was wrongly using NOFILE. Now we handle both limits correctly.

Change-Id: Ie8b63617286f66af6d4eb1b35b9e4f4b28f3c2a6
Reviewed-on: https://gerrit.libreoffice.org/42803
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/42811
Reviewed-by: Marco Cecchetti <mrcekets@gmail.com>
Tested-by: Marco Cecchetti <mrcekets@gmail.com>
2017-09-26 17:40:31 +02:00
Michael Meeks
be228a160d Allow unit tests to avoid handleInput.
Change-Id: Ib4accd6bbfdc1fc55c45365df275edfa8a68bc59
2017-09-19 21:13:58 +01:00
Michael Meeks
5c879a17b2 Count key-strokes, and report per session.
Change-Id: Id661fc15d4a75e322024ce62d24b2d7dae8f256a
2017-09-11 19:00:10 +01:00
Marco Cecchetti
dee39a562c support for rendering a watermark on each tile
Change-Id: I3edccac49a3bcd3d2493d8d7ef3a1ae29307e727
Reviewed-on: https://gerrit.libreoffice.org/41898
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2017-09-07 17:28:44 +02:00
Jan Holesovsky
057fd10881 No need to scare people too much.
Change-Id: I2b598b3363a73c352bda2cb6bbf0c0d208456456
Reviewed-on: https://gerrit.libreoffice.org/41291
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2017-08-18 15:39:16 +02:00
Jan Holesovsky
cef217ea24 wsd: Fix the OAuth unit test.
Trying to combine the Poco's http server together with our polling loop leads
only to problem; so instead let's introduce a hook where we can do the WOPI
serving directly in the unit test.

Change-Id: Id3fec6ff93c3ad652aa4e0fc6309c5b7639728cb
2017-08-09 22:27:49 +02:00
Pranav Kant
af13e5927d Open the log channel explicitly to avoid file creation inside jail
Change-Id: Ida66861e0e1c5925dbbf53d564a829eaf0fd15c7
2017-07-12 15:14:58 +05:30
Pranav Kant
fde57adbbf Introduce hard mode when we are OOM
Start killing documents when memory usage goes above threshold.

Also make it possible to close documents from admin instance.
In DocumentBroker::closeDocument, just set the _stop flag and wake
up the polling thread which will terminate the children, instead of
manually terminating the children.

Change-Id: Ie70e05b3fb6ea816a87b6dcfaed92cdddb94aa90
2017-07-07 21:14:53 +05:30
Andras Timar
ad8bffa04a configure option to disable SECCOMP
Change-Id: I8120674b60d388a3f85190631469a112c4af9266
Reviewed-on: https://gerrit.libreoffice.org/39408
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2017-07-03 11:43:01 +02:00
Michael Meeks
73a87493f0 Use WireIds instead of long hashes to identify tiles efficiently.
Changes protocol to use 'wid' instead of 'hash' everywhere. Wire-ids
are monotonically increasing integers that can be mapped to hash
values for all of the hash values and tiles we cache internally.

Change-Id: Ibcb25817bab0f453e93d52a6f99d3ff65059e47d
2017-06-20 21:49:44 +01:00
Michael Meeks
8fb48811ec Protocol - only match complete token names.
Change-Id: I027e29da8cc6c48a0d896fa41516934a3ff71b43
2017-06-20 21:49:44 +01:00
Michael Meeks
7ea5f71a7b Units: allow filtering of user alerts.
Catch things that kill tests like disk-full earlier.

Change-Id: Ib50b516063305f2fc93b662ec3ad9ab6c52c6c92
2017-06-16 20:25:23 +01:00
Pranav Kant
db13014e00 Update modifiedTime for local files unconditionally
Also teach logger to print timestamp object.

Change-Id: Ia13836814c195cef92f5dafd8245c9958600876d
2017-06-16 19:49:37 +05:30
Ashod Nakashian
44d8876f27 Remove data rlimit
Seems to have no effect, so gone in
favor of RLIMIT_AS (virtual memeory).

Change-Id: I210879ec9285f420c9f9839cdabf45c42d865fb3
Reviewed-on: https://gerrit.libreoffice.org/38720
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-06-13 06:27:12 +02:00
Ashod Nakashian
6de3adcf9c wsd: pass default rlimits to forkit from config
Change-Id: I84d271f460f0fb1d03a973107c32265d84bf2841
Reviewed-on: https://gerrit.libreoffice.org/38675
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-06-12 06:18:31 +02:00
Ashod Nakashian
92d29b1ce7 wsd: support setting process rlimits
Change-Id: I7117e6843d2ebc919d7d2303cc593de888cc54b1
Reviewed-on: https://gerrit.libreoffice.org/38672
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-06-12 06:17:21 +02:00
Aditya Dewan
9502741590 tdf#107278 admin console: adding graph to track CPU load
Change-Id: Idb07fe4139dd639a49ce1545cc15895f74876b06
Reviewed-on: https://gerrit.libreoffice.org/38425
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-06-08 12:58:12 +02:00
Michael Meeks
3101fa510d Accumulate I/O stats per document.
Change-Id: Ie2f5647e65070ddd828f048820efd38b600f9133
2017-06-02 20:41:25 +01:00
Ashod Nakashian
da2d3cbc92 wsd: support per-user links and commands
userextrainfo is a json array that contains
extra user-specific links.

Currently 'avatar' is assumed to hold the
image url for the user's avatar.

'mail' and other links can also be added.

Change-Id: I37c4c68bfa0b7ee659e017b4867dcb8cf5c2ca2f
Reviewed-on: https://gerrit.libreoffice.org/38120
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-29 06:45:18 +02:00
Pranav Kant
7a4bc5b95a admin-console: Check the password against hashed value in config
The new password hash property is called secure_password in the config
file. `loolconfig` tool should be used to set the password hash in
appropriate format with desired salt length, password length, number of
iterations in PBKDF2.

To be backward compatible, plain-text password for admin-console in
config file is still accepted in case secure_password property is
missing from the config file.

Change-Id: If229999dac62856e368555c0242c4aa6f8061fba
2017-05-25 01:18:31 +05:30
Ashod Nakashian
407c538f04 Correctly send termination reason to clients
Fixes the case when the client reconnects on idle
disconnection (because it never got the 'close: idle'
message).

Also, show informative message to users in this case
instead of grey screen.

Change-Id: Ia2e1f2ffefe6d35dd1552e7cc44e490aab86c600
Reviewed-on: https://gerrit.libreoffice.org/37891
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-22 07:05:28 +02:00
Pranav Kant
8a02e7a8fa wsd: Debugging environment vars to debug storages
Also, extend the LOOLProtocol::tokenize to accept a custom delimeter.

Change-Id: I7f789e703c5c8d2ad325b3dd149ba888c722f5f3
2017-05-17 16:30:33 +05:30
Ashod Nakashian
47c01440ba wsd: logs
Change-Id: I286c4c7415b114f51f3258bd6d50f8e103ea6c75
Reviewed-on: https://gerrit.libreoffice.org/37611
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-15 05:14:55 +02:00
Ashod Nakashian
484fcd63a5 wsd: corrections to replace and unittests
Change-Id: I0e03deaa710ba722a97c9f857b514f8ecb0e1682
Reviewed-on: https://gerrit.libreoffice.org/37609
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-15 05:13:21 +02:00
Ashod Nakashian
d267b86bbd wsd: include version in http agent strings
And move the WOPI agent string to Common.hpp.

Change-Id: Ife679705bcd6914ddd45ad50446e690fb22dd317
Reviewed-on: https://gerrit.libreoffice.org/37607
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-15 05:10:06 +02:00
Ashod Nakashian
9798eafb8c wsd: random jail paths instead of pid
Jail paths are now generate from a PRNG
instead of using the PID of the kit process.

The PRN is converted to base-64 and used
as the directory name where a given
kit is jailed.

Change-Id: I8e4bc35d9ccdfdae0e542ab707c417cd29ad52f3
Reviewed-on: https://gerrit.libreoffice.org/37372
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-08 04:59:12 +02:00
Michael Meeks
9e45fb30d7 SocketDisposition: push it down the stack, and cleanup around that.
Dung out overlapping return enumerations. Move more work into 'move'
callbacks at a safer time, etc.

Change-Id: I62ba5a35f12073b7b9c8de4674be9dae519a8aca
2017-05-05 18:37:26 +01:00
Jan Holesovsky
2a2d863321 Fix build with older kernel versions.
Change-Id: I28fc6687a42ac428413d644e9fd55870cd5936fa
2017-05-02 17:24:44 +02:00
Michael Meeks
31818b7dd6 Trap rather than kill from seccomp and log invalid syscalls.
Change-Id: I319c10776476fea865dd7a95921f1b08b689e09f
2017-04-28 19:06:20 +01:00
Michael Meeks
08c70f1315 Signal safe number logging (lame but useful).
Change-Id: I0b6095fc08dcc237a224b5942ab5a09e6820e43f
2017-04-28 19:05:45 +01:00
Michael Meeks
a7eeacf9e0 SigUtil: split out dumpBacktrace.
Change-Id: I33121de341051bf40ae0d42d1d6d44843d6d1e97
2017-04-28 18:08:57 +01:00
Michael Meeks
bc31103a5d Seccomp: filter more syscalls.
Change-Id: I2cc203d48e4592c5f182e675383e96a13b87bc36
2017-04-28 17:55:14 +01:00
Michael Meeks
7f4f752667 Initial seccomp work.
Add a list of unhelpful looking system calls to improve containment.

Change-Id: I2e4bf3e0a6a752d427299728663d17120586bb10
2017-04-28 14:26:21 +01:00
Michael Meeks
c8d1c18cb5 Revert "wsd: correctly remove request from socket buffer"
This reverts commit c851c3e93b.
2017-04-25 22:49:08 +01:00
Ashod Nakashian
c851c3e93b wsd: correctly remove request from socket buffer
POST requests require the full request to be
left in the socket buffer to be parsed in full.
But GET requests, especially WS upgrade, must
have the request cleared from the socket, as
there is more data expected to be read after
the upgrade, which happens by the DocBroker
thread, so clearing the buffer must be done
before the upgrade.

This patch accomodates these two conflicting
cases and refactors the code slightly to
make it more structured and readable.

Change-Id: Ia7357a745a3900f986099ba14af2a0946023018b
Reviewed-on: https://gerrit.libreoffice.org/36873
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-24 06:49:33 +02:00
Michael Meeks
f72b7d2ba1 Don't set the buffer size to zero.
This slows things down terribly, particularly the setting on the websocket
made tiles appearing one by one. Let's keep the possibility to zero the buffer
sizes for debugging, but hide that behind an env. variable (and in debug
builds only anyway).

Change-Id: Ie4d2cdb3c0ec3c50f1a2b4f9941a462ac4f2d196
2017-04-19 10:58:18 +02:00
Jan Holesovsky
1585cbdb6b Merge document size changes callbacks in the message queue.
Change-Id: I1a540b17f2a72c374568db834a30b814878e9032
2017-04-07 12:13:45 +02:00
Jan Holesovsky
67586d3fdb Don't bloat the message queue with unprocessed status indicator changes.
Change-Id: I87f254a94183b5a97cfb1e4eb49ddea7f88258bf
2017-04-07 11:30:12 +02:00
Michael Meeks
2d1764d30e Dump ClientSession and MessageQueue state too. 2017-04-05 17:59:29 +01:00
Jan Holesovsky
37387518f4 Suppress assert()'s in the production builds.
Change-Id: I2074ed335b7201337e6519440ff6bed1809be915
2017-04-05 12:03:33 +02:00
Ashod Nakashian
95d51493aa wsd: remove nextmessage
This was a workaround to Poco's limitation
of requiring socket receiveFrame be given
preallocated buffer, which couldn't be
exceeded by a larger payload. This meant
the receiver had to know the maximum
payload in advance.

Since only the Kit uses Poco sockets,
and the Kit never receives large payloads,
this preamble is now obsolete.

100% (94/94) of old-style tests PASS.

Change-Id: I76776f89497409e5755e335a3e25553e91cf0876
Reviewed-on: https://gerrit.libreoffice.org/36037
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-03 05:18:09 +00:00
Ashod Nakashian
e0822f8516 wsd: better thread affinity logging
Change-Id: I9e4bc3fe864aa409dc4874a9d6fc4ab22bfea592
Reviewed-on: https://gerrit.libreoffice.org/36029
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-03 05:11:57 +00:00
Michael Meeks
2bca560feb Add hook for disk space check. 2017-03-31 17:18:41 +01:00
Michael Meeks
e79c5f9083 Use process name for a thread if no name is set (yet). 2017-03-31 11:21:35 +01:00
Pranav Kant
ce1084b74f wsd: Send readonly info to clients
With this every other client would be able to know about other client's
permission i.e whether they have opened the document as readonly. This
could be important eg: to hide the cursor overlay of readonly users in
the UI or to mark these users as readonly in the userlist.

Change-Id: I5dcb1b4e5a22c9b546d16b69b9216cc7653cff04
2017-03-31 12:20:09 +05:30
Michael Meeks
ae0dba1088 Cleanup prctl / gettid system-call thrash on logging.
Makes the strace look much prettier.
2017-03-30 18:14:40 +01:00
Michael Meeks
913c469aa8 Cleanup whitespace, return is not a function. 2017-03-30 17:34:52 +01:00
Ashod Nakashian
30d58f96a4 wsd: avoid unnecessary temp string construction
...when sending text messages over socket and
make return value indicative of success/failure.

Change-Id: Ie4d99103b0d49d238152f7da3155ebcb6ccd4e22
2017-03-29 23:55:19 -04:00
Ashod Nakashian
f1c371555a wsd: kill unused headless stuff
Change-Id: Ic4ee7603ecd7acd10e4499457de181342f2d7483
Reviewed-on: https://gerrit.libreoffice.org/35735
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-27 03:19:11 +00:00
Ashod Nakashian
b69d5683c3 wsd: log messages upon construction
Change-Id: Id8f2eeaa1fabf538af0c327a971d35cc17cb3596
Reviewed-on: https://gerrit.libreoffice.org/35734
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-27 03:18:29 +00:00
Jan Holesovsky
9f17050a7d Pass the locale settings from loleaflet to wsd/kit.
Change-Id: Ie530db73cfbdb62787f16eae0f4b07fbf8b8acb4
2017-03-24 12:34:32 +01:00
Ashod Nakashian
7096133f07 wsd: log thread affinity violations
Change-Id: Ib1317bc71f9162f005e0ce9b8c715bbce656db73
2017-03-20 00:41:53 -04:00
Pranav Kant
5a12b68b01 Fix unit test timeout interfering with normal run
Otherwise, loolwsd exits immediately upon start

Change-Id: I3bdf438797be162b8a44bb47ee1ddde7626dcc64
2017-03-17 12:44:23 +05:30
Michael Meeks
bb3fa00631 UnitPrefork - restore most of the functionality.
No need for the memory reporting bits now that Admin gets this right.
2017-03-16 19:13:14 +00:00
Michael Meeks
ab67d605e6 Unit tests: use WSD's main socket-poll for test timeouts. 2017-03-16 18:52:49 +00:00
Michael Meeks
8749f4f2e3 Cleanup unit test hooks. 2017-03-16 18:32:12 +00:00
Michael Meeks
e7ebe0fdaa remove obsolete Poco headers, and Poco SSL pieces. 2017-03-16 18:03:23 +00:00
Ashod Nakashian
e9614fc697 wsd: support logging file and line with logger objects
Change-Id: Ibf82105d91ece29c0a4742c6b2e81f6b179c0be4
Reviewed-on: https://gerrit.libreoffice.org/35081
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-11 19:49:09 +00:00
Michael Meeks
0eaef6c896 config.h - get includes right: must always be the first include. 2017-03-10 10:47:43 +01:00
Michael Meeks
333f8994e9 Cleanup shutdown flag handling.
Pull the notification pieces out of SigUtil.cpp - not signal safe,
and invoked only from LOOLWSD anyway.

In a non-blocking world, the socket close notification sends are
instant - so more work required to count-down / timeout remaining
clients.
2017-03-10 10:47:42 +01:00
Michael Meeks
fa96673ee0 Connect USR1 to initial global state dumping goodness. 2017-03-10 10:47:42 +01:00
Michael Meeks
fa6b756346 signal handling: keep track of all socket poll wakeups & wakeup.
Instead of waiting for polls to timeout; wake them up.
2017-03-10 10:47:42 +01:00
Ashod Nakashian
4abf706af6 nb: websocket shutdown support
Change-Id: I2fcab98e9725eca86d097f34236889fdf9289c47
2017-03-10 10:47:41 +01:00
Ashod Nakashian
17fc91e220 nb: process POST requests
These are really GET requests that aren't
WebSocket upgrade. Should rename to something
less misleading.

Re-enabled testSlideShow which depended on this.

Change-Id: I52b7f67b650fcdcbae7c2bff020b756099263141
2017-03-10 10:47:41 +01:00
Michael Meeks
184dcfa96e Ctrl-c should really terminate this if you keep going. 2017-03-10 10:47:41 +01:00
Ashod Nakashian
57235943c0 nb: ignore empty payloads
When the socket is closed the last WS frame
will not have any payload, just a frame.
In this case the socket should still fire
handleMessage so this frame could trigger
application logic, however in this case
ClientSession has nothing to do, so we skip it.

Change-Id: Ia2b13026e31460ffceb8f9d9cfa39d36fbc57146
2017-03-10 10:47:41 +01:00
Ashod Nakashian
784dd41eae nb: simplify WS sendMessage interface
No need to construct vector<char> where
a simple char*/size_t suffice.

Change-Id: Ic70ad65a2078a1f653695504a79532f7831d88be
2017-03-10 10:47:40 +01:00
Ashod Nakashian
9efb14def7 nb: pass the WS frame type explicitly
Change-Id: Iaf4d832af4313b629701c7f07832dcaaf3e53c20
2017-03-10 10:47:40 +01:00
Jan Holesovsky
a1a46c240e nb: Use the non-blocking socket in the loolwsd.
This so far only builds, but I did not even try to run it yet.

Change-Id: Iceacb5fc5c8994726508e8ea00bd495d758391a8
2017-03-10 10:47:39 +01:00
Ashod Nakashian
8dd115a419 nb: more SSL initialization
Multi-threading support.

Change-Id: I7233ca61f9a0dce5601b4de03a7ad3273acc0f3c
Reviewed-on: https://gerrit.libreoffice.org/34355
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-10 10:47:37 +01:00
Ashod Nakashian
6a3242ce96 wsd: no tabs
Change-Id: I0537f7437328cb758e691d8e0ddc12d78da11f6a
Reviewed-on: https://gerrit.libreoffice.org/34353
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-10 10:47:37 +01:00
Jan Holesovsky
7eff2294d9 We should be able to run with 5G of free space just fine.
Change-Id: Ie5df96388eeaa0ddf1a41564ec7d52c283e6b1bb
2017-02-21 19:55:04 +01:00
Ashod Nakashian
1e42b530e6 wsd: read memory RSS directly from /proc/pid/stat
There is no need to use `ps` here as reading
directly is trivial and has far less overhead.

Change-Id: I27d0432c1f3a9d35763d67fc445d8bd828f1b27e
Reviewed-on: https://gerrit.libreoffice.org/34052
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-02-09 04:35:24 +00:00
Michael Meeks
e3e2a5eeee WaE: add missing bracket. 2017-02-07 20:07:37 +00:00
Michael Meeks
9ec0466c57 Admin - measure dirty memory of kits, and RSS of forkit.
Gives a more accurate real memory consumption for each process.
2017-02-07 18:55:32 +00:00
Jan Holesovsky
04d7ed9d09 fuzzer: Make the shared loolwsd and loolforkit binary actually work.
Change-Id: If6ee9f22d93aa040f94df86b30fdc8a0a1ad68e2
2017-02-07 13:27:14 +01:00
Jan Holesovsky
0dac1c4321 fuzzer: Compile a separate binary that contains both loolwsd and loolforkit.
Change-Id: I158e4b19d0929de03f09645c106aebfdbc44ea74
2017-02-07 13:27:14 +01:00
Miklos Vajna
98b02fb9c4 common: unused using declaration in Session
Change-Id: I0122b6ad6f5d0e47a2b3c153cdd5e65a7adc6040
2017-02-07 09:08:38 +01:00
Miklos Vajna
18f40e89e1 common: avoid unnecessary value parameter in MessageQueue
Change-Id: I4cefc2658eea75091219e534db25f5ab5877c0c4
2017-02-06 09:30:44 +01:00
Ashod Nakashian
64335b4127 wsd: correctly initialize forkit pid in Admin
Change-Id: I376742fa324f207d77fa290046657f17f8872b27
2017-02-05 21:59:23 -05:00
Ashod Nakashian
0476d1d9f2 wsd: don't complain to the user on idle termination
We no longer tell the clinet "This is embarrassing..."
when we disconnect and unload an idle document. Instead,
the client UI remains greyed out so the user can resume
as if it was inactive (and reload the document in this case).

Also, we now always send the "close: " message prior
to shutting down a client websocket. This is more
reasonable and consistent when we intentionally disconnect,
so clients can rely on it to signal intent and give reason.

Otherwise, a disconnection without this application-level
message should be unexpected and is therefore reasonable
to show the "This is embarrassing..." message.

Change-Id: Ic7439bcc9267be155586ccd5d122e9fe60225516
2017-02-05 21:59:23 -05:00
Ashod Nakashian
b095e06173 wsd: fix crash when unloading idle documents
A race condition between the client socket thread
and the idle-document cleanup caused segfault
on the websocket.

Now the ChildProcess object doesn't reset
the websocket on closing, rather on destruction.

Change-Id: I10d0dfb1ba677a65479df85b7a53de8c5f1b44c3
2017-02-05 21:59:23 -05:00
Ashod Nakashian
386dc679a5 wsd: get system thread-id directly as not in Poco yet
Change-Id: I49ba23b6cd50c2d9058e9803d7f65ec41277297b
Reviewed-on: https://gerrit.libreoffice.org/33890
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-02-03 16:01:52 +00:00
Ashod Nakashian
d7a9a76ddb wsd: report PSS of kit processes
Each Kit process now reports its own PSS,
which is much more accurate as they share
a significant ratio of their pages with
one another.

Admin tracks the PSS values of the Kits
and reports to the console.

Change-Id: Ifa66d17749c224f0dc211db80c44f7c913f2d6c4
Reviewed-on: https://gerrit.libreoffice.org/33864
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-02-03 07:12:31 +00:00
Ashod Nakashian
cd4e8205cf wsd: add getTokenInteger to Message
Change-Id: I2c145aa088082ef056b92c9864b34d8cc2f737cd
Reviewed-on: https://gerrit.libreoffice.org/33861
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-02-03 07:08:16 +00:00
Ashod Nakashian
cd85d8a7f1 wsd: improved protocol helpers
Change-Id: I434fd9d6bb3248a8b9c27bb6c8565369c95786b5
Reviewed-on: https://gerrit.libreoffice.org/33860
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-02-03 07:07:38 +00:00
Ashod Nakashian
c22e69e9e6 wsd: correct logging of thread ID in log entries
Change-Id: I10aaeeea8df2757362482a405b7525542d150178
Reviewed-on: https://gerrit.libreoffice.org/33857
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-02-03 07:05:06 +00:00
Ashod Nakashian
0d4d506ea3 wsd: faster jail directory cleanup
Around 1.5x faster than Poco,
which first enumerates files into
a container, then iterates over
them and stats before unlinking.

Here we enumerate and unlink in
a single pass.

Change-Id: I79d1c0f1b5ec557ccc4f0e2ec7a0609051d8d212
Reviewed-on: https://gerrit.libreoffice.org/33680
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-30 05:10:09 +00:00
Ashod Nakashian
1ba7c0209a wsd: cosmetics
Change-Id: I58a9e579e228d7b4a1e1b5686988aeff8da9922f
Reviewed-on: https://gerrit.libreoffice.org/33674
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-30 02:11:13 +00:00
Jan Holesovsky
9d4eab1aba Re-introduce the TileQueue depth logging.
Change-Id: I025aa9745d1b0a3306930323764957c6d84a0966
2017-01-27 18:32:01 +01:00
Jan Holesovsky
545e2a2abe Fix a size check.
Change-Id: I509d12dcde6f56a2a7a9ee244e721d8028dec501
2017-01-26 11:49:29 +01:00
Jan Holesovsky
c44f7b8a76 Revert "loolwsd: improved MessageQueue"
Now we don't get a situation where there would be a tremendous amount of
invalidates & tile render requests piled in the queue, so we can do it
deterministic again.

The only thing that could potentially pile in the queue are the keypresses
events sent from the clients, but that is a different problem anyway.

This reverts commit c326228774.

Change-Id: I98e199eab0187bf5f47ce322ac1b1b2e3b976b85
2017-01-26 11:49:29 +01:00
Jan Holesovsky
3c9f4e1e1f Deduplicate & remove obsolete invalidations from the queue.
There's no point in trying to paint something we know will be obsolete anyway.

Change-Id: I14f61f389b114f2cda1f97e5223b31fa2f01b06c
2017-01-26 11:49:29 +01:00
Jan Holesovsky
f77253f4f8 Deduplicate the .uno: command state changes too.
Change-Id: Iaf9204d39d90cb9289d279e35a4609fa68c2cce8
2017-01-26 11:49:29 +01:00
Jan Holesovsky
1b9e34a3f9 Squash the invalidation messages coming from various view into one.
Change-Id: I65f7e4eb0b82a8c76eef372548ad3298ac70bdd7
2017-01-26 11:49:29 +01:00
Jan Holesovsky
60a3d717cb Remove obsolete cursor positions from the message queue.
Change-Id: Ie54aa4a475f0a55baaf6a40a99ed341c8f941a04
2017-01-26 11:49:29 +01:00
Ashod Nakashian
9fe2d93228 wsd: Message now supports parsing forwarding prefix
Change-Id: I2826a2df5136628b86421afb93e3b95fbc3ba45a
Reviewed-on: https://gerrit.libreoffice.org/33438
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-26 02:10:07 +00:00
Ashod Nakashian
acc029a411 wsd: autodetect message type
Change-Id: I0f3ab61867ea067f24050acb15660fa93fc7bbb5
Reviewed-on: https://gerrit.libreoffice.org/33437
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-26 02:08:23 +00:00
Pranav Kant
8c5028de05 fix build for poco 1.7.5
Change-Id: I9636a7dd63c714bdd375d19af3eec0677c6d47fc
2017-01-23 13:04:03 +05:30
Ashod Nakashian
bb4733b6d6 wsd: Message::abbrevation -> abbr
Change-Id: If8cab421808689ba4f5ba6a75a960d6b64755b4b
Reviewed-on: https://gerrit.libreoffice.org/33429
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-23 05:48:15 +00:00
Ashod Nakashian
f1de0d0481 wsd: MessagePayload -> Message
Change-Id: Ie65f7c707785dbbf85a2f98abf082fbc3ee7a64b
Reviewed-on: https://gerrit.libreoffice.org/33428
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-23 05:47:03 +00:00
Ashod Nakashian
6b17f96318 wsd: refactor MessagePayload into own file
Change-Id: Ifc0d2abd2e94d4a1b58915664fb0545dca6e96cc
Reviewed-on: https://gerrit.libreoffice.org/33427
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-23 05:45:23 +00:00
Ashod Nakashian
27e1428088 wsd: batched user-input processing
User input is batched together to reduce
overheads. This initial implementation
will batch all input of the same type
together.

Change-Id: Ia0069de9cf5acecf637941543267f86518c04640
Reviewed-on: https://gerrit.libreoffice.org/33422
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-23 05:36:48 +00:00
Ashod Nakashian
f3a85a7bf0 wsd: MessageQueueBase support no empty items
Throw when empty payload is enqueued
and return empty payload on get timeout
(instead of throwing).

Change-Id: Iab5df775caa46d5c212d0850645cda6cca16f20b
Reviewed-on: https://gerrit.libreoffice.org/33421
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-23 04:39:28 +00:00
Ashod Nakashian
25be7f0ab6 wsd: use own tokenizer
Change-Id: Ia6e58767e3a138d086d4e0ae287782d3ed558076
Reviewed-on: https://gerrit.libreoffice.org/33418
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-23 04:37:21 +00:00
Ashod Nakashian
ffe092f5ce wsd: log cleanup
Change-Id: I569f7a81fa80686810c4d5aa65e03b02be189db7
Reviewed-on: https://gerrit.libreoffice.org/33417
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-23 04:34:38 +00:00
Ashod Nakashian
b9c900d459 wsd: format the time directly in the log prefix
Change-Id: I6ad5faf8fdfa16831863bf4b8fa0568e88d0d0f8
Reviewed-on: https://gerrit.libreoffice.org/33416
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-23 04:33:09 +00:00
Miklos Vajna
4b980530e5 common: remove unused using declaration
Change-Id: I51d4d1f555ed5508370e4b9a7b8f04f266a2ca4a
2017-01-17 09:58:50 +01:00
Tor Lillqvist
32b92dcd91 Bin default values for parameters that were defaulted at just one call site
Change-Id: I965b0be1ad4f706a06d06d5c6c3f940c1b3cc33c
2017-01-16 14:05:10 +02:00
Tor Lillqvist
79e08f3de2 Drop parameter that always was defaulted anyway
Change-Id: I6eee99db120e8a4aeb0e27586390bdc1bad9e219
2017-01-16 12:59:03 +02:00
Ashod Nakashian
373b464645 wsd: logs and cosmetics
Change-Id: I67b0a929a50b05cd44de056ce6f8baafb8574dbf
Reviewed-on: https://gerrit.libreoffice.org/33130
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-16 02:09:41 +00:00
Ashod Nakashian
b1ff72e13f wsd: move shutdown web socket helper into LOOLWebSocket
Change-Id: Ide377fe3a8c950490bb6c04382464f0fdfd66088
Reviewed-on: https://gerrit.libreoffice.org/33129
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-16 02:08:28 +00:00
Ashod Nakashian
b8160c1c1a wsd: return 0 when fail to proc get memory
Change-Id: Ie7f0fdc031a71c76484705cfb2feee1744bbbd8b
Reviewed-on: https://gerrit.libreoffice.org/33119
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-16 01:49:07 +00:00
Jan Holesovsky
4416c836d0 Log the time in wall-clock time, instead of since the process start.
Otherwise we are getting completely confused times - various processes start
at various times, so for one process the epoch start can be eg. 20 minutes
later than for the other.

Change-Id: I6d87e98682a5fcd0348a584cf66f7ffa5813ca66
2017-01-13 16:14:13 +01:00
Tor Lillqvist
b8897ea295 Avoid pointless breaking up of the one same Util namespace in parts
Also, indent the nested rng consistently.

Change-Id: I551c8d0faa78446edf6cad746ca0f9193096f3aa
2017-01-13 14:55:01 +02:00
Tor Lillqvist
11ae90cfcb No Hungarian notation please
Change-Id: Ia624de45a792db7e39f2245aaea7d940b30b0db2
2017-01-13 14:52:08 +02:00
Tor Lillqvist
04bdf8d623 Bin unused code
Change-Id: I71b7a5f8d769e033b489ae5ea0fbd4425db2184e
2017-01-13 14:14:36 +02:00