Commit graph

298 commits

Author SHA1 Message Date
Ashod Nakashian
a95a40ba5c wsd: break the loop when shutting down WS on reaching limit
Change-Id: Icc2c88d9c506197940cac8ebe14bc7ab8b2c3178
Reviewed-on: https://gerrit.libreoffice.org/32711
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-04 04:23:52 +00:00
Ashod Nakashian
95ff7ba2d7 wsd: don't access erased iterator
Change-Id: I7d9c85b11cd0ea96700c7302c23b5d4b30ce9fa2
Reviewed-on: https://gerrit.libreoffice.org/32710
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-04 04:23:17 +00:00
Tor Lillqvist
f08bb0eed2 There has not been any 'child' message for a while
Was removed in 29e9ba68c3.

Change-Id: I1e351153ff46b83497f203d493f98070ea4358d5
2017-01-03 19:37:31 +02:00
Tor Lillqvist
b01ed94710 Fix std::string::find() anti-pattern
We want to check for exact match here, so just do it.

Change-Id: I12b0efbc8a0c20c38e2308a4af49681d64c94079
2017-01-03 16:01:04 +02:00
Ashod Nakashian
9c35ab156a wsd: exception-safe socket closing
Change-Id: Id51e61195439e100758d63e5e3417e23b0f0fc53
Reviewed-on: https://gerrit.libreoffice.org/32678
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-03 06:01:04 +00:00
Ashod Nakashian
4f90c3e5b9 wsd: simplify ClientSession removal and cleanup
Change-Id: I934f17e978358bef487c5b470cd8cf5d4d747e5d
Reviewed-on: https://gerrit.libreoffice.org/32677
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-03 05:59:39 +00:00
Ashod Nakashian
5cfef7e76b wsd: construct ClientSession under try
In the rare event that it fails, we will
cleanup the DocBrokers correctly.

Change-Id: I6f5346c9ec5021bdadc8a01ed389951ca18d07a3
Reviewed-on: https://gerrit.libreoffice.org/32676
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-03 05:58:53 +00:00
Ashod Nakashian
6b49ef326a wsd: better logging when adding/removing sessions
Change-Id: Ie11886390687c744e1a0f60bff4317898c36f9c2
Reviewed-on: https://gerrit.libreoffice.org/32675
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-03 05:58:16 +00:00
Ashod Nakashian
1cf7a6bca1 wsd: cleanup DocBroker after exceptions
Change-Id: I6a07845506afd5eae482da5d4367eb397846f410
Reviewed-on: https://gerrit.libreoffice.org/32674
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-03 05:57:28 +00:00
Ashod Nakashian
dcdbb0af3f wsd: cleanup logs in getNewChild
Change-Id: Ib5860556d08d162908cd95b5416d7d750d260cbd
Reviewed-on: https://gerrit.libreoffice.org/32673
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-03 05:56:29 +00:00
Ashod Nakashian
fc8d56d70c wsd: refactor DocBroker find or create
Change-Id: Ia5a61ee367de13f1ad7bb62e808067a435d8e926
Reviewed-on: https://gerrit.libreoffice.org/32672
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-03 05:55:00 +00:00
Ashod Nakashian
98b74174e9 wsd: move more boilerplate code from processGetRequest to handleGetRequest
Change-Id: I7ef76c9e1e48aad275db57b2d4b692531abce9ae
Reviewed-on: https://gerrit.libreoffice.org/32671
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-03 05:54:29 +00:00
Ashod Nakashian
4f46af8856 wsd: refactor handleGetRequest into processGetRequest
Change-Id: Ia8a0e390607e6f69d255027baf417fee25c1de74
Reviewed-on: https://gerrit.libreoffice.org/32670
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-03 05:53:37 +00:00
Ashod Nakashian
33b72aa378 wsd: correctly count outstanding spawned children
Change-Id: I6e2d5c7d8fdfbcd268ef97cb1272bce76e8b69de
Reviewed-on: https://gerrit.libreoffice.org/32669
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-03 05:53:14 +00:00
Tor Lillqvist
37135fdeaa Bin outdated comment
Whatever the reason for the extra initial space was, it apparently has
gone away now.

Change-Id: I26fb166df0d0aace3e5e42fdb9cbc2047b74c920
2017-01-02 13:33:07 +02:00
Tor Lillqvist
f94d4c789d 'Handshake' is one word
Change-Id: Ibef905cc42a74052738a71bd4743431e30b863d1
2017-01-02 13:29:09 +02:00
Ashod Nakashian
85102cf76a wsd: log the session name when subscribing for tiles
Change-Id: I478834bdd7e91eaa64b224a56c8344cb0ef9f82a
Reviewed-on: https://gerrit.libreoffice.org/32632
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 06:17:44 +00:00
Ashod Nakashian
aebfccd2ca wsd: force forking children when none is outstanding
Change-Id: I06f9063ddf32f9296e5e523454b19e8b5692c285
Reviewed-on: https://gerrit.libreoffice.org/32630
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 06:16:43 +00:00
Ashod Nakashian
28db46a59c wsd: always update the last save time to detect failures
When saving we need to differentiate between no-op
and failure. The lastSaveTime must always be updated
when saving didn't fail (i.e. no modification or saved).

Change-Id: I0e2455afac22c82f0b623f9441fbc0bca8a7cb83
Reviewed-on: https://gerrit.libreoffice.org/32629
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 06:16:25 +00:00
Ashod Nakashian
228eb98f4c wsd: move rebalanceChildren and avoid declaration
Change-Id: Ie8e7e1e28f5496cf5376622cb8f24696e45cb5fc
Reviewed-on: https://gerrit.libreoffice.org/32628
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 06:15:13 +00:00
Ashod Nakashian
65d2036d63 wsd: use chrono instead of time_t
While time_t is much simpler, it's too
opaque. The new chrono library is type-safe
and does conversion correctly, as well as
guarantees monotonity and other desirable
properties.

Change-Id: Id41c44c397a31d73e894e8f1715ff18f2b67df53
Reviewed-on: https://gerrit.libreoffice.org/32627
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 06:14:51 +00:00
Ashod Nakashian
a4868edb41 wsd: merge idle document killing with document cleanup
Since we already enumerate the DocumentBrokers and
remove dead ones before every autosave (every 30 seconds)
as well as when loading/unloading documents, there
is little reason to have a separate timeout and loop
for idle documents.

In addition, the previous code only killed the child
but didn't remove the dead DocumentBroker entry from
DocBrokers. Not clear if this was intentional, but it
would have been removed on the next cleanup anyway.

Change-Id: Ie1e09c77133165dd1255930b0b0be06fde7646b1
Reviewed-on: https://gerrit.libreoffice.org/32626
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 06:13:20 +00:00
Ashod Nakashian
9b99f64772 wsd: don't sleep after autosaving or spawning children
Between waits on forkit we shouldn't spend too much time.
This is to recover from forkit crashes.

Now we first spawn children, and only when not successful
(i.e. no more spare children needed) we check for autosave
and DocBrokers cleanup. Only when none of the above is done
do we sleep.

This gives the best balance between forkit waits and reduces
the unittests by a good 25 seconds (crash tests down from 34s
to about 10s only).

Change-Id: If69284746859bc78d14f1c6eda07aef4e006709e
Reviewed-on: https://gerrit.libreoffice.org/32624
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 06:12:14 +00:00
Ashod Nakashian
d716428f71 wsd: return child forking status
Change-Id: If2504bc8b745c8cf0894a6ccaae7b869e06a8f24
Reviewed-on: https://gerrit.libreoffice.org/32623
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 06:10:29 +00:00
Ashod Nakashian
46ef41a687 wsd: force spawning children on startup
Otherwise we throttle spawning to allow
time to fork the process. If we don't wait
we can bomb a loaded server and bring it down.

However during startup this is not necessary
as there are no in-flight spawn requests.

Change-Id: I1beac94571f6d8d96136d32c81310bea6547242b
Reviewed-on: https://gerrit.libreoffice.org/32622
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 06:09:54 +00:00
Ashod Nakashian
e55be929b0 wsd: reuse rebalanceChildren in getNewChild
Change-Id: Ib5e2750e3b3f49c649c2d14fb5016e427b535912
Reviewed-on: https://gerrit.libreoffice.org/32621
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 06:08:47 +00:00
Ashod Nakashian
78f3a4d9b9 wsd: refactor and reuse child forking
Change-Id: Ie5e5966896a728edf032c046bda65c7c9553c27c
Reviewed-on: https://gerrit.libreoffice.org/32620
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 06:08:21 +00:00
Ashod Nakashian
fb1e8eb63a wsd: flag for shutdown when we fail to create forkit
And say 'forkit' in the logs where we recognize it
instead of the generic 'child'.

Change-Id: I7628b064bb6330db145a948640e48b727def3270
Reviewed-on: https://gerrit.libreoffice.org/32619
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 06:07:45 +00:00
Ashod Nakashian
401c7e54c7 wsd: cleanup document saving logs and include the DocKey
Change-Id: I17100ef2115c1953779fe9dda9568c8ae4d6326e
Reviewed-on: https://gerrit.libreoffice.org/32618
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 06:06:52 +00:00
Ashod Nakashian
d67437735f wsd: cleanup all DocBrokers when one is removed
Change-Id: I1010093185e117f50f56d96e73d0771c52113d90
Reviewed-on: https://gerrit.libreoffice.org/32614
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 06:03:11 +00:00
Ashod Nakashian
15a6c02f70 wsd: remove DocumentBroker instances without sessions
Change-Id: I052acba594f0da76332996b25c5349e8fff23606
Reviewed-on: https://gerrit.libreoffice.org/32613
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 06:02:49 +00:00
Ashod Nakashian
3844f5934e wsd: use isAlive before sending message to child
Change-Id: Ie463f89226bc0391102a3a4ae700e90cd3993271
Reviewed-on: https://gerrit.libreoffice.org/32612
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 06:02:30 +00:00
Ashod Nakashian
f3a90ef77a wsd: always notify threads waiting on save
And check for save-failed first before finding
the session, as otherwise the session is useless.

Change-Id: I3eb45e54872547eb36765b2c8409e1aa51aee589
Reviewed-on: https://gerrit.libreoffice.org/32611
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 06:02:04 +00:00
Ashod Nakashian
38bf731a98 wsd: simplify logging during save
Change-Id: Icdd790a555c301e285c9fa3a4eeff87aae2aec3e
Reviewed-on: https://gerrit.libreoffice.org/32610
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 06:01:18 +00:00
Ashod Nakashian
df32077005 wsd: read message payload from correct source
Change-Id: I9333b4ecb3aae7c22e93f0b92a3e6eed59bb875f
Reviewed-on: https://gerrit.libreoffice.org/32600
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 05:53:31 +00:00
Ashod Nakashian
62371e5f41 wsd: log failure in else and not unconditionally
Change-Id: I24f1ac57f350aa67cc14682d695e1e4a07453c8d
Reviewed-on: https://gerrit.libreoffice.org/32562
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-01 04:20:40 +00:00
Ashod Nakashian
aef5af8114 wsd: Storage logs updated
Change-Id: Ib3083e833fdc2891ab0c89231bf2ec3e81285803
Reviewed-on: https://gerrit.libreoffice.org/32560
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-01 04:19:47 +00:00
Ashod Nakashian
759564368d wsd: reorganize DocBrokers lookup
Avoid unnecessary code under lock
or when DocBrokers is updated,
which requires removal on exception.

Change-Id: Id01aed42cd66616b910b7e16a8a1ed6c1d1e74b9
Reviewed-on: https://gerrit.libreoffice.org/32558
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-01 04:18:22 +00:00
Ashod Nakashian
e4a0402924 wsd: improved logging of DocBrokers and NewChildren activity
And improved some comments.

Change-Id: I00605e7471e4f6354d3ff62e1e3873f7e5a7986d
Reviewed-on: https://gerrit.libreoffice.org/32557
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-01 03:59:15 +00:00
Ashod Nakashian
9dfd2008d5 wsd: send text messages as text not binary
Change-Id: I03dccb8035eb0f1d1fbf85f75f2e4f36af1ce689
Reviewed-on: https://gerrit.libreoffice.org/32554
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-01 03:57:27 +00:00
Ashod Nakashian
1a90273672 wsd: log child-to-wsd messages once
Change-Id: I723f673998622416a8aa1f0f46928f530ceb252e
Reviewed-on: https://gerrit.libreoffice.org/32553
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-01 03:56:47 +00:00
Ashod Nakashian
ba90ea304c wsd: ClientSession logs updated
Change-Id: I4ec664ebd7eadbe3763ee18eb511662de6453ebb
Reviewed-on: https://gerrit.libreoffice.org/32552
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-01 03:56:19 +00:00
Ashod Nakashian
3a5be2926b wsd: log WS incoming messages only once
Change-Id: Iee31bc649ae2d194b6418367f0e9ab8561099b17
Reviewed-on: https://gerrit.libreoffice.org/32551
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-01 03:55:19 +00:00
Ashod Nakashian
8481e9c21d wsd: improved logging of child process management
Change-Id: Iaa1f333e3fe427219f244f913834a46a80377032
Reviewed-on: https://gerrit.libreoffice.org/32549
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-31 23:23:04 +00:00
Ashod Nakashian
ba9ffb4775 wsd: include cleanup
Change-Id: Id481cfbab6be12a095918bdc7318fb3584345307
Reviewed-on: https://gerrit.libreoffice.org/32548
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-31 23:22:15 +00:00
Noel Grandin
08ce0ed2da loplugin:simplifybool
Change-Id: If2de633684eeef572b5fe0a2b675f221f513e3f7
Reviewed-on: https://gerrit.libreoffice.org/32369
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-12-27 10:44:22 +00:00
Noel Grandin
0bb8ba8307 loplugin:staticaccess
Change-Id: I1abd6c2a28d3a8e4fb0cda2d35be94d787ff67b7
Reviewed-on: https://gerrit.libreoffice.org/32368
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-12-27 10:43:34 +00:00
Noel Grandin
98c236f9bb loplugin:staticanonymous
Change-Id: I2adf6be69967c163dd6dabbc35e9777589133956
Reviewed-on: https://gerrit.libreoffice.org/32367
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-12-27 10:42:36 +00:00
Noel Grandin
6c0022fb10 loplugin:staticmethods
Change-Id: Idf9596cfbbd6eef77e6271a1108d64dae864ed27
Reviewed-on: https://gerrit.libreoffice.org/32366
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-12-27 10:34:20 +00:00
Noel Grandin
f53669cf9d loplugin:unreffun
Change-Id: I06b13a5c035f6ae4dd4b414f49a0987c019feea5
Reviewed-on: https://gerrit.libreoffice.org/32365
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-12-27 10:26:23 +00:00
Noel Grandin
0caeab803b loplugin:loopvartoosmall
Change-Id: I32f75fac7626b9ae56fa3f898bfa50051a22677f
Reviewed-on: https://gerrit.libreoffice.org/32362
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-12-27 10:15:38 +00:00
Noel Grandin
d425157f53 loplugin:literaltoboolconversion
Change-Id: Ic38256273a8cad001fff6a3d7148a9b272acfa50
Reviewed-on: https://gerrit.libreoffice.org/32361
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-12-27 10:14:31 +00:00
Pranav Kant
a6666d373c storage: catch exceptions explicitly when interacting with WOPI host
... and print error in the logs. So that if there is some problem
in the setup and we are not able to interact with WOPI host for some
reason, we print it in the error logs clearly.

Convert to new style logging - LOG_XXX macros.

Change-Id: I53ce4f61136ffd256b0eae8712dc7f22a620e2bf
2016-12-23 15:28:45 +05:30
Noel Grandin
80b0eaa773 loplugin:unnecessaryoverride
Change-Id: Ib077de07e832ae30137f465596961731954d8e62
Reviewed-on: https://gerrit.libreoffice.org/32340
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-12-22 14:41:10 +00:00
Tor Lillqvist
3d5b9dd573 Typo
Change-Id: I93a9abc63699155b3ac923256d3c86e69e5acd15
2016-12-22 14:48:20 +02:00
Noel Grandin
4199efc91c convert enums to scoped
Change-Id: Ic3d4c09dbcec28b4638bb8888f812f970f40a1c5
Reviewed-on: https://gerrit.libreoffice.org/32331
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-12-22 09:51:56 +00:00
Ashod Nakashian
70bbc53d86 wsd: don't reuse DocBrokers iterator to insert
Simplifies the code and makes it less error prone.

Also add more logging on modifying DocBrokers.

Change-Id: I861495912eb4994a32b1ccaccc181fb1aad26e1f
Reviewed-on: https://gerrit.libreoffice.org/32295
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-21 15:40:45 +00:00
Ashod Nakashian
bc65f8220b wsd: don't poll WS for write to check child alive
The WS could be chocked on write, but we shouldn't
assume the child is dead because of that. We are
only trying to test if the child process is alive
in that helper.

Change-Id: I108a297e43f923cab0dfa30204837dc4df15d3a1
Reviewed-on: https://gerrit.libreoffice.org/32289
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-21 15:39:00 +00:00
Ashod Nakashian
e1d5bf4ec2 wsd: no need for first foreslash in local path
Since the local path already ends in foreslash,
no need to keep the on in provided by the client.

Change-Id: Ia2bc24c7faa84509f9ec18deefb14cad2858e856
Reviewed-on: https://gerrit.libreoffice.org/32288
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-21 15:01:39 +00:00
Ashod Nakashian
a3de232c7a wsd: FileServer logging updated
Change-Id: Ia797c6c8f9068805d85f066030f8110f0affb7f4
Reviewed-on: https://gerrit.libreoffice.org/32286
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-21 15:00:52 +00:00
Tor Lillqvist
07b917f97e Ignore dummy (epoch) timestamps
Change-Id: I745940005f018c43ff83a48199d7945d5e807a8c
2016-12-21 14:06:07 +02:00
Tor Lillqvist
fe7aaafd3e WIP: Check if the document has been modified behind our back
For now, do the check only when a new session connects to the
document, because at that point we fetch the document information (in
separate function for WOPI and local files) and construct the
FileInfo, including timestamp.

For now, just log an ERR message if we notice that the document in its
storage system (WOPI or local file system) has an unexpected last
modified time. What should we do? If we don't have unsaved changes,
most likely we should just silently reload the document and force all
sessions to refresh. But if we have unsaved changes, and the document
has changed underneath, we have a problem.

We need to fetch the timestamp also also after saving ("persisting")
as we can't assume that the clock on the machine running loolwsd and
that of the storage (as reported in the WOPI case in CheckFileInfo)
are in synch. (Assuming separate machines, they certainly won't ever
exactly in synch, but aren't necessarily even just a few seconds apart
(think incorrectly set up timezone etc), so no amount of tolerance in
the comparison would be good enough, because after all, it might be
that in the problematic cases we are looking for the timestamps also
are separated by a quite short time.)

Yes, this means there is a race condition; what if the document is
modified behind out back right after we have persisted it, before we
ask for its timestamp? It would be much better if the persisting
operation atomically also told what the timestamp of the document in
the storage is after persisting, but alas, WOPI doesn't do that.

Rename the DocumentBroker::origDocumentLastModifiedTime field to
_documentLastModifiedTime as that is less misleading. It is not the
"original" document timestamp but the timestamp of the document in its
storage system.

This needs much more work: Ideally the timestamp of the document in
its storage system should be retrieved and checked against the
expected value also before we are about to save it.

But unfortunately experience has shown that the WOPI CheckFileInfo
operation can be expensive, so we'll see what can be done. Ideally
WOPI should contain the optional functionality to return an error if,
when saving a document, its timestamp (and size?) in storage are not
what the saving client expects.

Also add a few FIXME comments.

Change-Id: I5a9b55d4b55a8db0c9ee8638edd368dc0aa325d5
2016-12-21 11:41:08 +02:00
Tor Lillqvist
2f2607dfe9 No reason to keep original _fileInfo forever
The information in StorageBase::_fileInfo is not expensive to
construct. What might be expensive we were doing anyway for each time
a session connects to the document. So just update _fileInfo whenever
we fetch currrent information about the document in its storage, which
is useful, as the timestamp and size after all will change whenever
the document is persisted.

Change-Id: I173394c88b4d6448ad5bf1ab9b41694cffdf1ff4
2016-12-21 10:53:19 +02:00
Tor Lillqvist
1d124f1980 Drop unneeded forward declaration
Change-Id: Iba2fab89780b381ad60a921e4d3fbe80355a8f64
2016-12-21 10:53:19 +02:00
Ashod Nakashian
200bf6f92b wsd: fix compiler warnings of shadowing variables
Change-Id: I3a1344d58b1af11c95accb5f7a9d1c8e5b2d19fb
Reviewed-on: https://gerrit.libreoffice.org/32180
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/32181
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-19 13:18:53 +00:00
Tor Lillqvist
45aad66e65 Inititalize _fileInfo's dummy timestamp in StorageBase ctor as the epoch
And not as the current time. The getLocalFileInfo() and
getWOPIFileInfo() functions will reset it anyway.

Change-Id: Ief821482cf789113cecd85e5d59afecf6ad2c3ab
2016-12-19 14:33:30 +02:00
Tor Lillqvist
889adad09a As the code is now, no need for StorageBase::getFileInfo() to be virtual
It would be another thing if it would be abstract and overridden in
the concrete derived classes. But now it just returns the _fileInfo
field that is set by the separate getLocalFileInfo() and
getWOPIFileInfo() functions. Possibly this should be re-designed
and/or stuff re-named for clarity.

Change-Id: I30d01277ac0c6bd4b9daa317aade319b6ef39342
2016-12-19 14:33:30 +02:00
Tor Lillqvist
a275fc7922 Keep track of the timestamp of the actual document in DocumentBroker object
Not used yet, maybe later.

Change-Id: I0e342fb1f0ebb486d6bfb799831760257c9ade1f
2016-12-19 14:33:24 +02:00
Tor Lillqvist
8367df707b Actually do what the comment says
Poco::Timestamp::fromEpochTime() is a static member function that
returns a Timestamp.

Let's hope this doesn't introduce any regression.

Change-Id: I0997c4c3128ec07d5db76dbf3ecc388cd19ac2ac
2016-12-19 12:34:20 +02:00
Ashod Nakashian
2b9e695a3b wsd: deduplicate more messages
Change-Id: I0ad9ef7bf826b3fd0eba9cc17ec5212a3334a2f5
Reviewed-on: https://gerrit.libreoffice.org/32163
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-19 06:02:19 +00:00
Ashod Nakashian
839d7a9b43 wsd: deduplicate invalidate view cursor messages
Change-Id: I898c98ad42fb807ebeafafa47d85930025def57f
Reviewed-on: https://gerrit.libreoffice.org/32162
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-19 06:01:46 +00:00
Ashod Nakashian
49af971efb wsd: simplify tile deduplication
Change-Id: I34d83acc81b8169d8ae07ed53219b11fe0f0fec2
Reviewed-on: https://gerrit.libreoffice.org/32161
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-19 05:59:22 +00:00
Ashod Nakashian
df79138bc3 wsd: use Message members where possible
Change-Id: I7bcaa1306600b3e15bef7e7aff02a8a6cd64abf9
Reviewed-on: https://gerrit.libreoffice.org/32160
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-19 05:58:04 +00:00
Ashod Nakashian
ea2c3eb15c wsd: deduplicate tile messages in SenderQueue
Change-Id: Ib1cc38f34534aa754503ef296871815bc3d5450d
Reviewed-on: https://gerrit.libreoffice.org/32158
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-19 05:55:33 +00:00
Ashod Nakashian
7e1529af31 loolwsd: add tokenization to MessagePayload
Change-Id: I39135b2ad65da5abce93848a68faffc93906a0c0
Reviewed-on: https://gerrit.libreoffice.org/32157
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-19 05:51:49 +00:00
Ashod Nakashian
58d679240c loolwsd: better MessagePayload encapsulation and cleanup
Change-Id: I690f1044f75582b6e7f05b2026f96a0720be2cbc
Reviewed-on: https://gerrit.libreoffice.org/32156
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-19 05:50:30 +00:00
Ashod Nakashian
5a987bea90 loolwsd: better to poll less frequently
Change-Id: I8ad44d132f11d32247f48583151c650e98856f82
Reviewed-on: https://gerrit.libreoffice.org/32153
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-19 05:42:20 +00:00
Pranav Kant
8d3c60c9a8 Bin 'setting minimum socket buffer' in non-debug mode for tests
Initial effort was setting it when we are compiling with
--enable-debug or when not, unit tests are running, but since we don't
run the unit tests in absence of --enable-debug anyways,
there is no use for this #else code block.

Change-Id: I9d7c66a18be160a47afd2bf336d89d50d4f2463e
2016-12-18 00:34:43 +05:30
Tor Lillqvist
20f8c8d65a Use also the LastModifiedTime property from the WOPI CheckFileInfo response
If not present, set the FileInfo _modifiedTime to the UNIX epoch.

Change-Id: I2e805d34e426368e5319cb9321159c21fe8ae9e0
2016-12-16 15:21:06 +02:00
Pranav Kant
b26969b98c wsd: set minimum socket buffer size in debug mode
Change-Id: Ieae9721d45ade34c5ce9773867ab1ab997a344dc
Reviewed-on: https://gerrit.libreoffice.org/32071
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2016-12-16 10:24:14 +00:00
Pranav Kant
9b37eed727 Add missing config.h
Change-Id: Ib63c0bdfc8126fea211c5311c957985de6b00129
2016-12-16 11:33:18 +05:30
Michael Meeks
e24dfb9616 Use a blocking write rather than failing when no space in write buffer.
Also avoid a poll syscall for an error state we'll get from the write.
2016-12-15 13:51:07 +00:00
Pranav Kant
39dd5018e2 browser console logging depending on loleaflet_logging prop.
loleaflet_logging defaults to true with compiled with
--enable-debug otherwise false.

Browser will print additional debug info when this property is
set to true.

Change-Id: Id9fabf134bd8d19fa1a09ca8c0987df46d4f1a4c
2016-12-15 16:52:07 +05:30
Tor Lillqvist
36f3dece7c Bluntly close sessions that have been idle for more than an hour
By that time the loleaflet code has already done the greying-out (this
happens at the latest after 10 minutes of inactivity) and marked them
as 'inactive'. Bluntly closing the session seems to work out fine, no
new horribly alarming message is displayed by the loleaflet code in
addition to the already visible 'Inactive document ...' one.

Change-Id: I420f0d7530194e6c8d6f34d7985ab810cde5a76a
2016-12-14 18:24:38 +02:00
Pranav Kant
23ab220259 Document owner termination feature
Change-Id: If9e09ba781e0cb53a6a96a6acdaac8995fa8f348
2016-12-14 18:18:11 +05:30
Ashod Nakashian
fe38e0e1e6 loolwsd: per-socket dedicated sending thread
To avoid degrading performance for everyone
because of a single slow/bad connection, we
send data to clients each in its own thread.

Change-Id: I6f980c25a404c4d05bcdb1979849ea3d2776c7b9
Reviewed-on: https://gerrit.libreoffice.org/31984
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-14 04:21:20 +00:00
Ashod Nakashian
875d11f88b loolwsd: simplify checking for closed socket
Change-Id: I1f41c40bdd42ad6ab9224a2b13af97f84175492c
Reviewed-on: https://gerrit.libreoffice.org/31983
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-14 04:14:57 +00:00
Pranav Kant
1459223c69 wsd: Document expanding WOPI extensions
Change-Id: I1c2c510154a0a987095ff1f4c343c033150f8ae6
2016-12-13 20:17:32 +05:30
Pranav Kant
49193b3f58 tdf#104157: Fix Content-Type and add Content-Disposition for pdf
Change-Id: I07a02a621f0f067b9810d0f92bd3b9fff112af54
2016-12-13 19:39:25 +05:30
Miklos Vajna
d11997337e wsd: mark AppConfigMap as a final class
The call to the setRaw() virtual function during construction will not
dispatch to derived class, so the ctor is correct only in case there are
no subclasses.

Change-Id: I484d276dd05e53211b513373100b70586a5857c0
2016-12-13 13:56:42 +01:00
Pranav Kant
b914aa4222 wsd: If Disabled, turn their corresponding Hide options on
loleaflet will then automatically hide these options from the UI

Change-Id: I65a320850a35b5af4291d896d5942dddfaaa0c98
2016-12-13 18:03:37 +05:30
Pranav Kant
a76825728e Pass Disable{Print,Export,Copy} options to client and handle them
Change-Id: I59a9432bbdd06d8b184f96882c5f4009fcd0be54
2016-12-13 17:59:02 +05:30
Pranav Kant
3ce8c3158a wsd: Allow disabling copy/paste to/from the document to browser
Change-Id: I73c70f46f1db11d69ebff582f72127d304689aa2
2016-12-13 17:45:16 +05:30
Pranav Kant
6affbb307c wsd: Allow hosts to disable print, export
using these WOPI protocol extensions: DisablePrint,
DisableExport, DisableCopy. All assumed to be false if not
provided.

Change-Id: I415597d710107f9d8cbb8757f361365cc2a88eb1
2016-12-13 17:45:16 +05:30
Pranav Kant
1ddd85c77c Document downloadas protocol message
Change-Id: Iad8775c441e8fbb531b4608bd6ccb391435e7dcf
2016-12-13 17:45:16 +05:30
Pranav Kant
348653a73c wsd: Use EnableOwnerTermination property for ownertermination
We want document owners (sessions with their WOPI UserId =
OwnerId) close the document (for all sessions) only if
EnableOwnerTermination property is specified. Note that
EnableOwnerTermination is an extension to WOPI, and not part of
original WOPI standard.

Change-Id: I7237d172c4c54477572bc132336910250af075a3
2016-12-13 17:45:16 +05:30
Pranav Kant
3e2a9df6dd wsd: Store wopifileinfo separately per client session
Client needs to act accordingly as per permissions/settings set
by the WOPI host.

Change-Id: I7c9f311be50d4aff2562da0cfef2fff889f111d0
2016-12-13 17:45:16 +05:30
Andras Timar
0b596ae51d wsd: do not warn about missing access_token_ttl, when there is no access_token
Change-Id: I6ac7014dee21892dfd8b3b594cafe2dc030b6b2a
2016-12-13 09:56:29 +01:00
Ashod Nakashian
aa1d721444 loolwsd: harden against socket errors and lock while receiving
Change-Id: I402d387272e0e30d2fe035842c50f40c3806e20d
Reviewed-on: https://gerrit.libreoffice.org/31933
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-13 04:36:27 +00:00
Ashod Nakashian
477ca6f414 loolwsd: cleanup the Sessions
Change-Id: I3cd065ab84e17f943fa7de7e094db574ff6fde07
Reviewed-on: https://gerrit.libreoffice.org/31931
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-13 04:35:00 +00:00
Ashod Nakashian
e60bc28a00 loolwsd: LOOLSession -> Session
Change-Id: I94369480fb0a6789375dfe5610ada300e94b80eb
Reviewed-on: https://gerrit.libreoffice.org/31930
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-13 04:34:19 +00:00
Andras Timar
708f9be23a wsd: do not log error, when access_token_ttl is not passed 2016-12-12 19:28:37 +01:00
Miklos Vajna
20fe9cc863 TileCache: remove redundant initializers
Change-Id: Ifb458eb1e5f60152dcebbce2ad11af2ec90e7e52
2016-12-12 12:09:35 +01:00
Andras Timar
e9a370176b wsd: fix error: declaration of ‘size’ shadows a member of 'this' [-Werror=shadow] 2016-12-12 12:08:51 +01:00
Ashod Nakashian
3ac620fc4f loolwsd: alert all users via SenderQueue
Change-Id: Ib5f4e456109a2a48f29fb6b7b75950315490c352
Reviewed-on: https://gerrit.libreoffice.org/31890
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 05:28:54 +00:00
Ashod Nakashian
b7205192b4 loolwsd: route client messages through SenderQueue
Change-Id: Ied0e32e8874c9754bf32f1a77c74cf8da181924a
Reviewed-on: https://gerrit.libreoffice.org/31889
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 05:27:13 +00:00
Ashod Nakashian
d8c8737597 loolwsd: move forwardToPeer into PrisonerSession
Change-Id: I771af0ea066d3d7cb16173861ae70dcc052122aa
Reviewed-on: https://gerrit.libreoffice.org/31888
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 05:25:51 +00:00
Ashod Nakashian
2065fb5972 loolwsd: set the payload size only once
Change-Id: Ieb8f6fdbdbf0fbca3aa4032aea2f15bf37e3282b
Reviewed-on: https://gerrit.libreoffice.org/31887
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 05:24:59 +00:00
Ashod Nakashian
da97e2ac18 loolwsd: grow the SenderThreadPool dynamically
The pool is checked for expansion before processing
items from the queue. By tracking the number of idle
thread (i.e. not currently sending data) we ensure
that there is at least one idle thread before
we invoke the socket.

If there is not enough idle threads at that point,
a new thread is spawned, so long as we're below the
limit. This guarantees that even if all the active
threads block on the socket, we'd always have one
more to process new data (until we reach the limit,
which is as many client connections as we have).

Technically, a single slow connection could
still monopolize all connections if there are
many messages to be sent to it. For that we'd
need to track and assign one thread per connection,
something we don't currently do.

Change-Id: Ic8b5e064da068b37bcfa773005495b198763c31d
Reviewed-on: https://gerrit.libreoffice.org/31886
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 05:24:11 +00:00
Ashod Nakashian
f8d3576556 loolwsd: Sender Thread Pool
Change-Id: I36a0ad376dad1e6b0733ebfa930baf1dd5752a8c
Reviewed-on: https://gerrit.libreoffice.org/31885
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 05:22:31 +00:00
Ashod Nakashian
0b42af6d8d loolwsd: move SenderQueue to wsd
Change-Id: I33af4d1b2bbf0305cbc5fa6f05266d126f1bb803
Reviewed-on: https://gerrit.libreoffice.org/31884
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 05:20:43 +00:00
Ashod Nakashian
233cb94eff loolwsd: SenderQueue to hold messages to send to clients
This adds SenderQueue and a wrapper of messages to
send back to clients.

Currently no threading takes place, but the messages
are pumped through the queue nonetheless.

Change-Id: Id9997539c0a2a351cbf406f649c268dd3643e88e
Reviewed-on: https://gerrit.libreoffice.org/31883
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 05:19:04 +00:00
Ashod Nakashian
9252477353 loolwsd: correct logging
Change-Id: I1856b68f336bc5515c1ef82b47893649510438c5
Reviewed-on: https://gerrit.libreoffice.org/31882
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 00:29:11 +00:00
Ashod Nakashian
d3c2a320ae loolwsd: refactor tile sending to offload on thread
Change-Id: I6537ca407dc64a0a78a33ba823a43e5ead570848
Reviewed-on: https://gerrit.libreoffice.org/31881
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 00:28:52 +00:00
Ashod Nakashian
9f5ec66fb5 loolwsd: prepare to offload tile sending
Change-Id: Ifafa822c05c27fc4b7ef7e0e97ae133de39ce23b
Reviewed-on: https://gerrit.libreoffice.org/31880
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 00:28:16 +00:00
Michael Meeks
166c77f0d1 Make admin console easier to find in 'make run' 2016-12-08 17:47:21 +00:00
Michael Meeks
4c2e59c1f2 Don't take down WSD with an assert on a badly formed URI. 2016-12-08 14:53:01 +00:00
Tor Lillqvist
e221388c79 Add an 'Idle time' column to the Admin console
Use a new protocol message, 'resetidle' to inform Admin clients
whenever a user has done anything in a document view. This is a
message that Admin clients need to subscribe to.

Also add the current idle time for each document to the 'documents'
message.

To reduce protocol chatter, the idle time is updated at most once per
10 s.

Change-Id: I418e82b05048a3628f21dcd240ccd974b3a01356
Reviewed-on: https://gerrit.libreoffice.org/31653
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-12-08 08:39:11 +00:00
Miklos Vajna
cb8564b17f Storage: make sure matrix is initialized before read
Change-Id: I967ab34c0f0430900b4be4424fa4493386c96c33
2016-12-08 09:33:24 +01:00
Miklos Vajna
722f904019 TraceFile: clean up redundant member initializer
Change-Id: Ia7843f6009e209da351f241839084eb61f0bb299
2016-12-07 14:31:53 +01:00
Tor Lillqvist
ae2d02a45b Remove superfluous word 2016-12-05 22:31:12 +02:00
Pranav Kant
68339f4673 wsd: 'perm: readonly' is already sent in ClientSession::setReadOnly
Change-Id: If8cb509f72539296dbfd816587df2674e82e1e60
2016-12-05 21:28:52 +05:30
Pranav Kant
c8b1b58477 wsd: Allow executing search in readonly mode
Change-Id: Ie0c2721e4f932a08dfefae742f9f3c934514fde6
2016-12-05 20:48:31 +05:30
Pranav Kant
8357a2bcee wsd: readonly message filtering in separate function
Change-Id: I1c02be876aa4cf2a878082b593de3c83e45e15b3
2016-12-05 20:48:31 +05:30
Ashod Nakashian
1a46557922 loolwsd: local names should begin with small case
Change-Id: I9b9da72f7d9bd94155cbe443f66aedc163a92aa8
Reviewed-on: https://gerrit.libreoffice.org/31615
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-05 04:50:09 +00:00
Tor Lillqvist
7263491ea6 Document return value of our LOOLWebSocket::receiveFrame()
Especially the -1 return value, which is different from what
the Poco WebSocket::receiveFrame() can return.
2016-12-02 16:52:48 +02:00
Tor Lillqvist
f144dd9f05 Log also the frame as received 2016-12-02 16:52:48 +02:00
Tor Lillqvist
ffbc9baccc Use getAbbreviatedFrameDump() instead of getAbbreviatedMessage() when logging
The more information the better, when tracking problems.
2016-12-02 16:52:48 +02:00
Pranav Kant
dde653f920 tdf#103825: Prompt the user when session is about to expire
Set a timer in loleaflet 15 minutes before access token expiry
date (access_token_ttl value) to prompt the user to save and
refresh the session.

Change-Id: I98c3e47c9b7031e29e002f653d488747b9c17df8
Reviewed-on: https://gerrit.libreoffice.org/31381
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2016-12-02 12:38:51 +00:00
Ashod Nakashian
a652e6b583 loolwsd: guarantee DocBrokersMutex locked when alerting
We now guarantee that forkChildren will be invoked
under DocBrokersMutex lock.

This eliminates the case when alertAllUsersInternal
is invoked when this mutex isn't locked.

Change-Id: Ibb259bbb4f380300a90ad2fc7affe6013dd71fef
2016-12-02 11:20:58 +01:00
Jan Holesovsky
e277935b1e Revert "loolwsd: alertAllUsersInternal expects lock to be taken"
Unfortunately this brings back the deadlock that
51c88c5fb7 fixed :-(

This reverts commit da3b1b208a.

Change-Id: If48c0b3ddebf3fb366786d90cb35c3c22963b1a1
2016-12-01 12:35:14 +01:00
Pranav Kant
a0be903cd7 Document wopi: protocol message
Change-Id: I3a082a264a6081e8225a7820ec78d85f27aea404
Reviewed-on: https://gerrit.libreoffice.org/31380
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2016-12-01 10:26:46 +00:00
Ashod Nakashian
da3b1b208a loolwsd: alertAllUsersInternal expects lock to be taken
Change-Id: I50a4d0edd500043c52c28aba3e61ba2a892c102d
Reviewed-on: https://gerrit.libreoffice.org/31459
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-01 06:00:01 +00:00
Ashod Nakashian
283cf812de loolwsd: Writer doesn't have parts
Fixup the part for EMPTY invalidation as well.

N.B. Should replace 'EMPTY' with '0,0,INT_MAX,INT_MAX'
to be consistent. Since both are expected, no compat
issues should be expected.

Change-Id: I066981622b1de71e9e849530df0583291b74b804
Reviewed-on: https://gerrit.libreoffice.org/31393
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-30 04:40:09 +00:00
Ashod Nakashian
95e682a647 Revert "loolwsd: combine tiles strictly in the same row only"
This reverts commit b8c9163ac8.

Change-Id: I8279473209a376c963dc750c0ca4f68d23050e81
Reviewed-on: https://gerrit.libreoffice.org/31338
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-29 02:45:45 +00:00
Jan Holesovsky
5e02a43306 The 'make run' should advertise a copy of the document, not the source.
Change-Id: Idddd804432ea1147ffbb43bffa0784d2759a9a36
2016-11-28 19:12:45 +01:00
Jan Holesovsky
9842f3239f Make sure we don't use the jitter / delay in production builds.
And default to 0 even for debug; who wants to use that for debugging, they
know what to do.

Change-Id: I23dd0c5f806b2b31a883b7a2b8d822ea8c0bb6c5
2016-11-28 11:31:06 +01:00
Ashod Nakashian
b8c9163ac8 loolwsd: combine tiles strictly in the same row only
Change-Id: I1d2ba647deac8da749e7cf7b56a1c9a19fe840f8
Reviewed-on: https://gerrit.libreoffice.org/31299
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 05:27:55 +00:00
Ashod Nakashian
2b9ea3d4a6 loolwsd: notify clients before recycling wsd
Change-Id: Ib2733a6af1c27fe39c54f5c3bc6f5bd3acb72a2b
Reviewed-on: https://gerrit.libreoffice.org/31298
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 05:27:34 +00:00
Ashod Nakashian
68519f0927 loolwsd: destroy DocBrokers sooner
Change-Id: I10d8ea57083c3b785748062a927574a63e0dd250
Reviewed-on: https://gerrit.libreoffice.org/31297
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 05:04:35 +00:00
Ashod Nakashian
2239f25684 Renamed 'shutdown' to 'shuttingdown'
Change-Id: Idae53a59af13eb54b1f18f1a8cd1dde06421b426
Reviewed-on: https://gerrit.libreoffice.org/31295
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 05:03:54 +00:00
Ashod Nakashian
db996c7e90 loolwsd: retry shutting down the WS upon exception
Change-Id: I3dc4b6f73c1ef5641c32e756099428a8ef38ee82
Reviewed-on: https://gerrit.libreoffice.org/31288
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 04:56:43 +00:00
Ashod Nakashian
6ab32e0aa9 loolwsd: use larger threshold to large messages
Messages larger than a certain size are preambled
with a 'nextmessage' message that hold the size
of the subsequent message.

This is a workaround to a limitation the Poco
WebSocket API where if the buffer size is
smaller than the received frame the socket
ends up in a bad state and must be closed.
Unfortunately the new API that avoids this
workaround is not yet released by Poco.

Here we minimize the need for 'nextmessage'
to truely large messages. The limit is now
raised from above 1KB to over 63KB.

We may raise this limit further, but that will
cost each socket that much dedicated buffer size.

Change-Id: I01e4c68cdbe67e413c04a9725152224a87ab8267
Reviewed-on: https://gerrit.libreoffice.org/31286
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 04:54:37 +00:00
Henry Castro
7234db9317 wsd: fix sending wrong UTF-8 string to the client
Client side console error "ws stopped cannot read
utf8 string", the cause it is sending special character '{',
'}',
2016-11-27 22:45:14 -04:00
Henry Castro
7760d6d6d5 wsd: fix URL encoded char parameter 2016-11-27 22:24:45 -04:00
Michael Meeks
bbe0723e78 Tweak code to use new paths. 2016-11-25 09:59:03 +00:00
Michael Meeks
c1a398977f Adapt makefiles, includes etc. to new locations. 2016-11-25 09:58:57 +00:00
Michael Meeks
cca657c8f2 Apply the pre-branch rename script to re-organize the source. 2016-11-25 09:58:48 +00:00