Commit graph

34 commits

Author SHA1 Message Date
Miklos Vajna
bd4d72d41f common: wrap TerminationFlag in a getter function to avoid ODR violation
Otherwise both loolwsd and unit-copy-paste.so would have a
TerminationFlag:

==11732==ERROR: AddressSanitizer: odr-violation (0x00000208f4a0):
  [1] size=1 'TerminationFlag' ../common/SigUtil.cpp:41:19
  [2] size=1 'TerminationFlag' common/SigUtil.cpp:41:19
These globals were registered at these points:
  [1]:
    #0 0x5f9988 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0x7f5df9cf18cb in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/test/../test/.libs/unit-copy-paste.so+0x60a8cb)

  [2]:
    #0 0x5f9988 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0xe2b4fe in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/loolwsd+0xe2b4fe)

Change-Id: Ic620b143ecb77699f40676ff39d0fa7abceb34d5
2019-08-08 09:10:59 +02:00
Tor Lillqvist
1ce8c94022 Don't hide check for TerminationFlag behind a pointless local abstraction layer
It is useful to find all uses of TerminationFlag directly with git
grep without having to look through abstractions.

Change-Id: I8bc999bd36d06c805c2a6331dba739b41239ddec
2018-10-16 00:22:35 +03:00
Tamás Zolnai
7d98b5f015 Revert "Get back "Cancel tiles also in wsd's senderqueue""
This reverts commit f1a385be98.

It's not easy, it can interfere the tile tracking.

Change-Id: I1e4ec9b4d66e5e912873f673fd5cb71ba55a9332
Reviewed-on: https://gerrit.libreoffice.org/59326
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
2018-08-20 15:13:59 +02:00
Tamás Zolnai
f1a385be98 Get back "Cancel tiles also in wsd's senderqueue"
This reverts commit ec8b7bc012.

Change-Id: I0a4f3f529c86522261085d4feec45e4b56a7e0e6
2018-08-17 23:47:10 +02:00
Tamás Zolnai
ec8b7bc012 Revert "Cancel tiles also in wsd's senderqueue"
This reverts commit 0bb96131c4.

Change-Id: Iffea072aabc88e5150e6ec069917b7965850683a
2018-08-03 12:21:29 +02:00
Tamás Zolnai
0bb96131c4 Cancel tiles also in wsd's senderqueue
Change-Id: I683b3cacee2f87d0dc0f28ad9ac3e122bcd043f1
2018-07-31 13:18:44 +02:00
Miklos Vajna
1dde430bcf wsd: spell out non-trivial autos to improve readability
Change-Id: I0e1f169fc39e5c722704e1cae487147d929f7350
2018-02-07 10:18:12 +01:00
Ashod Nakashian
9234dc4dc2 wsd: drop duplicate setpart before sending to clients
When switching parts (either by the keyboard or mouse)
LoKit sends a notification of the current part and
invalidates tiles. As a reaction to that the client
cancels its tiles and requests new tiles for the
new part.

Since the response to setpart is a large number
of tile cancellation and new requests, the
cost of setpart is significant (esp. with large
number of clients). To avoid that, we de-duplicate
setpart entries from the client queues so there
would be only at most one setpart (the last)
queued to be sent to the client. This minimizes
the unnecessary noise when the part changes
faster than the server and/or network can
keep up.

Change-Id: I87578004203acc63d43e6d398ca04e37f766d9ba
Reviewed-on: https://gerrit.libreoffice.org/36597
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-17 07:04:22 +02:00
Michael Meeks
381bed9388 Remove redundant structure, include, and _stop members. 2017-04-05 18:06:58 +01:00
Michael Meeks
2d1764d30e Dump ClientSession and MessageQueue state too. 2017-04-05 17:59:29 +01:00
Michael Meeks
913c469aa8 Cleanup whitespace, return is not a function. 2017-03-30 17:34:52 +01:00
Michael Meeks
6d6dc45850 Remove un-necesssary and inefficient wakeupWorld.
While message emplacement happens in the DocumentBroker poll, we
can be sure that the next iteration of the poll will call
hasQueuedWrites before polling.
2017-03-15 12:07:34 +00:00
Michael Meeks
44ec90343e SenderQueue - remove condition, and waiting. 2017-03-15 10:20:43 +00:00
Michael Meeks
33d1fa7cc0 Kill SenderThreadPool. 2017-03-10 10:47:44 +01:00
Michael Meeks
52327d78e2 Cleanout old socket code, and several obsolete LOOLWebSocket uses. 2017-03-10 10:47:43 +01:00
Michael Meeks
d4cc2e899c ClientSession: kill the writing thread. 2017-03-10 10:47:42 +01:00
Ashod Nakashian
f1de0d0481 wsd: MessagePayload -> Message
Change-Id: Ie65f7c707785dbbf85a2f98abf082fbc3ee7a64b
Reviewed-on: https://gerrit.libreoffice.org/33428
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-23 05:47:03 +00:00
Ashod Nakashian
6b17f96318 wsd: refactor MessagePayload into own file
Change-Id: Ifc0d2abd2e94d4a1b58915664fb0545dca6e96cc
Reviewed-on: https://gerrit.libreoffice.org/33427
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-23 05:45:23 +00:00
Ashod Nakashian
16eb196820 wsd: each Message object now has a unique ID for logging purposes
Change-Id: I5f3c3afec57f3d9336e0994a1d87421281028d79
Reviewed-on: https://gerrit.libreoffice.org/33426
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-23 05:42:34 +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
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
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
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
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
e9a370176b wsd: fix error: declaration of ‘size’ shadows a member of 'this' [-Werror=shadow] 2016-12-12 12:08:51 +01: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
Renamed from common/SenderQueue.hpp (Browse further)