Commit graph

67 commits

Author SHA1 Message Date
Pranav Kant
1c9e4f57d5 loolwsd: Include UserId in 'viewinfo' response
Change-Id: Ia467086343ff2308f80d873dfe0a617733036a2e
2016-10-26 21:10:15 +05:30
Ashod Nakashian
5802d7e8a1 loolwsd: show disconnected usernames in the document repair
By retaining the view-ID to username mapping of disconnected
users we are able to show a disconnected username in the
document repair dialog.

Change-Id: Id08790de31f92653381b6a1525caf044bd875479
Reviewed-on: https://gerrit.libreoffice.org/30216
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-23 21:20:54 +00:00
Ashod Nakashian
85c1a0d868 loolwsd: no warning for a fairly common case
Change-Id: Ic461de074295eda4f15b6b7a8f787fc2624908ce
Reviewed-on: https://gerrit.libreoffice.org/30193
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-23 20:59:43 +00:00
Ashod Nakashian
b44d71f0ae loolwsd: no need to create prisoner WS anymore
Change-Id: Iaebac49f47353a6848fd2232a1838e4eaadaeefc
Reviewed-on: https://gerrit.libreoffice.org/29937
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-16 22:04:31 +00:00
Ashod Nakashian
2ca592d0ac loolwsd: log the username, Core View-ID, and WSD Session-ID together
This helps debugging and tracing issues as this single log
entry links the three most important pieces together:
the user, how Core references the user's view to a
given document, and how WSD references the same.

Change-Id: I7bf88504b43eed85d40e6f8bc9c3bad713f372da
Reviewed-on: https://gerrit.libreoffice.org/29935
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-16 22:02:07 +00:00
Ashod Nakashian
23a2d2261e loolwsd: fix regression in rendering of Writer
Writer has only one part for rendering purposes (0).

With the new API that includes the part number in
the INVALIDATE_TILES event, the part number must
be 0, otherwise, there will not be anything to render.

Unfortunately Core issues part number == page number,
which we overwrite with 0 in Online.

Change-Id: I842fdd2f50021334dcd3fa47c0b1c9df34d8c5e1
Reviewed-on: https://gerrit.libreoffice.org/29605
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-08 04:41:51 +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
Pranav Kant
aa674fbdbd loolwsd: Set view id before calling documentStatus
... otherwise in some cases viewid that is set internally in core
is different from the one which is being loaded resulting in an
incorrect status message which then leads to lot of other problems as
well.

Change-Id: I8488d7d54b211a6b6f6028128f8dfc3388b73efd
2016-10-05 17:08:40 +05:30
Pranav Kant
d5fdb210aa loolwsd: Kill unused code
Change-Id: I7c8d16ce2358ca9ab41fcc57a8e9b9241b240150
2016-10-05 17:08:40 +05:30
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
Marco Cecchetti
5edb4cb8c4 loolwsd: Calc: core and client could be on 2 different tabs
The check for the current part was done before set view on core to the
one of the sender message

Change-Id: If4b9264c981ecc4e858d23366045e42be603c7c4
2016-10-01 20:07:39 +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
Ashod Nakashian
71dfb9f7b7 loolwsd: localise locking in ChildSession
Avoid using the static mutex and instead use
the loKitDocument mutex when accessing the
latter. The static mutex is used only when
accessing the document manager. That is,
only when loading and unloading a document.

For ChildSession members that may
be accessed from both the callback and
incoming web-socket, guard them with the
member mutex.

Finally, move any local data manipulation
outside of locks altogether.

Change-Id: I046906bc6ed7e0b38c309f97836b38e27f9bfc8e
Reviewed-on: https://gerrit.libreoffice.org/29336
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-28 03:28:26 +00:00
Pranav Kant
2579e1191c loolwsd: Prevent passing a nullptr to std::string()
Undefined behavior.

Change-Id: I2ddcb0a5cba1d593791ced62783d02e732162d17
2016-09-23 16:15:46 +05:30
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
8f213bc170 loolwsd: canceltiles re-designed using tilecache instead of queue
Reviewed-on: https://gerrit.libreoffice.org/28526
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
(cherry picked from commit 571ff06906)

Change-Id: Ie8f2c87a705aac14dd6f139c384f000df98db909
Reviewed-on: https://gerrit.libreoffice.org/29117
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-21 05:13:18 +00:00
Miklos Vajna
ef4ca0507a loolwsd: remove takeedit and editlock commands
As a follow-up to commit 77e219ceff
(loleaflet: Kill editlock code, completely, 2016-09-20).

Change-Id: I48a58bb738c0939f99d220eca7a8fd3f4c3debe4
2016-09-20 09:47:25 +02:00
Pranav Kant
1fbceb9f68 loolwsd: Forward REDLINE_TABLE_ENTRY_MODIFIED messages
Change-Id: Ib666c1ebf9165c795fcefb56a2ea3919d60c8ac4
2016-09-19 14:48:27 +05:30
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
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
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
Ashod Nakashian
16605b9289 Revert "loolwsd: canceltiles re-designed using tilecache instead of queue"
This reverts commit 571ff06906.

Change-Id: Icf9caeafc640b815f64211f240cfdac8e91694a1
Reviewed-on: https://gerrit.libreoffice.org/28595
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-09-01 12:37:47 +00:00
Ashod Nakashian
571ff06906 loolwsd: canceltiles re-designed using tilecache instead of queue
Change-Id: I4b9ba91ee08bc9dd8d27df275e303f5517d9740c
Reviewed-on: https://gerrit.libreoffice.org/28526
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-08-31 04:44:56 +00:00
Pranav Kant
7d48cd6f17 loolwsd: Echo back view information to clients
View information as of now includes viewid and username
associated with the view.

Change-Id: If0c4957eb56962eb4b1b1d0c1189dc300fa6b857
Reviewed-on: https://gerrit.libreoffice.org/28482
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2016-08-30 07:45:47 +00:00
Pranav Kant
67444eeb80 loolwsd: Pass sessions' usernames to core
Change-Id: I8c81c02fafd2cb9d0048729401e082bb422e299b
Reviewed-on: https://gerrit.libreoffice.org/28481
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2016-08-30 07:45:37 +00:00
Tor Lillqvist
4409ccd222 Don't crash if there is no "rendering" in the options JSON of the load message 2016-08-29 17:22:35 +03:00
Pranav Kant
c67c85793b loolwsd: Inform opening view about existing views
Change-Id: I84de6f78ffa21f3018e987e9e0bfeafd0cfb2b52
2016-08-29 18:37:57 +05:30
Henry Castro
fa2a99459f loolwsd: add fake .uno:DocumentRepair
Avoid double round trip requesting command value pair
.uno.Redo, .uno:Undo
2016-08-28 09:03:45 -04:00
Ashod Nakashian
960e0521bc Formatting
Change-Id: Iad77e0f69cdb186da35cf3b2d1c0e9020df31870
Reviewed-on: https://gerrit.libreoffice.org/28407
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-08-26 12:46:51 +00:00
Pranav Kant
178808f989 loolwsd: Notify other views when new view is added
... but no need to notify the one which is just added.

Earlier behavior was notifying only the one which is just added,
which is redundant as same is accomplished by 'status' message.

Change-Id: Ib09424d186c49527b7b9c36fdabf90c31518ee04
Reviewed-on: https://gerrit.libreoffice.org/28395
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-08-25 18:26:31 +00:00
Ashod Nakashian
0d395f18b5 loolwsd: cleanup of ChildSession
Change-Id: I63bd6ff24a54b0ba3e0361ea385bf866f98faf76
Reviewed-on: https://gerrit.libreoffice.org/28306
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-08-22 05:49:45 +00:00
Ashod Nakashian
4b28a9a4fc loolwsd: forward redline table update notification event to the UI
Change-Id: I45df2a1aaf826301a113f8cf0a8c609d46b794a7
Reviewed-on: https://gerrit.libreoffice.org/28304
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-08-22 05:46:37 +00:00
Ashod Nakashian
a28b832309 loolwsd: proper ChildSession cleanup
ChildSession cleanup is tricky because it needs
to be cleaned up when the connection is dropped.
The ChildSession itself needs to initiate this
cleanup from Document.

A new approach simplifies the design and correctly
broadcasts remview to all other connections so
they would be able to cleanup visual elements.

Change-Id: I78fd01fb42b801913534c858324c16dd7ad6451d
Reviewed-on: https://gerrit.libreoffice.org/28302
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-08-22 05:44:24 +00:00
Ashod Nakashian
eb38d7697b loolwsd: don't unload views not loaded yet
Change-Id: Iee676849cc2b9ac4f0e518e5730e921687c3a42d
Reviewed-on: https://gerrit.libreoffice.org/28286
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-08-22 04:22:34 +00:00
Ashod Nakashian
006a49007c loolwsd: sync re-activating views by replaying state messages
Change-Id: I0ce37ca75f10493a90107e93c253edf084a15f7f
Reviewed-on: https://gerrit.libreoffice.org/28284
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-08-22 04:13:54 +00:00
Pranav Kant
86891498a9 loolwsd: fix leftover confusing comment
Call to getStatus is gone in
2744caf97b, so there are no
"arguments" anywhere now.
2016-08-21 21:19:21 +05:30
Ashod Nakashian
daad00812d loolwsd: refresh views on UI re-activation
Change-Id: I78d04abe939a91e56cb06f89184e651e7946b28b
Reviewed-on: https://gerrit.libreoffice.org/28134
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-08-15 03:19:15 +00:00
Ashod Nakashian
5af1f18e36 loolwsd: convert function-object callbacks to abstract interface
Change-Id: Ia2e832659f8deddd55b8be6507c2d7406f110085
Reviewed-on: https://gerrit.libreoffice.org/28133
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-08-15 03:18:26 +00:00
Ashod Nakashian
fbcce1b803 loleaflet+loolwsd: new commands addview and remview
The new commands help the UI update the cursors and other
visual elements that track views and clients.

Currently, when remview is received loleaflet removes
the associated cursor from the screen.

Change-Id: I03e2f9e3485166adae31de84ae7ac6bd1c85b05d
Reviewed-on: https://gerrit.libreoffice.org/28131
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-08-15 03:15:01 +00:00
Ashod Nakashian
6af13994e6 loolwsd: cleanup and simplify
Change-Id: I48a841a3ce6638e33a96ed44c75e6d2e17dc1c37
Reviewed-on: https://gerrit.libreoffice.org/28125
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-08-15 03:10:29 +00:00
Ashod Nakashian
e3507552b7 loolwsd: one thread and queue per document
Each ChildSession had its own thread and queue,
which was an overkill. By moving the LOK callback
handler into Document and handling all events in the
same order that we receive them we reduce resource
consumption without affecting performance.

In fact, performance could improve by avoiding
unnecessary overheads.

Change-Id: Ic2bac0f08c28e91acabd512a704966c6b761fc7c
Reviewed-on: https://gerrit.libreoffice.org/28124
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-08-15 03:09:57 +00:00
Ashod Nakashian
58468c76be loolwsd: cleaned up ChildSession public members
Change-Id: I4bfc008859edb979688ece89d99af227ea3d0416
Reviewed-on: https://gerrit.libreoffice.org/28123
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-08-15 03:07:44 +00:00
Ashod Nakashian
10737fdeab loolwsd: payload as std::string
Change-Id: Icee8a16fd18489da87e22955f3126851261332e5
Reviewed-on: https://gerrit.libreoffice.org/28120
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-08-15 03:05:53 +00:00
Ashod Nakashian
2744caf97b loolwsd: simplify status after load
Change-Id: I919e09616173d88eda8989e06da05ae54c0bdda0
Reviewed-on: https://gerrit.libreoffice.org/28119
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-08-15 03:05:02 +00:00
Pranav Kant
9f1070ded7 loolwsd: forward notification for LOK_CALLBACK_VIEW_CURSOR_VISIBLE too 2016-08-03 19:50:25 +05:30
Ashod Nakashian
7826d85832 loolwsd: forward new notifications
Change-Id: I434545a5edb48f957d0e03c02040cc25644f67c4
Reviewed-on: https://gerrit.libreoffice.org/27586
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-07-27 15:59:07 +00:00