Commit graph

1943 commits

Author SHA1 Message Date
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