Commit graph

832 commits

Author SHA1 Message Date
Michael Meeks
b7d7c02a3f deltas: allow JS tilecombine to force sending a keyframe to the client.
However, don't force rendering a keyframe, only sending it - other
clients may be happy with deltas. This is to better handle:

window.app.console.debug('Unusual: Delta sent - but we have no keyframe for ' + key);

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I4efff0f6b1d2817e6b8bd567eb3b098383a1ef42
2023-07-17 11:35:25 +02:00
Rash419
8c5d822dc9 android: fix: save failed error while parsing save command
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Ia6a53184322f403d2b995213700193d5612fd63d
2023-07-15 20:33:18 +05:30
Michael Meeks
9a29a346d8 Allow tilecombine's to send oldWid information to fetch deltas.
Disable the 'forceKeyFrame' for tilecombine messages from the client,
we have a larger cache now and it makes sense to honor and track these.
forceKeyFrame was signalled with a zero oldWireId - which is the default
if we don't have it set.

Change-Id: If96423e96f8dc578a634ed5093517dfa6702cc1b
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-07-13 08:14:48 +01:00
Ashod Nakashian
752f2a4ae1 wsd: save and upload rapidly when unloading
We normally throttle saving and uploading to
avoid hammering repeatedly, but when unloading,
we reduce said minimum wait by a factor of 10.

This allows for a quicker unload cycle, esp.
if we had just saved before unloading, or
if there was a previous failure.

Change-Id: I8710c9b86c05254ad9b9735d8496dd96900221e2
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-07-12 07:00:41 -04:00
Ashod Nakashian
2fd159bc0c wsd: better always-save-on-exit handling
Change-Id: Id718f81fc2eb0af5ca5bfe61e687de5258dbdd7d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-07-12 07:00:41 -04:00
Ashod Nakashian
75b1cbcb11 wsd: better detection of upload skipping for save-on-exit
Change-Id: I0b8c6dc7429587cddff6304aaf501f24af896602
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-07-12 07:00:41 -04:00
Ashod Nakashian
68e20add3b wsd: better data-loss detection
Had to disable a crash test due to incorrect
modification check before unloading.

Because we think there are modifications to
the doc, we issue a save, which will fail
because the kit is killed in said test.

Will be re-enabled when isPossiblyModified
is improved.

Change-Id: I0dd7931308e66e9a12d891a979d54e3f373ef99b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-07-12 07:00:41 -04:00
Ashod Nakashian
0a969e5006 wsd: better modification detection after saving
And now UnitSaveOnExitUnmodified verifies that
we do not unnecessarily upload unmodified
documents because always-save-on-exit is set.

Always-save-on-exit is meaningful only when there
are modifications. Otherwise, we create identical
copies as separate revisions.

Change-Id: I933069d31d3d273c41734b58e0849680566e591a
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-07-12 07:00:41 -04:00
Ashod Nakashian
f383cf9032 wsd: always-save-on-exit skips uploading as-loaded docs
Change-Id: Id38c2b708d9d440cedb3d51b345bf180af0349f8
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-07-12 07:00:41 -04:00
Ashod Nakashian
acdd74f014 wsd: better session disconnection logic
This improves the disconnected session cleanup
and fixes a corner-case with the last editor
disconnecting before read-only sessions.

Change-Id: Iecb553d7f5be2c63fc55111e60e22b3d8aa668f6
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-07-12 07:00:41 -04:00
Ashod Nakashian
7fdc33b916 wsd: no default parameters for DocumentBroker::autoSave
Change-Id: Id343cc36886c2768b4af7ee61d9524678c83dc69
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-07-08 04:19:00 -04:00
Ashod Nakashian
12bae02ad0 wsd: separate out canSaveToDisk from needToSaveToDisk
Suppressing needToSaveToDisk silently when we cannot
save, because there is no Kit f.e., is unhelpful.

Now we have these two states separated out and
we log appropriate information in each case.

Change-Id: If38798578a7b88600e3f07c88e0bcbf833ae53f0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-07-08 04:19:00 -04:00
Ashod Nakashian
3fef73a33f wsd: DocumentBroker logging improvements
Change-Id: I9c6f32c087275f48ac559c2fbb05d04da4e00a08
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-07-08 04:19:00 -04:00
Ashod Nakashian
7650d5e175 wsd: remove redundant cast
Change-Id: I0cac85728cd4ade5d78b2a4cb715d0fdde17c832
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-07-08 04:19:00 -04:00
Caolán McNamara
01165fbe1f On a cache hit for a tile the result typically had a wireId of 0
And tile::needsFetch on that result will always return true given the
default of invalidFrom of 0 and the comparison of
  return this.invalidFrom >= this.wireId || ...
so the tile return from the cache is unusable.

It is typical for a request not to have a wireId, if we don't use the
cache then doRender will send a timecombine result with wireIds set. But
if we use the cache here we send a response using the wireId of the
request.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I586406af86b0f503dfc204e20120cc8acebf5b8e
2023-07-05 11:49:34 +01:00
Michael Meeks
023a243982 De-confuse two different sendTiles.
Change-Id: Ib67093b9cb61ff7e856db5c8d98178c0afbdf555
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-07-03 20:27:07 +01:00
Ashod Nakashian
7824df4926 wsd: notify the client of loading errors
Change-Id: Ied18f6820a7c3ceb4cc29200111c4a73442d2808
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-30 21:45:40 +02:00
Ashod Nakashian
5fdc4f9623 wsd: better logging of document and session loading
Change-Id: I0cdf08bf711499e63f09c3db6f3f47e873eb3b59
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-06-30 21:45:40 +02:00
Rash419
d63bca3f8e admin: migrate document after saving
- controller used to send two messages first to save then
  once saving is done migrate the document
- now controller only sends one message, COOL handles
  unsaved document

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: Id4afe1f9a04ef99005d7f0dbd6246826ba82442b
2023-06-29 18:21:33 +02:00
Rash419
b717be603e implement document migration
- updated protocol.txt

Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I67a0515580979e15223ea084c835f5ed801ceb5e
2023-06-29 18:21:33 +02:00
Michael Meeks
455c377d29 wsd: double size of the delta cache.
Change-Id: I218c0fbdef6815a56bf8d4059bfcae186b32ebed
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-06-23 16:59:08 +01:00
Michael Meeks
12e0830b1b Kill canceltiles support completely.
This stopped working well a long time ago, and is already disabled
on the coolwsd side, so dung out the rest of the code & docs on this.

Change-Id: I2e0b73fe9780e16c3cc74ae3a38ae6b04434717a
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-06-22 09:35:22 +01:00
Patrick Luby
e381b9194e Implement minor changes suggested during review
Signed-off-by: Patrick Luby <plubius@neooffice.org>
Change-Id: Id25c8a9deec35b9ae74ed1cc8a9dcf88dc5486cc
2023-06-15 19:01:42 +01:00
Patrick Luby
57a9db5664 Replace preprocessor directives with C++ conditional check
UnitBase::isUnitTesting() and UnitWSD::isUnitTesting() to avoid
calling methods that crash on mobile.

Signed-off-by: Patrick Luby <plubius@neooffice.org>
Change-Id: Ie6bc2d238ac9e475b02ceef5809c55acc129dd52
2023-06-15 19:01:42 +01:00
Patrick Luby
12213d7ec5 Fix iOS build breakages by adding http::Request to iOS build
Still needed to add a bunch of #if !MOBILAPP to disable all of the
Online server's unit testing classes so that the iOS app won't crash
when opening a document.

TODO: the iOS app will not accept text input at all. Is some code
unexpectedly consuming message data sent over the mobile fake socket?

Signed-off-by: Patrick Luby <plubius@neooffice.org>
Change-Id: Ie874ee8e452188a7b4cdf6d5f87708e5ed9b0235
2023-06-15 19:01:42 +01:00
Caolán McNamara
fb9fe79d3d cid#318951 Uninitialized scalar field
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I20dc0f87f000a68e1c6a6304292e792953959099
2023-06-14 10:10:46 +02:00
Jaume Pujantell
87ad301dc1 fix a bug introduced in 418ffa3
Signed-off-by: Jaume Pujantell <jaume.pujantell@collabora.com>
Change-Id: I938e02db8ad6adc85d6464d3260dfc8c0bb7ca9a
2023-06-07 18:44:49 +02:00
Ashod Nakashian
7af95798df wsd: cleaner modification of private members
Now StorageBase::getFileInfo() is strictly
used for reading.

Change-Id: I0d412e7ef6e502ae8b1864131b6f174e44343273
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-22 09:34:29 -04:00
Ashod Nakashian
804bfa2e4e wsd: move PostMessageOrigin into WOPIFileInfo
This moves the logic to update the PostMessageOrigin
field in WOPIFileInfo to be done in the constructor.
And now getPostMessageOrigin() returns a const&.

Change-Id: I88936441edb58deb65d901db4baaf6311be3bdd1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-22 09:34:29 -04:00
Ashod Nakashian
9e798e9c12 wsd: wopifileinfo -> wopiFileInfo
For consistency.

Change-Id: Ia30b4e3c95e25691bb32d5007729a22f1eb05344
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-22 09:34:29 -04:00
Ashod Nakashian
155bc06e24 wsd: de-duplicate assertCorrectThread
This merges multiple implementations of
assertCorrectThread and simplifies its
usage.

Change-Id: I7be5dea62c6046fb0412d7f885fcbcc4b66e3fd9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-22 09:34:29 -04:00
Ashod Nakashian
9d07402bea killpoco: reuse URI encoding
Change-Id: If9bb48973c61ba56860aac273534fa4db67c9e6f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-22 09:34:29 -04:00
Ashod Nakashian
ddefe7a3bd wsd: logging
Change-Id: I0aa2345891c29bd97cd43cfcd2c5ecf0e4cfd2c4
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-22 09:34:29 -04:00
Ashod Nakashian
47f5d86dc4 wsd: simplify uploadToStorage calls
Change-Id: I5ed3ce09dae8b6176d806d0bb5994e56c182ac8b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-22 09:34:29 -04:00
Ashod Nakashian
9410189280 wsd: better detection of modification during a conflict
When we detect document change in storage, we have to
either prompt the user(s) to either reload from storage,
discarding their own changes, or force saving their
changes and clobber the version in storage.

However this implies that the loaded document was
modified. Because otherwise, we do reload the
document from storage, automatically.
This change improves the detection logic to take
into account not just the saved state of the
document, but also the upload state. That is,
if a previous modification was not uploaded yet,
then the user does have changes that they need to
consider to discard or save.

Change-Id: I5f03593bebc5b565fc19e78562896bcdcb6112e2
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-16 16:55:40 +01:00
Ashod Nakashian
337c98a0b6 wsd: improve rename action handling
This corrects the ending of renaming by
moving that logic only after we get the
async upload results (either success,
failure, or timeout).

It also cleans up a few cases, such as
not needing to special case renaming with
identical names. This ensures that
subsequent attempts are not ignored.

Change-Id: Ib7a432d8a3b6ef5448291763cd31cc844c997e7e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 15:29:50 -04:00
Ashod Nakashian
203cc2f97f wsd: quarantine: delayed construction of the quarantine instance
Since we need both the PID of the kit process and
the document name, it's easier to construct the
quarantine instance only when we have downloaded
the document.

Change-Id: I8b537122c4b10ae6e822a82fa6a75456d0eaaaff
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
6ab3bbbd09 wsd: quarantine: capture the document name
Change-Id: Id308a80e2d504d82e021e7333b78488dabbac687
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
0ccc182509 wsd: quarantine: provide the filename to quarantine
Utility classes/functions should not re-implement
any logic external to their function. The
path to the file to be quarantined is controlled
by other bits and QuarantineUtil is simply told
to quarantine the given file.

Change-Id: Iab351ccbf78953bb63f18c451321d34fe61f59b5
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
3825205042 wsd: quarantine: more encapsulation
Change-Id: Ifed497ad246fa9fb4a3d349aa579ce6e88793066
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
bd4589d142 wsd: quarantine: cleanup quarantined files when unloading cleanly
Change-Id: I1934bca783f94847c73e9c47d0e8c703dbe75a99
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
c658d0fb90 wsd: more accurate comment
Change-Id: I553c9b302e243cee15ab66e041a6fafe4adf41b8
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
171a3614d7 wsd: use helper where available
Change-Id: If5d1abdc4da6218e318a72d06eb2483c4348d349
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-10 08:46:11 -04:00
Ashod Nakashian
ff1657934a wsd: simplify log streaming
Change-Id: Id22de0bc06680f957e7475f142bcaf1131fdbdb9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-10 08:46:11 -04:00
Rash419
f7af990485 admin: added a seprate state for the uploaded document
- previously we set the Modified state in admin panel only when
  wsd successfully upload the document to storage
- modified state updation depends on core, it might happen that
  uploading is already done and successfull but we didnot get
  the modified state from the core which will show wrong modified
  status in admin panel

Change-Id: I014a8f92753fc6a93b37921d0f3cdce390bef35e
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
2023-05-04 11:35:07 +05:30
Ashod Nakashian
0f5e2c6570 wsd: track the storage attributes more accurately
We now track the storage attributes in three
distinct states. The first, when we issue an
uno:Save (called nextStorageAttrs), when we
get the save response (called
currentStorageAttrs), and when we upload
(called lastStorageAttrs).

What this does is allow us to separate the
attributes without clobbering them, while
supporting retrying when a failure accures.
Specifically, we shouldn't lose the
attributes of the latest save when the async
upload completes. Similarly, we should
preserve the last upload attributes when
the upload fails.

This approach improves reliability
significantly, as evidenced through the
new test, UnitSuperfluousSaves.

Capture the current storage attributes upon saving

Change-Id: I91756fda7b9ed5887dc4ed9691db536371b5bcad
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-04-28 06:58:58 -04:00
Ashod Nakashian
8bbf5e62d0 wsd: process the modified state from uno:Save
A new field, called wasModified, is now published
in the uno:Save result. This gives us an accurate
state of the saved document, whether it had
user-modifications, or was an unconditional forced
save by the user.

Using this flag makes the IsUserModified header,
used during the storage PutFile request, much
more reliable.

Change-Id: I0b7e4421d4a42eef01e19be8d9ee0bee6bff9f03
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-04-28 06:58:58 -04:00
Ashod Nakashian
6dd3feeea7 wsd: do not allow multiple saves in flight
It's easy to use keyboard shortcuts to issue
multiple saves within a short period of time,
which is hardly useful to make saves faster.
In fact, they'd make the server and document
slower by adding overhead.

Similarly, we could get autosave requests
on certain occassions (for example when
the last editor disconnects) while saving.
Again, there is no advantage in issuing
another save in that case. We re-evaluate
the save state when we get the save result.

Here we prevent issuing another save while
one is already in flight, regardless of the
reason.

Change-Id: I9503adabc3a9f1dc6cdbbcf93c5cccbc5414fcf3
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-04-28 06:58:58 -04:00
Ashod Nakashian
8facb429c2 wsd: make removeSockets private
Change-Id: I7171c67bbbe4682cf10e015e600fb25f03d4e5bb
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-04-14 18:02:14 +01:00
Ashod Nakashian
1df26c35db wsd: do not use expired token to lock storage
Change-Id: I733bcb53c50faa2f410af2f10f4c225797f49ecb
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-04-14 11:30:14 +01:00