Commit graph

341 commits

Author SHA1 Message Date
Pranav Kant
587c0e5222 loolwsd: Forward 'color' property in 'viewinfo' message to client
Change-Id: Id7d28a46cacd662aeb371805509e5a81b90b9c90
2016-10-10 13:02:22 +05:30
Ashod Nakashian
e0ff6eef6b loolwsd: kill Connection object in child
Change-Id: Ic4d0d3e7286272a0765b299824dfa3556fe56f4b
Reviewed-on: https://gerrit.libreoffice.org/29652
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-10 06:32:30 +00:00
Ashod Nakashian
e33eff4abd loolwsd: cleanup of Connection in ChildSession
Change-Id: I07636163df7b2973dada55b9704abf7105ad285f
Reviewed-on: https://gerrit.libreoffice.org/29651
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-10 06:32:12 +00:00
Ashod Nakashian
4fa7e53eae loolwsd: unload child view when client disconnects
Using a new internal command, when a client disconnects
an internal 'disconnect' message is dispatched so
the child process cleans up the ChildSession in question.

Change-Id: I34166ad59e84ae389a3913bd2430fe537225bb4b
Reviewed-on: https://gerrit.libreoffice.org/29650
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-10 06:31:48 +00:00
Ashod Nakashian
128cd73154 loolwsd: send child messages to client via unified wsd-kit WS
Change-Id: I237120e5a81a2e6d8772a2b6f1e98b1ba567f97e
Reviewed-on: https://gerrit.libreoffice.org/29647
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-10 06:29:32 +00:00
Ashod Nakashian
22a5db2fc0 loolwsd: trim forwarded messages to avoid leading whitespace
Change-Id: I932baf3ec41789d89bf897fcbf25a1ee1d27f89d
Reviewed-on: https://gerrit.libreoffice.org/29646
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-10 06:29:20 +00:00
Ashod Nakashian
38cbfa96b0 loolwsd: forward client message to child via the process WS
Change-Id: I368e727b79b44b509ba49ed30218b8368c5eaad8
Reviewed-on: https://gerrit.libreoffice.org/29637
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-10 06:23:51 +00:00
Ashod Nakashian
3963382913 loolwsd: forward child messages to the respective ChildSession
Change-Id: Ib1e0c51effd046a2f0d0e5708c501b6414caa81a
Reviewed-on: https://gerrit.libreoffice.org/29635
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-10 06:22:28 +00:00
Tor Lillqvist
735713bfb4 The withColor parameter to Log::initialize() is bool
So passing a char* that never is null meant it will always be
automatically converted to true, which is not useful.
2016-10-07 11:53:07 +03:00
Miklos Vajna
3f0def0b02 Avoid 'auto' for getenv() result
Which is sometimes stored in a bool, but when auto is used, it's char*,
so it helps to have that written explicitly.

Change-Id: I561692e8d5c575b4ff8612fd50e489ad3c60d655
2016-10-07 10:20:13 +02:00
Henry Castro
b60f596a64 loolwsd: avoid getenv() nullptr
what():  basic_string::_S_construct null not valid
2016-10-06 15:02:13 -04:00
Michael Meeks
39b2c725d9 Improve and standardize version details: display on start. 2016-10-06 11:18:50 +01:00
Ashod Nakashian
5b3e5f73a2 loolwsd: trade view creation and assert lock ownership
Change-Id: Ib593bec4d6e6b810d5f6cfb4bdf7d3f1212709b4
Reviewed-on: https://gerrit.libreoffice.org/29549
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-06 05:58:11 +00:00
Ashod Nakashian
c542fde244 loolwsd: factor out getViewIds and broadcasting
This minimizes unlocking and relocking
on the LOK Document.

Change-Id: Ibe5045c82008df907dc329c1530cb50138b0c211
Reviewed-on: https://gerrit.libreoffice.org/29545
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-06 05:54:54 +00:00
Ashod Nakashian
ce832fbc11 loolwsd: get the invalidated part from the callback directly
By default LOK doesn't provide the part where the invalidated
tile is. The part # is found using API, but due to the fact
that callbacks are processed asynchronously, the part #
may well have changed by the time the invalidation is
processed. This could result in buggy invalidations
where no modification took place.

With the new API flag LOK_FEATURE_PART_IN_INVALIDATION_CALLBACK
the part # is included in the callback, which is parsed
and used to inform the client with the correct part #.

Change-Id: Ibd85764bfdc41ebf1aae490df335bd503284ae91
Reviewed-on: https://gerrit.libreoffice.org/29467
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-03 05:32:45 +00:00
Miklos Vajna
38577b74fd Refactor to be able to unit-test Document::ViewCallback()
Change-Id: If07eb89e5d2f45737a8af10803511ab2ee3a07b3
2016-09-30 15:42:50 +02:00
Miklos Vajna
3090981c8a Document repair: expose user names, not only view IDs
Also in leaflet replace the current user with "You" to be consistent
with the statusbar.

Change-Id: If2d76f078eeae3038f8ae17506ae7679f7b23023
2016-09-30 14:21:14 +02:00
Tor Lillqvist
96e6ad7502 Re-think disk full handling
Instead of trying to inform the sysadmin (which we did not yet try to
do in any meaningful way), inform all connected clients (even those
editing other documents).

We use 'error: cmd=internal kind=diskfull' as the message to the
clients. The loleaflet code needs to be updated to handle that
carefully by displaying a very prominent message that tells the user
that all bets are off.

Also add a unit test for the functionality.

Document the new protocol details.

The code for this alert functionalty became a bit less elegant than I
like because of the way we include Util.cpp in the unit test 'test'
program.

Still need to add code to check for disk full in more places, not just
when saving a cached tile or font. Probably we should even actually
check for disk space on the file system(s) we use getting alarmingly
low, not just check for file writing operations that fail. Later.
2016-09-29 00:23:14 +03:00
Miklos Vajna
31867f669d Fix remaining uninitialized members
The missing init of mutexes is probably theoretical, the TraceFile and
the Unit ones were real errors, I think.

Change-Id: If19c23a9c93d34059998346af8d45c26a34043a6
2016-09-28 10:20:48 +02:00
Miklos Vajna
fed97b97a7 LOOLKit: remove unused unsing declarations
Change-Id: I6a0efca4dd87694aaa3d32500a56c3a5d246b028
2016-09-27 09:46:24 +02:00
Tor Lillqvist
fa697d843e Remove reference to non-public bugzilla 2016-09-27 09:29:18 +03:00
Tor Lillqvist
e0c5f26015 bccu#2035: Work around crash by just exiting before it happens 2016-09-26 17:31:49 +03:00
Ashod Nakashian
5daf4ab341 loolwsd: don't process callbacks or queue messages if terminating
Change-Id: I1ff75d01a0f24ba3b9d7ca2003f1633d0aa494e0
Reviewed-on: https://gerrit.libreoffice.org/29288
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-26 02:50:51 +00:00
Jan Holesovsky
61b0ad4933 Fix a race between the tile rendering and invalidation callbacks.
Instead of 2 queues and 2 threads, merge those to one - which gives a perfect
ordering of the invalidations and rendering.

Change-Id: I229dfc08b43e6ce7e4f08ea8059d3298d9bf8f8a
Reviewed-on: https://gerrit.libreoffice.org/29282
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-26 02:44:19 +00:00
Ashod Nakashian
b8317e7b34 loolwsd: lokit process logs to file if configured
Pass the log-to-file config to the kit processes
using envars.

Change-Id: Ida79c35ab02d8038685153805be780359bfbe97e
Reviewed-on: https://gerrit.libreoffice.org/29161
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-22 03:33:26 +00:00
Ashod Nakashian
1641f756b2 loolwsd: improved logging
Change-Id: I1a1559754efcb0614875dc76ae0637ed6dc1ba77
Reviewed-on: https://gerrit.libreoffice.org/29160
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-22 03:32:48 +00:00
Pranav Kant
46107dd0c8 loolwsd: Always send the updated view info to clients
This replaces addview/remview/remallview messages in the protocol
with 'viewinfo' message which is sent whenever there is any
change in the view information.

Let the client deal with what information is redundant to it.

Change-Id: Ic470ea88a94ff281a0ae021014a9fba1b876f648
2016-09-21 12:02:27 +05:30
Ashod Nakashian
0326aa4304 loolwsd: cancel individual tiles
Change-Id: I18faee319fc12de2151460afbb054b8509578579
Reviewed-on: https://gerrit.libreoffice.org/29120
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-21 05:15:30 +00:00
Ashod Nakashian
e9f37433d7 loolwsd: combine tiles before rendering to reduce latency
Change-Id: I5af2d2a9ddf3b5a3db5bc5f0835687d7cae5b17c
Reviewed-on: https://gerrit.libreoffice.org/29115
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-21 04:59:49 +00:00
Ashod Nakashian
3b2055a0a8 loolwsd: remove the callback descriptor after destroyView
On destroyView Core must flush the events queue, otherwise
by the next idle the descriptor will be gone and we'll
be using freed memory.

Change-Id: I6d3d8f9461bc156383a7294e9c65c535d79f2e7a
Reviewed-on: https://gerrit.libreoffice.org/29088
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-20 11:58:20 +00:00
Tor Lillqvist
90c7b553ed Don't erase the CallbackDescriptor record before turning off callbacks
Seems to fix the deadlock problem, or at least makes it very much
rarer. (I am not entirely certain that a callback might not be in
progress already (in another thread) when we turn off callbacks, and
in that case the callback might still then access freed memory?)
2016-09-20 13:32:43 +03:00
Ashod Nakashian
a9fbfe8d8a loolwsd: remove queue thread from child socket handler
Change-Id: Ib6b4890db1f331b2e2cdcfafb57366ff62e3a13d
Reviewed-on: https://gerrit.libreoffice.org/29067
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-20 03:31:31 +00:00
Ashod Nakashian
23ef612970 loolwsd: ensure that the connection thread is running
If the connection thread is not running when loading a
document, the callback will drop events. This can happen
when the thread is too slow to spawn, but we return from
the createSession function and process client messages.

This should solve the race where we lose notifications of
other views when a new view is created.

Change-Id: Ia79739889b2f01fbb374d48eb33620084f4ed1c1
Reviewed-on: https://gerrit.libreoffice.org/29063
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-20 03:25:16 +00:00
Ashod Nakashian
bad8ae9ed9 loolwsd: one anonymous namespace per file is enough
Change-Id: I12b4967a321de45fc50ad314775d01499b5edd80
Reviewed-on: https://gerrit.libreoffice.org/29061
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-20 03:21:18 +00:00
Miklos Vajna
ea274bcf6b Document::ViewCallback: don't fail on EMPTY cell cursor
Change-Id: I67bee2a1f1332bfb82963e0fb3a0e761054f826e
2016-09-19 16:04:23 +02:00
Ashod Nakashian
7fff960391 loolwsd: stop the tile-queue when exiting
Change-Id: I49276c9639e8826d145a31eb476b41eb64baf88a
Reviewed-on: https://gerrit.libreoffice.org/29009
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-19 12:03:57 +00:00
Ashod Nakashian
f0c09238ce loolwsd: fail fast rather than catch all
Change-Id: Ib38924bf823315d211eb467d90f364fdc225ba2e
Reviewed-on: https://gerrit.libreoffice.org/29005
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-19 11:59:23 +00:00
Tor Lillqvist
df3cc99025 Don't require the LOK_VIEW_CALLLBACK env var any more
Act as if it was always set.

The ChildSession::_multiView field will always be true, so factor it
out. Ditto for Document::_multiView.

The ClientSession::_haveEditLock will also be always true, so factor
it out. This means the ClientSession::isEditLocked() will always
return true, so factor it out, too.

ClientSession::markEditLock() always will always set _haveEditLock to
true (which it will be from the constructor already anyway) so it can
be removed.

ClientSession::setEditLock() does not need a parameter as the
parameter was actually only used for misleading logging. The msg
variable constructed in the function used isEditLocked(), not the
parameter.

We still generate and handle editlock messages. Not sure whether that
makes any sense, though.
2016-09-19 12:13:00 +03:00
Henry Castro
7243e485d0 loolwsd: assign view id after loading
When session, it is not assigned, ViewCallback thread
will not enqueue the message
2016-09-17 18:13:05 -04:00
Henry Castro
722ca5daf5 loolwsd: log: warn lost messages 2016-09-17 18:12:44 -04:00
Miklos Vajna
3d27e285b6 lok::Document: rename getViews() to getViewsCount()
Adapt client code to the changed core.git API.

Change-Id: I752d27919b7983909c8e96900115cca26bac11c6
2016-09-16 12:32:19 +02:00
Marco Cecchetti
80153826db Revert "loolwsd: we use callbacks latch for not missing messages sent very early"
This reverts commit ed983f17cb.

Conflicts:
	loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKit.h

Change-Id: Ia85b4d9223e9918dd33a66b8d6aeb0c3a1516a3c
Reviewed-on: https://gerrit.libreoffice.org/28904
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-15 13:23:39 +00:00
Ashod Nakashian
ad6d77cd3b loolwsd: remove cursor of unloading views
Change-Id: I4281a5aa101f034007aa227bb18b14eeba806ea0
2016-09-14 23:19:56 +01:00
Ashod Nakashian
2db1db06c7 loolwsd: queue -> tileQueue
Change-Id: If61de6807fa7f52a703fe45948df911fe162f69a
2016-09-14 23:19:45 +01:00
Ashod Nakashian
ece87da287 loolwsd: tile prioritization per view cursor
Change-Id: I1410b64982ac2db04e5a47d744a95b8d2eab5f7e
2016-09-14 23:19:38 +01:00
Miklos Vajna
6006e22001 LOOLKit: use std::move() in Document ctor
Change-Id: I25aeb5285465385858180747f441a69b858c4fe6
2016-09-12 08:15:37 +02:00
Marco Cecchetti
ed983f17cb loolwsd: we use callbacks latch for not missing messages sent very early
- lok::Document::setCallbackLatch: used on doument loading for
set/unset the latch

- now cell cursors of other views are correctly notified to the new
view
2016-09-10 21:28:11 +02:00
Marco Cecchetti
edc1302f16 Revert "loolwsd: we use callbacks latch for not missing messages sent very early"
This reverts commit f2106157f3.
2016-09-10 20:51:59 +02:00
Marco Cecchetti
f2106157f3 loolwsd: we use callbacks latch for not missing messages sent very early
- lok::Document::setCallbackLatch: used by a child session for
set/unset the latch

- lok::Document::registerCallback has a new boolean parameter used for
setting the latch state just before the callback is actually
registered for a (new) view

- now cell cursors of other views are correctly notified to the new
view
2016-09-09 22:23:51 +02:00
Pranav Kant
33a5c4bc70 Fix comment
Change-Id: Ib43bcc7378590e71b98856c11218fd99ad90d32d
2016-09-07 21:47:11 +02:00