Commit graph

27 commits

Author SHA1 Message Date
Michael Meeks
5a94614217 Enable SSL in outbound, client websockets ...
Switch SSL context creation to be generic rather than pure server.

Change-Id: I1b750b4ddc8c607381f5541a4f4412fa16e457d4
2018-05-18 15:16:39 +02:00
Michael Meeks
9e7dff79f3 re-factor socket factories to take a client parameter.
Change-Id: I0be98eb583b4f8081dd8ad23e688e93c55220367
2018-05-18 15:16:39 +02:00
Ashod Nakashian
11cdfb7688 wsd: avoid misleading socket error logs
Change-Id: Ie70d8eb1ecc0442643f4b2a4757b95688b4cf1f7
Reviewed-on: https://gerrit.libreoffice.org/48284
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2018-01-22 10:14:17 +01:00
Ashod Nakashian
2ad3cd4de1 wsd: don't call virtuals in dtors
Change-Id: I2490e2f63dc20cf6b3fa0be45341b041e3ccb1bf
Reviewed-on: https://gerrit.libreoffice.org/36321
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-10 06:06:27 +02:00
Jan Holesovsky
cb2b788cc7 assert(isCorrectThread()) -> assertCorrectThread().
assert()'s are no-op in the release builds, but we still want to see threading
problems in the log at least.

Change-Id: Idb02bb018e8f2d628a57ab570249613ad00bcff2
2017-04-05 14:49:30 +02:00
Michael Meeks
913c469aa8 Cleanup whitespace, return is not a function. 2017-03-30 17:34:52 +01:00
Ashod Nakashian
3895897213 wsd: improved socket logging
Change-Id: Ib4751a5a73b7ec0c7ca319f552d5e0aaff06ffea
Reviewed-on: https://gerrit.libreoffice.org/35707
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-26 05:07:37 +00:00
Ashod Nakashian
e9675ed6e1 wsd: close socket when WS close handshake is complete
We shouldn't send any more data after the client
shuts down, or after we initiate shutdown.

Change-Id: Ibf0cf61dcabe9d02ddcb7eb40b2df23712c5a136
2017-03-20 00:41:53 -04: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
Ashod Nakashian
aa19964b03 wsd: SSL logging improvement
Change-Id: I99d08a764fd43ab0c7eb50a1f017202e6bbc3477
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
6f11918661 wsd: more informative SSL error logging
Change-Id: I32baadf995f6fc4c9b112d1a62fee2d618fc9e95
Reviewed-on: https://gerrit.libreoffice.org/35116
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-13 04:10:03 +00:00
Miklos Vajna
2f07eb9a7d Fix remaining -Werror,-Winconsistent-missing-override warnings
The last ones introduced by the non-blocking merge.

Change-Id: I0b9264428669cdd2b8f6eac911c336c6b0e8de99
2017-03-10 11:11:58 +01:00
Ashod Nakashian
2d621f1a47 nb: logging
Change-Id: Ic3b724d5869f75234af2238b96a90c4745155b86
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
d68377748d nb: ReadOrWrite -> Neither
SSL only requests what to poll for next.
So it's more accurate to rename ReadOrWrite
to Neither, since in that case SSL really
isn't blocked on either read or write.

Change-Id: I62dd4f94730d51666a7661b10a9d582d69fbf45e
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
Ashod Nakashian
df45db9da2 nb: shutdown socket after file-serving
Change-Id: Ibe0b33f371d46e62637f570265fcdf9c8bf60b2d
2017-03-10 10:47:41 +01:00
Ashod Nakashian
7fdb7a1861 nb: StreamSocket takes ownership of SocketHandler instance
Change-Id: Ica99dc8afbcca71c8d79eecb276ba19f6f01fa57
2017-03-10 10:47:39 +01:00
Jan Holesovsky
a2d457d778 nb: Abstract WebSocketHandler.
We don't need a special "WebSocket" class, as websocket itself is just an
upgrade of an existing socket / connection, and trying to come up with a
concept where a Socket class magically upgrades to a WebSocket class would be
messy.

So let's have just a WebSocketHandler, that communicates over a StreamSocket
or SslStreamSocket, and be done with that :-)

Change-Id: I449e4d662fbe2c5b1789e308053e4a71376fe481
2017-03-10 10:47:39 +01:00
Jan Holesovsky
18876119ad nb: SimpleResponseClient is a client, not a socket I guess.
Introduce the appropriate interface instead of the template, so that we can
de-couple the ResponseClient from the Socket itself.

Change-Id: I21892bbce5d83a18ca580a25cfc2efbb05b08705
2017-03-10 10:47:39 +01:00
Jan Holesovsky
72666d5625 nb: Let's avoid too much abstraction.
Change-Id: If349e6273580b09386ad0a89467a99c6c2c0d4ec
2017-03-10 10:47:39 +01:00
Ashod Nakashian
69e4123173 nb: de-templatize ServerSocket
Change-Id: I5680bbf24ade807e34f67f7fce4698ffe5364cb2
2017-03-10 10:47:39 +01:00
Ashod Nakashian
9c595755ff nb: move SslStreamSocket to own file
Change-Id: I4b6f2b0b4be3fc595dfeafc8e2b6d3e73694bd49
2017-03-10 10:47:39 +01:00