Michael Meeks
50661924b7
Dump much more ClientSession state, and also websocket latency.
2017-03-18 15:03:04 +00:00
Michael Meeks
0d8809f0ca
Get warning logic right on wakeup socket.
2017-03-18 15:03:04 +00:00
Michael Meeks
a6a4094e52
Send ping message, handle pong & store ping-time on the Websocket.
2017-03-17 22:59:03 +00:00
Michael Meeks
9381d4134f
Unify and simplify timeout and poll events setup.
...
Both happen at the same time, and need support from the
SocketHandlerInterface.
Rename hasQueuedWrites to getPollEvents and merge updateTimeout.
2017-03-17 22:00:28 +00:00
Michael Meeks
3a5ca4b03f
Switch to std::chrono from Poco::Time and simplify lots.
2017-03-17 21:13:11 +00:00
Michael Meeks
e9dbab6900
Always call handlePoll so we can handle timeouts.
2017-03-17 21:13:11 +00:00
Michael Meeks
e7ebe0fdaa
remove obsolete Poco headers, and Poco SSL pieces.
2017-03-16 18:03:23 +00:00
Michael Meeks
f392d9e6f0
Move http serving into socket impl.
...
Avoid caching headers with parameter, and add Date: parameter.
2017-03-15 18:21:59 +00:00
Michael Meeks
909b5f8ac3
Admin: should be its own socket-poll goodness.
2017-03-15 16:13:13 +00:00
Ashod Nakashian
fa1dc4e051
wsd: wrap polling thread and manage state correctly
...
Change-Id: Iaa4eff1fac1cd7147603ba0c9d51fd8b6b0e96d2
2017-03-15 00:04:55 -04:00
Ashod Nakashian
c8bece208d
wsd: socket logs include socket FD for better traceability
...
Change-Id: I994c7c5ab73b97be312a9d6abf3258dc5f4c08c1
2017-03-15 00:04:55 -04:00
Ashod Nakashian
45e1c7763c
wsd: Socket stores SocketHandler shared_ptr
...
Change-Id: I5b460069eb4d91cee2d58833791f961fd6f42b39
2017-03-15 00:04:55 -04:00
Ashod Nakashian
b258355039
wsd: StreamSocket supports changing its SocketHandler
...
Change-Id: I2ffc33daad4da5b98183af39e3c2a64e7e10b3e8
Reviewed-on: https://gerrit.libreoffice.org/35158
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-14 04:31:22 +00:00
Ashod Nakashian
8b9623010a
wsd: sendHttpResponse -> send
...
Change-Id: I7c94f6d4cd1054ea86585bfcd4079140471f3518
Reviewed-on: https://gerrit.libreoffice.org/35157
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-14 04:30:55 +00:00
Michael Meeks
bf8068de18
Clarify comment a little.
2017-03-13 13:42:05 +00:00
Andras Timar
07c0452ec1
fix error: unused parameter 'hard' [-Werror=unused-parameter]
...
Change-Id: Ie2f2a12cc2f5d6c2fd3319d3c870cc7f0a226fae
2017-03-13 13:22:56 +01:00
Michael Meeks
97e9463f17
Revert "wsd: TerminatingPoll always starts its own thread"
...
This reverts commit 388d7b1dbf
.
It is vital to have clean control of thread start. By starting
a thread during init. of a member (or base-clase) we loose lots of
control, some examples:
Any members initialized after a member that auto-starts a
thread, is effectively un-defined, and cannot be accessed
reliably.
This is particularly problematic for sub-classes.
I've seen threads started before the base-class has
finished constructing in the original creating thread -
such that the vtable was not yet updated to the sub-class
causing the transient parent vtable used during construction
to be used in-error.
2017-03-13 12:13:22 +00:00
Ashod Nakashian
94051f21b5
wsd: SocketPoll::startThread can be protected
...
Change-Id: Idd17f7314ac181e9a412e05a1287e15edf5047d2
Reviewed-on: https://gerrit.libreoffice.org/35125
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-13 04:25:20 +00:00
Ashod Nakashian
862d7a0734
wsd: write as many messages to socket as possible
...
Change-Id: Ie2702ea68dd1ae6200fcc304224dea34fc94544f
Reviewed-on: https://gerrit.libreoffice.org/35123
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-13 04:24:37 +00:00
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