Ashod Nakashian
9248107702
wsd: SocketPoll reports thread isAlive and use in DocBroker
...
Now that DocumentBroker has SocketPoll thread,
it's isAlive() must be defined by the lifetime of
both the SocketPoll thread and the ChildProcess,
which it previously did.
Change-Id: I093f8774cf4374d01729a383f6c535de4143fec6
Reviewed-on: https://gerrit.libreoffice.org/35122
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-13 04:23:18 +00:00
Ashod Nakashian
c9a07a3087
wsd: assert socket is in correct thread
...
Change-Id: I22c3f62bdf45188641326774dd86b7cacfce9198
Reviewed-on: https://gerrit.libreoffice.org/35120
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-13 04:20:41 +00:00
Ashod Nakashian
04bbb75200
wsd: dump state to generic ostream for flexiblity and to log
...
Change-Id: I4670ee2e90b7809ebc66a2b324a44334b3dbba2b
Reviewed-on: https://gerrit.libreoffice.org/35119
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-13 04:19:58 +00:00
Ashod Nakashian
2e2f62edde
wsd: improved logging
...
Change-Id: I6c4a5bcd54c0748cc413afbfcfb34c365b347669
Reviewed-on: https://gerrit.libreoffice.org/35118
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-13 04:11:24 +00:00
Michael Meeks
5763d8d9bb
Improve debugging.
2017-03-10 23:28:34 +00:00
Michael Meeks
a9d5801c37
Unwind releaseSocket complexity.
...
We only move sockets in response to input on the socket, which
must happen in the thread that we're processing that input on.
Ergo - no need for this complexity.
2017-03-10 18:46:31 +00:00
Michael Meeks
027b8110ed
Allow isCorrectThread asserts to be hard, or off by default.
2017-03-10 18:46:16 +00:00
Michael Meeks
c30fb670d8
Work on LOOL_CHECK_THREADS=1 a little.
...
The situation made more problematic since the std::thread is only
created in startThread - so getting ownership right before then in
Socket is problematic.
2017-03-10 18:20:51 +00:00
Michael Meeks
160446fd23
Work on resurrecting dying DocumentBrokers if we can.
...
The hope is that they will close lingering session sockets at the
end and the client will re-connect.
2017-03-10 17:58:51 +00:00
Michael Meeks
1065441e7c
Don't autosave if we're being stopped and happened to be overdue.
2017-03-10 16:42:59 +00:00
Michael Meeks
173ca5e3d6
Quote ETag.
2017-03-10 16:42:48 +00:00
Michael Meeks
34d9d52207
Avoid assert failure and zero size socket buffer in product build.
2017-03-10 12:12:10 +00:00
Michael Meeks
f4f083e6fe
Cache JS etc. on the client side for 128 days.
2017-03-10 11:36:10 +00:00
Michael Meeks
a5a227e9a3
Re-work socket buffer options, sizing and setting.
...
Only set nodelay and small socket buffers on WebSockets.
Avoid writing more data than can be absorbed by our socket buffer.
It is fine to set socket buffer sizes after bind/accept.
2017-03-10 10:55:29 +00:00
Miklos Vajna
33cbe908c5
net: fix -Werror,-Winconsistent-missing-override
...
Change-Id: Ia8c1f0233e0b65f5fae01272b4f31638aceac9ee
2017-03-10 10:54:08 +01:00
Ashod Nakashian
1da9bc3d69
nb: set the polling thread name for better logging
...
Change-Id: Iccc4337827f00af08327a4430f3d40fa69ac71b2
2017-03-10 10:47:44 +01:00
Michael Meeks
3bfc8aa7f3
Use larger socket buffers for serving files to improve efficiency.
...
The combination of nodelay + minimum buffers is horrific for
file-serving; speedup is from 3.3s to 33ms to serve bundle.js.
2017-03-10 10:47:44 +01:00
Michael Meeks
42a19e66e3
Centralize idle poll time.
2017-03-10 10:47:44 +01:00
Michael Meeks
438630c68f
Start DocBroker thread later - when we've added our 1st session.
2017-03-10 10:47:44 +01:00
Michael Meeks
e16fc97c15
SocketPoll - better control starting our threads.
...
Extraordinary trace with a thread starting before the SocketPoll's
derived classes had started - ie. with wrong vtables etc.
2017-03-10 10:47:44 +01:00
Michael Meeks
842b261d9f
Move auto-save of document into the DocumentBroker poll more convincingly.
2017-03-10 10:47:44 +01:00
Jan Holesovsky
4eccd4d7b4
nb: Check threads only when LOOL_CHECK_THREADS is set.
...
Change-Id: I4137685eb956469d419bded318b83de2b10ce19d
2017-03-10 10:47:44 +01:00
Jan Holesovsky
b895393cea
nb: Perform the socket shutdown asynchronously after the data is served.
...
Change-Id: I642e26abf4ef9c8d2be1be428b5786692dfea2c7
2017-03-10 10:47:44 +01:00
Ashod Nakashian
b8af470918
nb: serve files synchronously
...
As there isn't support (yet) to send files
asynchronously, when the socket native buffer
is small, asynchronous writes naturally return
EWOULDBLOCK. As a temp solution, we send files
synchronously, so there is no need to poll.
This should be replaced witha file-server
polling/serving thread that is dedicated to
sending files only (which closes the connection
when done).
Change-Id: I062fea44bfe54ab8d147b745da97bd499bf00657
2017-03-10 10:47:44 +01:00
Michael Meeks
37de43bb58
Tie sockets to threads, and assert that we're being used in the right one.
...
This shows up some problems around cleaning up prisoners etc. that will
need fixing subsequently.
2017-03-10 10:47:43 +01:00
Michael Meeks
0eaef6c896
config.h - get includes right: must always be the first include.
2017-03-10 10:47:43 +01:00
Ashod Nakashian
7b1ed1b4d4
nb: more informative logging of socket activity
...
Change-Id: I9036c778c195936678c6451ba57cc794d6ba0006
2017-03-10 10:47:43 +01:00
Ashod Nakashian
221bfdefc8
nb: get the poll sockets size after setting up
...
Change-Id: I35174f2f9345286791ccefe2d6dc521a767b6571
2017-03-10 10:47:43 +01:00
Ashod Nakashian
aee954af8b
nb: include the SocketPoll name in logs
...
Change-Id: I7a93edfe0bc74e62bd2726f6fa8425c719326023
2017-03-10 10:47:43 +01:00
Michael Meeks
ce4bd9b9be
Unify DocumentBroker thread and its SocketPoll.
2017-03-10 10:47:43 +01:00
Michael Meeks
79fb1e2c1f
Sub-class the SocketPoll to allow more flexibility in termination.
2017-03-10 10:47:43 +01:00
Ashod Nakashian
c6dbce9767
nb: transfer client sockets to respective DocumentBroker
...
Change-Id: I6af656ec6cbb09d4dd80b7b583a009a763de6eb9
2017-03-10 10:47:43 +01:00
Ashod Nakashian
76e96c92c8
nb: SocketPoll is now a thread object
...
Change-Id: I01d13292f0b97a9ebd1ccdef9e41fec46bfa0b11
2017-03-10 10:47:43 +01:00
Michael Meeks
20f15d4001
Switch Prisoner socket handling to use the SocketPoll.
...
Kills the Poco ThreadPool usage, and significantly improves debuggability.
2017-03-10 10:47:43 +01:00
Michael Meeks
d4cc2e899c
ClientSession: kill the writing thread.
2017-03-10 10:47:42 +01:00
Michael Meeks
6711701721
Socket API to allow asynchronous writing.
2017-03-10 10:47:42 +01:00
Michael Meeks
1655e5d062
Improve socket state dumping on USR1.
2017-03-10 10:47:42 +01:00
Ashod Nakashian
9c0d8cc5b2
nb: log more socket activity
...
Change-Id: Ibcdf5abc3054691c93382c00bb8a9ecc4b882652
2017-03-10 10:47:42 +01:00
Michael Meeks
fa96673ee0
Connect USR1 to initial global state dumping goodness.
2017-03-10 10:47:42 +01:00
Michael Meeks
fffd970425
Work around global initialization order issue with global wakeups.
2017-03-10 10:47:42 +01:00
Michael Meeks
fa6b756346
signal handling: keep track of all socket poll wakeups & wakeup.
...
Instead of waiting for polls to timeout; wake them up.
2017-03-10 10:47:42 +01:00
Jan Holesovsky
62afe66df0
nb: Make the loolnb / clientnb work again.
...
The more testing the better :-)
Change-Id: Ibe4249f18109d50b06e1fa35e6d0fef67f9b3643
2017-03-10 10:47:42 +01:00
Ashod Nakashian
8040dc0746
nb: disable hex dumping
...
No longer necessary to have them enabled
permanently, especially that they affect
performance significantly negatively.
Change-Id: I02ef99da00ba4ecb8e24647ee372a03d79d07fe7
2017-03-10 10:47:42 +01:00
Jan Holesovsky
be743c115d
nb: When we cannot send the file, we must respond with 404.
...
Change-Id: I5f11e7de4b0bfb6e44929b8317e4788d2cc81610
2017-03-10 10:47:41 +01:00
Ashod Nakashian
a68c33477d
nb: support inserting image
...
Change-Id: I6ef11634bbda7e3ecdc467ce10727c8573caef8d
2017-03-10 10:47:41 +01:00
Ashod Nakashian
17fc91e220
nb: process POST requests
...
These are really GET requests that aren't
WebSocket upgrade. Should rename to something
less misleading.
Re-enabled testSlideShow which depended on this.
Change-Id: I52b7f67b650fcdcbae7c2bff020b756099263141
2017-03-10 10:47:41 +01:00
Ashod Nakashian
0c19d81fee
nb: read the socket on accept
...
It's necessary to do the SSL handshake
and to get the request (if we get there)
on accepting so by the time we poll we know
what SSL needs to do next. No reason to
read on first poll when we should be
expecting a request upon connection anyway.
Change-Id: I8eecaad5f8450075d45e487702972418cad125bc
2017-03-10 10:47:41 +01:00
Ashod Nakashian
72669bf929
nb: logging
...
Change-Id: Ia67f746a6c71b4753d04b92472eddf1614c0d337
2017-03-10 10:47:41 +01:00
Ashod Nakashian
df45db9da2
nb: shutdown socket after file-serving
...
Change-Id: Ibe0b33f371d46e62637f570265fcdf9c8bf60b2d
2017-03-10 10:47:41 +01:00
Ashod Nakashian
2f2ba870b3
nb: handle socket poll exceptions and remove socket
...
Change-Id: Ibdee316f102d6606c38470e5ccacd2a7bd7ea7ce
2017-03-10 10:47:41 +01:00