Commit graph

480 commits

Author SHA1 Message Date
Miklos Vajna
22fac18fcd WebSocket: make members private
All of them were protected, but only _socket was used actually. Add a
protected setter/getter for that field.
2018-10-24 09:36:13 +02:00
Tor Lillqvist
decf78ff2e Buffer an unlimited (eek, scary) number of messages per fake socket
Matches the behaviour of real sockets in a real Online server better.
Seems to get rid of the occasional hang problem.

I had already some time ago suspected that such a change would fix
that problem, but unfortunately my first attempt missed one crucial
detail, so it didn't, and I spent days looking for other ways to fix
the problem instead, in vain.

Probably I should add some sanity limit on the number of buffered
messages, though... But if such a sanity limit then would be hit, most
likely much else is totally broken already anyway.

Change-Id: Ice43057814ee5abd85b2935ffaa91765845a515a
2018-10-23 15:23:01 +03:00
Tor Lillqvist
d6d0c3e8a3 As far as I see, no getPollEvents() implementation will ever return negative
In 1c7f94045a that introduced
DelaySocket, its getPollEvents() could indeed return -1, but that was
removed later.

Change-Id: Ie3a7e01b7b9a7517d97f6ed3cc6d96bdb3313969
Reviewed-on: https://gerrit.libreoffice.org/61990
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2018-10-19 13:41:18 +02:00
Tor Lillqvist
c6c6e8cc46 In fakeSocketConnect() log also the fd the corresponding accept returned 2018-10-19 02:03:32 +03:00
Tor Lillqvist
452a0a46c2 More work on the GTK+ testbed app
Add plumbing to send messages from the Online code to the JavaScript
code, and vice versa. Similar to what is done for iOS.

Sadly, it crashes. Multi-thread issues. Not surprisingly, it crashes
when I call webkit_web_view_run_javascript() in another thread than
the one where the GTK+ and other Webkit calls were done. I need to
come up with some clever way to do everything from the same thread.

(On iOS, I use dispatch_async(dispatch_get_main_queue(),...) to
schedule a block (i.e., a lambda expression) to be run in the main
thread.)
2018-10-17 22:48:14 +03:00
Tor Lillqvist
05c2782a81 Empty out _newCallbacks when stopping a SocketPoll in the MOBILEAPP case
The wakeup() call in SocketPoll::stop() doesn't always (or ever?)
actually cause the wakeup code to be invoked and callbacks called
right after, and we don't want to risk the leftover callbacks being
invoked when the same SocketPoll object is started again. (This did
actually happen.)

In a normal Online, this is not a problem, as SocketPolls aren't
reused. One document per kit process, a separate kit process for each
document. Not so in a mobile app, there we have just one process that
handles document after document as the user closes one, opens another
(or the same anew), etc.
2018-10-17 20:10:52 +03:00
Ashod Nakashian
f3d02cb9e2 wsd: support polling on client thread
Previously SocketPoll expected to be
running its own thread for polling.
This is unnecessary when we have a
spare thread (e.g. main) that can
(and should, for efficiency) be used
for polling rather than starting
dedicated thread.

Not starting the SocketPoll's thread
and calling SocketPoll::poll() directly
worked, the warning logs on each activity
notwithstanding.

The warnings aren't just noisy, they are
a performance drain as well, and signal
that something is wrong. The new code
now makes the API cleaner and avoids
unnecessary warning logs, while being
faster.

Change-Id: Ibf9a223c59dae6522a5fc2e5d84a8ef191b577b1
2018-10-16 20:12:23 -04:00
Ashod Nakashian
3158d4c31c wsd: always use signal-safe calls
The async-signal-safe functions to get thread-id
and thread-name, which cache the results, are
faster, cleaner, and signal-safe. No reason why
we shouldn't always use them.

Especially since it appears the logic was
inverted in Log::prefix, such that the signal
un-safe calls were made during signal-handling,
and the safe ones were called otherwise!

Instead of passing the signal-safe flag to
Log::prefix, we pass the buffer size, for
improved security.

Furthermore, reduce header dependencies
and reduce clutter.

Change-Id: I697689b2f0a290b6d8cce4babc3ac1e576141da6
2018-10-16 20:12:23 -04:00
Ashod Nakashian
63c3fce2c6 wsd: clang-format logging macros and pass logger explicitly
Change-Id: I37e7f4b5687b64b36e0985942627a4b84a8249eb
2018-10-16 20:12:23 -04:00
Tor Lillqvist
e9d0b38103 Add some includes that are missing if compiling this on Linux
Change-Id: Iffe3481e56842f29f0e7838ca024b28e1f7187f3
2018-10-16 23:56:46 +03:00
Tor Lillqvist
6316aaf0f5 Initialise also _threadFinished and _stop in SocketPoll::startThread()
I am trying to get a SocketPoll object to be "restartable".

Also make the lambda expression in joinThread multiple lines, so that
one can set a breakpoint in it.
2018-10-16 23:06:05 +03:00
Tor Lillqvist
c617a8c73f Improve a comment 2018-10-16 23:05:59 +03:00
Tor Lillqvist
223cc97175 Log each line separately in fakeSocketDumpState() instead of with embedded newlines 2018-10-16 23:04:24 +03:00
Tor Lillqvist
cab2f9b6bb Add fakeSocketDumpState() 2018-10-16 01:11:20 +03:00
Miklos Vajna
116510296e net: unnecessary value parameter in Socket 2018-10-15 09:31:03 +02:00
Tor Lillqvist
e907d0ee01 Switch to using just one mutex in FakeSocket.cpp for now
Makes things simpler and easier to follow, I hope. I had hoped it
would also make the occasional hang I see when loading the document go
away, but nope. Possibly it isn't caused by FakeSocket after all, even
if FakeSocket is the obvious first suspect.
2018-10-10 10:31:07 +03:00
Tor Lillqvist
be945ed51b Bin duplicate const variable 2018-10-10 10:31:07 +03:00
Andras Timar
3c005f952a fix that internal port 9981 was opened on all interfaces
Change-Id: I04cd12b7fa2f0be9b08a3d325f08b36ca2ce240e
Reviewed-on: https://gerrit.libreoffice.org/61296
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
2018-10-05 16:38:03 +02:00
Tor Lillqvist
06051c833b Comment out log.dump() call again
Change-Id: I27ecd6712e72182f3a943e7be86ef5ba7b05f746
2018-09-20 13:38:53 +03:00
Tor Lillqvist
f4ce5df7e1 Implement the timeout parameter to fakeSocketPoll()
Adapt callers that mistakenly passed 0 assuming it meant "forever".

This also seems to help with the occasional hangs.
2018-09-19 20:03:24 +03:00
Tor Lillqvist
5ee96e0271 Small correction to poll semantics 2018-09-19 20:03:24 +03:00
Tor Lillqvist
8b5246b038 Bin one presumably pointless lock and unlock 2018-09-19 20:03:24 +03:00
Tor Lillqvist
9c57ffd3b3 Avoid potential deadlock 2018-09-19 17:55:14 +03:00
Tor Lillqvist
95eb849217 Still more iOS app and related Online C++ code hacking
Re-think the plumbing between the different parts of the C++ Online
code. Do try to have it work more like in real Online on all but the
lowest socket level. Except that we don't have multiple processes, but
threads inside the same process. And instead of using actual system
sockets for WebSocket traffic between the threads, we use our own
FakeSocket things, with no WebSocket framing of messages.

Reduce the amount of #ifdef MOBILEAPP a bit also by compiling in the
UnitFoo things. Hardcode that so that no unit testing is ever
attempted, though. We don't try to dlopen any library.

Corresponding changes in the app Objective-C code. Plus fixes and
functionality improvements.

Now it gets so far that the JavaScript code thinks it has the document
tiles presented, and doesn't crash. But it hangs occasionally. And all
tiles show up blank.

Anyway, progress.

Change-Id: I769497c9a46ddb74984bc7af36d132b7b43895d4
2018-09-19 11:31:18 +03:00
Tor Lillqvist
a4f19ac229 Avoid double "0x" prefix for pointer values in log output
No need for explicit "0x" and std::hex when outputting a pointer. A
pointer will be output as a hex number anyway. We used to have things
like this in the log:

TRC  #25 Connected to WS Handler 0x0x3610b60| ./net/WebSocketHandler.hpp:80
2018-09-19 10:33:41 +03:00
Tor Lillqvist
763a27280a Add possiblity to force logging to stderr with environment variable
At least LOOLWSD.cpp has a couple of global variables of types that in
their constructors invoke FakeSocket APIs. If we turn on FakeSocket
logging (fakeSocketSetLoggingCallback()) only in the app's
initialization code, we will miss logging from those global variable
constructors.

Sure, the clean solution would be to turn those global variables into
members in the LOOLWSD class instead, but this will do for now.
2018-09-18 15:31:01 +03:00
Tor Lillqvist
c09dfda052 In the logging always precede FakeSocket "fd" numbers with #
Makes it easier to search log files.

Also, Online uses this convention for socket fds in many places (not
sure if consistently).
2018-09-18 13:04:16 +03:00
Tor Lillqvist
435718e9f3 Improve shutdown semantics 2018-09-18 13:04:11 +03:00
Tor Lillqvist
53416a290d Add fakeSocketShutdown() and drop fakeSocketFeed()
Not sure whether the shutdown() implementation matches real shutdown()
semantics, especially with regards to the behaviour of poll(), read(),
and write() (on both the socket itself and the connectd one)
afterwards. But let's see.

The feed() API turned out to be not needed. (And in any case, it was
suposed to be completely equivalent to writing to the peer socket.)
2018-09-17 20:44:18 +03:00
Tor Lillqvist
7fd28d5676 Revert part of my iOS related commit, causes compilation warning with Clang
Won't actually be needed anyway, the way the code is going in my work
tree.

Change-Id: I4480ed59fe96ddcfad8483517f2a23452606f332
Reviewed-on: https://gerrit.libreoffice.org/60576
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-09-17 12:51:07 +02:00
Tor Lillqvist
3bcde388ed FakeSocket poll fix and minor hacking
fakeSocketPoll() needs to return a correct return value.

Use notify_all() instead of notify_one(). Just to see if it makes any
difference.
2018-09-16 22:39:44 +03:00
Tor Lillqvist
7399a86f6a Use optional logging callback in FakeSocket.cpp instead of hardcoded writes
It's easier to either call the function to set the logging callback,
or not, in one place in client code, than to comment in and out all
the logging lines in FakeSocket.cpp as needed.

Change-Id: Id17f7e461c7df817440b47cb3124fcece13b189b
2018-09-16 13:39:43 +03:00
Tor Lillqvist
30ec64566b Attempt to fix various FakeSocket problems
Also add a bit of internals documentation.
2018-09-16 10:42:01 +03:00
Tor Lillqvist
0a2868b8d4 More FakeSocket hacking
As we use #ifdefs at all call sites anyway (because we don't dare use
the generic overrides of close() etc), we can leave out the parameters
related to actual BSD sockets that we ignore anyway.

"Real" Online always uses non-blocking sockets. We don't need to take
flags for that or check it. We can hardcode such behaviour always.
(Assuing that is what we want; let's see once something works.)

Change-Id: I6863907d71c5599b00ce1f8305a44d41bbaf7bee
2018-09-15 12:35:23 +03:00
Tor Lillqvist
55a2f804a6 Change the FakeSocket to be record-oriented
That is how Online uses the sockets for communication between the
processes anyway: It send and receives complete WebSocket frames.
Sure, in the mobile case there is just one process, but (I think) we
want to keep the same basic structure anyway, even if "wsd" and "kit"
are just threads. (We probably also want to drop the WebSocket framing
of the messages.)

Change-Id: I2397f321029c1cbbbc448a9b2403ad185a51cf14
2018-09-15 12:34:29 +03:00
Tor Lillqvist
6d81ebcfeb Add FakeSocket
Intended as a replacement for the real sockets used for WebSocket IPC
in Online on Linux. The idea is that in a mobile app we don't want to
bother with any actual sockets or WebSocket protocol (because we are
running as a single process after all), but keep much of the code that
thinks it is using such mostly unmodified. Just an idea so far, let's
see how this turns out.

Change-Id: I7878b0db99d9cbf70650227186c1fec9677fa74b
2018-09-15 12:30:50 +03:00
Tor Lillqvist
4841ee4f47 Move SocketPoll::pollingThreadEntry() implementation to cpp file
Makes it easier to put a breakpoint in it in Xcode...

Not sure if we have any consistent convention around here anyway about
which member functions should be defined inline in the class
definition in the hpp file, and which ones should be in the cpp file.
2018-09-13 09:33:40 +03:00
Tor Lillqvist
b59d160a08 Intermediate commit of work in progress on an iOS app
The app is unimaginatively called "Mobile" for now.

Runs but crashes pretty quickly after loading the document by the LO
core. Will need some heavy changes to get a ClientSession object
created in there, too, to handle the (emulated) WebSocket messages
from the JavaScript. It would then handle some of these messages
itself, and forwards some to the ChildSession, which in this case is
in the same process. Now the messsages from the JavaScript go to a
ChildSession, which is wrong. As the assertion says, "Tile traffic
should go through the DocumentBroker-LoKit WS"
2018-09-12 18:32:05 +03:00
Tor Lillqvist
5f779e0295 Revert "Just define these static const int members in-class"
Can't say I understand why, but this turned out to not be a good idea
after all. And no, using constexpr did not work either, so I won't
waste any more time on this triviality, but just revert.

This reverts commit 195b88ac8d.

Change-Id: I49f737dc6a36fa4808841cb8e0335246ad8c6d03
2018-09-11 11:39:56 +03:00
Tor Lillqvist
195b88ac8d Just define these static const int members in-class 2018-09-10 16:10:53 +03:00
Tor Lillqvist
75438baa70 More mobile app stuff, very much early state of work in progress
Re-think Linux vs mobile ifdefs a bit. Use #ifdef __linux only to
surround code that actually is Linux-specific. Use #ifdef MOBILEAPP
for code that is for a mobile version (with no separste wsd, forkit,
and kit processes, and with no WebSocket protocol used).

Bypass UnitFoo for mobile. Possibly we do want the UnitFoo stuff after
all on mobile, to run in some special testing mode? Hard to say, let's
skipt it for now.
2018-09-10 15:13:43 +03:00
Tor Lillqvist
997503a8d1 Make this file compile for iOS
Again, note that I don't claim this file (or the code-base as such)
would make much sense for iOS as such at the moment. I just want it to
compile for now. Baby steps etc. (And there is no public Xcode project
to compile it even partially.)

Change-Id: I1321d61e9e911c7d97c7309b78aab46d9cecec29
2018-09-04 12:24:48 +03:00
Tor Lillqvist
d07f686b28 Make this file compile for iOS 2018-08-29 20:56:59 +03:00
Tor Lillqvist
ff31f2dba1 Avoid potential confusion by not using the term "packet" in a comment
It confused at least me for a while into pondering whether the code
thinks TCP is packet-oriented.

Change-Id: I143fc7821abd6b4023d551cdcb42a00e1613e466
2018-07-19 11:39:45 +03:00
Tor Lillqvist
6b96c73f46 Don't log binary data as such, use Util::stringifyHexLine()
Also, log the cases with still incomplete data in the buffer
separately.

Change-Id: Idfa915378c2823dd898789d6a63a0cd71a817b8a
2018-07-19 11:36:11 +03:00
Tor Lillqvist
1e7a56ddc6 Add FIXME: Do we really want to log binary data as such here?
Change-Id: I386d3c377d698f25da5094d87cd82183fc36aee4
2018-07-18 21:16:49 +03:00
Tor Lillqvist
3b4269a301 Use Util::symbolicErrno()
I think the general policy should be to always log errno using both
Util::symbolicErrno() and std::strerror(), never log a naked errno.
But only in cases where we know that it is highly likely that it is
the most recent system call that has failed, so errno makes sense.

Change-Id: I4a1fb31e375ea949e7da17687464361efe7c1761
2018-07-11 13:05:22 +03:00
Tor Lillqvist
a97c8c3455 Fis our use of inet_ntop() etc
We had:
    auto ipv4 = (struct sockaddr_in *)&clientInfo.sin_addr
even if the clientInfo variable itself was a struct sockaddr_in.

And then we also had:
    auto ipv6 = (struct sockaddr_in6 *)&clientInfo.sin_addr
which makes even less sense.

Instead, make clientInfo into a struct sockaddr_in6, which is big
enough to also to be interpreted as a sockaddr_in. Pass the address of
the correct field, either sin_addr or sin6_addr, to inet_ntop(). (Note
that sin_addr in sockaddr_in has a different offset than sin6_addr in
sockaddr_in6.)

At least on my Fedora 28, when I connect using IPv4, accept4() still
returns the client address as an IPv4 mapped IPv6 address, that is
::ffff:192.168.1.113 for 192.168.1.113. So the sample
net.post_allow.host value in loolwsd.xml.in should probably be changed
to have that ::ffff: prefix, too.

Change-Id: I0ad774616b210d94b904982e2f7dc928adc879ed
2018-07-10 23:14:51 +03:00
Michael Meeks
a521527777 Fix logging a little.
Change-Id: I858ffb40e071eae3907eeff9c2d6291fd805dc02
2018-06-15 17:38:12 +01:00
Michael Meeks
7e6e81eb46 Implement client websocket masking.
Disable this for easy strace debugging and a bit of perf. to the forkit.

Change-Id: Ia330582817481410d26df50db5eb42b4692ad01c
2018-06-15 14:54:19 +01:00
Michael Meeks
5741d76a5d Outgoing websocket - remove silly stuff.
Change-Id: I53d763158007221e9df327ec9d3b07ad2029cbfd
2018-06-15 14:54:19 +01:00
Miklos Vajna
65df3e6ceb net: use std::move() in the StreamSocket ctor
It was inconsistent that the StreamSocket ctor had a const parameter,
but the SslStreamSocket had a non-const one and used std::move(). Use
the later in the parent class as well for consistency.

Change-Id: I58597b97432a801d164d6ed9d831a0372280e687
2018-05-24 08:50:30 +02:00
Jan Holesovsky
93cc4b4548 Use std::shared_ptr consistently.
Change-Id: I6bf3ff7de47010fd78fab26a5a318bde21c1f153
2018-05-18 15:16:40 +02:00
Jan Holesovsky
6996139e5f Use correct path in the client websockets.
Change-Id: Ie0bf6646ff3f6e6cf99b505143a416c86a3a33b8
2018-05-18 15:16:40 +02:00
Jan Holesovsky
98ed24257b Move the functionality from connectToMonitor() to SocketPoll.
Change-Id: Iab2ac09638323f5e59f7a2ea0d880f52989ad64d
2018-05-18 15:16:40 +02:00
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
Jan Holesovsky
ca587f4070 The WebSocketHandler::handleClientUpgrade() needs to handle a Response,
not a request.

This commit includes some fixes from Michael Meeks too.

Change-Id: I25198ded9d354a44d7718071394bcccdcabcdd94
2018-05-18 15:16:39 +02:00
Michael Meeks
4cf2ee4fab Get ping/pong handling sorted with more isClient conditionality.
Change-Id: I859ed5b5bcc302304e23ad3554247af920de2421
2018-05-18 15:16:39 +02:00
Michael Meeks
80a13a1e7b More work on client / Monitor websocket connections.
Change-Id: Ic70fe522e24f2b1863c2d9d1dd6941785510758a
2018-05-18 15:16:39 +02:00
Michael Meeks
b483f477dd Allow a 'monitor' to be connected to remotely if configured.
So far monitors have the access an permissions of an
authenticated admin.

Change-Id: I59dfa8a646a60584a5c113ee0521e9afba4f6b76
2018-05-18 15:16:39 +02:00
Andras Timar
d66e8d13b7 serve files with old gith hash in their path, that comes from cached discovery.xml
moreover:
* noCache is always true in debug mode
* when noCache is true we return an explicit "Cache-Control: no-cache" line

Change-Id: I157a410df0a90f9ab151b899e44566b95cbd9929
Reviewed-on: https://gerrit.libreoffice.org/54517
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2018-05-18 14:17:23 +02:00
Michael Meeks
adb3112820 Use inet_ntop for ipv6 address names.
Change-Id: Ic52b69eb2dc86b6532a78d770531b2fac928fb28
2018-05-14 12:03:17 +01:00
Michael Meeks
b5a1af763c Share HTTP header parsing inside the StreamSocket.
Change-Id: Id98e895a939d931ac10b7cd7403da4cbe822ee82
2018-05-01 16:29:56 +01:00
YiiChang Yen
910ae806ef wsd: to filter clientAddress before POST action.
Change-Id: I293580f041bc46b36c57f63fe4a2c0131763b3c1
Reviewed-on: https://gerrit.libreoffice.org/50977
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2018-04-30 18:50:06 +02:00
Miklos Vajna
e5c7c62713 'static const int' needs an explicit definition in C++11
core.git equivalent situation is e.g. SwXMLTableContext::MAX_WIDTH.

Change-Id: Id6f4201e875a7453ab2363161ea9560ae6e40384
2018-02-26 16:34:01 +01:00
Ashod Nakashian
71f4597059 wsd: WebSocket state is a property of the socket
This resolves the erroneous warnings of pinging
on a non-upgraded (i.e. HTTP) socket.

This was due to the fact that we moved the socket
from one SocketHandlerInterface to a WebSocketHandler
after upgrading and since the WSState was a property
of the handler, the WebSocketHandler didn't know
that the socket had already been upgraded.

Also other cosmetics and cleanups.

Change-Id: I1a88edef750117ed551d23245e49380371561422
Reviewed-on: https://gerrit.libreoffice.org/49911
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2018-02-23 16:42:22 +01:00
Ashod Nakashian
7be98efd93 ut: log timestamp to track timeouts better
And improve the logging support in unit-tests to
help troubleshoot issues faster and more accurately.
Also makes the code more readable (hopefully).

Change-Id: I4f8aafb5245e2f774b03231591a74544f9ec84aa
Reviewed-on: https://gerrit.libreoffice.org/48645
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2018-02-11 19:21:15 +01:00
Pranav Kant
39f11ab4f7 document conflict: unit test
Change-Id: I4ea310fe5adb198bc7b5e083f6bd4b0431c0cdef
2018-02-09 00:22:57 +05:30
Miklos Vajna
b68bd83f6e net: spell out non-trivial autos to improve readability
Change-Id: I71f080f818e91f1d450cf858ab4aa8a3300308f2
2018-02-07 10:18:12 +01: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
Michael Meeks
a1ee97c222 Add IPv6 support, and configuration option.
Default to listening on both IPv44 and IPv6 for public interfaces.

Change-Id: Ib04e3bf65e7dcf2a798d381297b15ee9c56e9259
2018-01-09 22:03:17 +00:00
Ashod Nakashian
57d535b15b wsd: lambda cleanup and better readability
Change-Id: Iabb850be7a7c162847514ee0fb600297accfcffb
Reviewed-on: https://gerrit.libreoffice.org/47364
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2018-01-06 22:13:50 +01:00
Pranav Kant
9cbef14160 loplugin:nullptr
Change-Id: I5f0dc970e8522b63570faa0ba05ab19dd0f45d5a
2017-12-20 22:36:41 +05:30
Pranav Kant
f63858433b loplugin:includeform
Change-Id: Ib62a7aa61062f00698aa3e8a144438de5c57e53d
2017-12-20 21:21:05 +05:30
Jan Holesovsky
73d7aee2ac Fix an assert.
Change-Id: I5825a19740c0fa46c6cd14f067d0c1d3927c0c0b
Reviewed-on: https://gerrit.libreoffice.org/46236
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2017-12-11 15:28:19 +01:00
Michael Meeks
0778b72697 Dump hex contents of un-shared memory.
Change-Id: I47dfa8a0b48d0ba34b7462301b83e2721617814d
2017-11-29 03:33:16 +00:00
Pranav Kant
483a5d68e5 tdf#114073: Potential fix for crash with openssl1.1
Using null ssl context to set options is surely not a good idea:

unsigned long SSL_CTX_set_options(SSL_CTX *ctx, unsigned long op)
{
    return ctx->options |= op;
}

Change-Id: I2700350e0c3928e372488c81b8111c9ab0b48e06
2017-11-27 16:31:21 +05:30
Michael Meeks
ec80d623b8 Edit the right configuration XML file.
Change-Id: If72006918550ee5c440ad6b2ff26a5bd0d1efef1
2017-11-22 16:47:05 +00:00
Michael Meeks
92379ffbf2 Make the WSD SSL cipher list configurable.
Change-Id: If79b9efc9438cf0a2345b8e81385adafef63ce22
2017-11-22 15:55:03 +00:00
Jan Holesovsky
343c5bc690 tdf#99744 SaveAs: Extend test to check that the Save As result was sent.
Change-Id: I3788b87d2599c01000af97f496ee2b840c0cae3e
2017-10-26 11:11:38 +02:00
Tor Lillqvist
6b0faf9d97 Avoid warning "this statement may fall through" when intentional
Change-Id: I8d8bcb4747a1933e4ecefe1220a80a355e60317f
2017-10-26 11:38:43 +03:00
Christian Glombek
702bbdd5d8 Add Support for OpenSSL 1.1.0
Change-Id: I0aa58b893e8577bba94fa45c0c4c81449b12e4e2
Reviewed-on: https://gerrit.libreoffice.org/42356
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2017-09-20 03:48:08 +02:00
Miklos Vajna
f375a9d5de Socket: mark setNoDelay() as non-virtual
No derived classes override it, and if they would, that would be a
problem, as setNoDelay() is called from init(), which is called from the
Socket ctor. Calling virtual functions from the base class ctor is not a
good idea, since the object is not fully constructed yet.

Change-Id: I4993e26d09f5d3429c7e2afae7688b84c0061c9d
2017-09-18 10:15:59 +02:00
Miklos Vajna
bcb5b744b8 net, wsd: fix -Werror,-Wdelete-non-virtual-dtor warnings
Two problem types:

- non-final class has virtual functions but no virtual dtor -> mark the
  class final
- abstract class has no virtual dtor -> add a virtual dtor

Change-Id: Iae208b65c774e6da7a3dda5e725fe07d4d589e4f
2017-09-12 10:03:32 +02:00
Ashod Nakashian
4f8ebca0cb wsd: free leaking memory
With help from Valgrind to find and verify
these leaks.

Change-Id: I3afeed89dc4bcd714a222f81822144477a346fb0
Reviewed-on: https://gerrit.libreoffice.org/39464
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-07-03 05:42:38 +02:00
Miklos Vajna
4faa3d5a70 net: remove unused using declarations in clientnb
Change-Id: Ifa7aed29160b49930c41f7cc465c8315bfca9992
2017-06-23 10:29:44 +02:00
Miklos Vajna
ffbe55adb5 SocketDisposition::setMove(): parameter is passed by value, move it
Change-Id: I2c7facfc4fc5422cef886c6ba28ac60c656a908e
2017-06-21 09:07:27 +02:00
Michael Meeks
3101fa510d Accumulate I/O stats per document.
Change-Id: Ie2f5647e65070ddd828f048820efd38b600f9133
2017-06-02 20:41:25 +01:00
Michael Meeks
c224413a9d Track bytes recv'd and sent on StreamSockets.
Dump on USR1 as part of our state.

Change-Id: I4c6b87c19bca768402c9b0b8e26f16336e007749
2017-05-26 15:54:58 +01:00
Ashod Nakashian
bdd8b715dd wsd: include cleanup
Change-Id: I9f28ee329e318043c31c899d3a07cd3139d838f0
Reviewed-on: https://gerrit.libreoffice.org/37890
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-22 07:04:24 +02:00
Ashod Nakashian
7cff4fb08a wsd: fix server shutdown
Thread-affinity checks must be inhibited
not just on Socket, but on the SocketPoll as well,
before destroying DocumentBroker instances.

Also, properly initialize the inhibit statics.

Change-Id: I2ced1554d477f0c3faf09bda74034cbae99e4ce1
Reviewed-on: https://gerrit.libreoffice.org/37608
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-15 05:10:31 +02:00
Michael Meeks
29b92444b1 Stream dumpHex output to an output stream.
Also output debug directly to stderr to avoid std::cerr re-direction.

Change-Id: Ib2a0eaa3514ef88d7fe8d8fbb3706925aabf3346
2017-05-12 03:06:49 +01:00
Michael Meeks
495d6da532 Reset ownership before executing the socket move.
Change-Id: I98532e59ef9c78a6cc1eb25a5a8535c4e2d9b15d
2017-05-09 13:02:23 +01:00
Michael Meeks
c04e4ffa16 loolnb - kill obsolete test app.
Change-Id: I5943cc0752f16d62d6eedf96351bb6f71a2311e6
2017-05-05 18:53:00 +01:00
Michael Meeks
9e45fb30d7 SocketDisposition: push it down the stack, and cleanup around that.
Dung out overlapping return enumerations. Move more work into 'move'
callbacks at a safer time, etc.

Change-Id: I62ba5a35f12073b7b9c8de4674be9dae519a8aca
2017-05-05 18:37:26 +01:00
Michael Meeks
faf24f7888 SocketDisposition - controls socket movement & lifecyle.
It is important that moving sockets between polls happens in a
safe and readable fashion, this enforces that.
2017-04-25 22:49:08 +01:00
Michael Meeks
ec12a0e16b DelaySocket: kill warning. 2017-04-24 11:39:31 +01:00
Ashod Nakashian
8b3a2ed9d7 wsd: reduce included headers
Change-Id: I3107b18b2edae34a76e9f56a5cbd24836b1b57c0
Reviewed-on: https://gerrit.libreoffice.org/36872
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-24 06:52:02 +02:00
Ashod Nakashian
988ddaf7be wsd: cleanup sendFile to allow header-only response
HTTP HEAD verb requires sending back NO content.

Currently we don't support HEAD and that harms
the browser from using its cache where possible.

Change-Id: I3c67dc106df95312c73f6ae786b7b1657a4167fb
Reviewed-on: https://gerrit.libreoffice.org/36871
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-24 06:47:42 +02:00
Michael Meeks
5d0e4fa020 DelaySocket: hide logging. 2017-04-22 18:42:16 +01:00
Michael Meeks
63aba6be1a DelaySocket: working, and much cleaner / simpler. 2017-04-22 18:42:16 +01:00
Michael Meeks
26a6d514d5 DelaySocket - simplified but working.
Assume for now that we have infinite space in-transit.
2017-04-22 18:42:16 +01:00
Michael Meeks
1c7f94045a Initial DelaySocket goodness. 2017-04-22 18:42:16 +01:00
Jan Holesovsky
47ca32beb5 We never call setNoDelay() with false.
Change-Id: I865027300559b185222f21faa48ccd32100bd02d
2017-04-19 11:07:55 +02:00
Michael Meeks
f72b7d2ba1 Don't set the buffer size to zero.
This slows things down terribly, particularly the setting on the websocket
made tiles appearing one by one. Let's keep the possibility to zero the buffer
sizes for debugging, but hide that behind an env. variable (and in debug
builds only anyway).

Change-Id: Ie4d2cdb3c0ec3c50f1a2b4f9941a462ac4f2d196
2017-04-19 10:58:18 +02:00
Ashod Nakashian
9b3a22aafe wsd: save document upon server shutdown
The server correctly saves all documents
and waits to upload them before exiting.

Change-Id: I04dc9ce588bc0fa39a9deb298d0a5efa61a03f1a
Reviewed-on: https://gerrit.libreoffice.org/36654
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-19 07:04:26 +02:00
Ashod Nakashian
1262378301 wsd: send document unloading error as WS message
Without an explicit WS message, the client
does not get this message and the handler
is not invoked at all.

Change-Id: I71e210a9958965cff35dd4d0f1d99985429b82f4
Reviewed-on: https://gerrit.libreoffice.org/36593
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-17 06:49:23 +02:00
Jan Holesovsky
e0f7c3fc67 Set the _owner even in the release builds.
We are warning about thread affinity even in the non-debug builds.

Change-Id: Ia91170765e9f4a29939dee847899345e9396d2c3
2017-04-10 14:55:04 +02:00
Ashod Nakashian
cdb80e5632 wsd: assert valid socket where it counts
Change-Id: I19faa175066cab4e0435f6a8bf29e6b051c86420
Reviewed-on: https://gerrit.libreoffice.org/36330
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-10 06:09:21 +02:00
Ashod Nakashian
0dab4b597d wsd: return the actual number of bytes written to WS
Change-Id: Ib28c432927733ffd437d27dec749d402d25b9024
Reviewed-on: https://gerrit.libreoffice.org/36323
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-10 06:07:59 +02:00
Ashod Nakashian
e00817acf6 wsd: fix pinging and add logs
Apparently pinging was enabled only when
_not_ WebSocket upgraded, which is wrong.

Removed sending ping immediately after
upgrading to WS as it's superfluous.

Change-Id: Ic8103bab063d87f58d371f0eab49f7b7530e2374
Reviewed-on: https://gerrit.libreoffice.org/36322
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-10 06:07:25 +02: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
Pranav Kant
61b7112aa7 security: X-Content-Type-Options: nosniff
Don't think it is necessary/useful to have this header at other places.
This is the most important and perhaps the only where presence of this
header is required and seems sensible to prevent potential attacks.

Change-Id: Iad318e4b83264ac83620b86a40a49e7384e4015e
2017-04-09 23:32:06 +05:30
Michael Meeks
254de88a58 Clear ownership of socket while it is being transferred.
This addresses a gap between ServerSocket accepting new sockets,
and their being added to their new polls.
2017-04-07 20:59:34 +01:00
Miklos Vajna
b31474690a net: Socket::assertCorrectThread() can be non-virtual
None of the subclasses override it, and if they would, it would be
problematic, since e.g. the StreamSocket dtor calls it (and virtual
calls during dtors are a problem).

Change-Id: Ie0891349808a81539078fd1f2d95a55a4ce5107a
2017-04-07 09:40:00 +02:00
Michael Meeks
3d945a5c38 Revert "Don't cleanup DocumentBrokers that still have their thread running."
This reverts commit df8dc43be4.

DocumentBroker::isAlive already checks _threadFinished.
2017-04-06 16:35:55 +01:00
Michael Meeks
df8dc43be4 Don't cleanup DocumentBrokers that still have their thread running.
Plenty of time to do that next time around the cleanup.
We should still, really be doing the majority of the timeout work
inside the DocumentBroker poll itself.
2017-04-06 16:24:54 +01:00
Pranav Kant
2124ec30c6 net: Disable deflate unconditionally
First reason is that compression is very slow, and we re-compress the
files again and again.

Another reason is that IE/Edge doesn't work well with deflate turned on.
Related: https://connect.microsoft.com/IE/feedbackdetail/view/950689
The documents are not loaded at all with current code snapshot modulo
this patch.

Change-Id: I1fdd85856f448dc4ce02e1ab79e9c7474c3bb7f3
2017-04-06 20:40:51 +05:30
Ashod Nakashian
a4176cf2f5 wsd: don't invoke poll handler when invalidated
Only during shutdown do we expect a callback
to invalidate the pollSockets, but if it happens
we shouldn't invoke the poll handlers.

Change-Id: I2f56da19aec2f04cc871bd4eae1f93da110e0eb9
Reviewed-on: https://gerrit.libreoffice.org/36189
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-06 07:37:51 +00:00
Ashod Nakashian
3d03a0fb5d wsd: accomodate accept_poll shutdown
When shutting down accept_poll from
main, we can't remove sockets or cleanup.
That work needs to be done fro within accept_poll's
thread. This is different from when DocBroker's
poll needs to cleanup its own sockets before
it exists.

So we split the stop and removeSockets so they
can each be called in the proper way.

For accept_poll and others that joinThread
we queue a callback to cleanup before stopping.

Change-Id: If780d6a97ac0fc6da6897f895d5b4dda443f9e73
Reviewed-on: https://gerrit.libreoffice.org/36186
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-06 07:01:18 +00:00
Ashod Nakashian
4a7a0fb477 wsd: remove sockets when stopping poll thread
And assume correct thread if poll thread is
not running (i.e. no race).

Change-Id: I17958e682aba434ebb47fe0de199b9f530b54dee
Reviewed-on: https://gerrit.libreoffice.org/36183
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-06 06:19:06 +00:00
Ashod Nakashian
cbe6f0c813 wsd: move prisoner socket in the poll thread
Change-Id: I4097da97d4485d98618604c039a4570efe52bc19
Reviewed-on: https://gerrit.libreoffice.org/36181
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-06 06:12:39 +00:00
Michael Meeks
737f7111b0 Set thread owner to zero earlier to avoid race.
Stop-gap fix, while we come up with a nice API for transferring
sockets between SocketPolls, and/or detaching them generally.
2017-04-05 21:01:48 +01:00
Michael Meeks
185540bcde Inhibit thread checks for SIGUSR1 handling.
USR1 handling is not thread-safe; we walk the structures and hope.
2017-04-05 17:58:52 +01:00
Jan Holesovsky
b6270fae57 setThreadOwner() is now needed in the release builds too.
Change-Id: I1a60bcbac4251866739fee59994a202394339015
2017-04-05 14:54:54 +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
Jan Holesovsky
37387518f4 Suppress assert()'s in the production builds.
Change-Id: I2074ed335b7201337e6519440ff6bed1809be915
2017-04-05 12:03:33 +02:00
Jan Holesovsky
d345c29a47 The other isCorrectThread() should be active only in the debug build too.
Change-Id: Ieadb7e14f70752f5cfb2fd9ee569b56fb39d528b
2017-04-05 11:38:48 +02:00
Ashod Nakashian
463f26f417 wsd: mark detached sockets to have no owner
The DocBroker might not get a chance to
take ownership of a socket (which is done
via callbacks that are invoked in the poll loop)
if it (or WSD) is flagged for termination.

In that case, DocBroker doesn't take ownership
but ultimately needs to disconnect the socket.

By detaching ownership we signal that any thread
can rightly take ownership and thus avoid spurious
warning or assertions.

Change-Id: Idb192bfaac05c5c86809cb21876f3926a080b775
Reviewed-on: https://gerrit.libreoffice.org/36117
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-05 04:47:30 +00:00
Ashod Nakashian
cbd78484ad wsd: warn when waking dead poll
And insert sockets after starting the
thread so we poll the socket immediately.

Change-Id: Id336e1838f2f624ebfe59c4c2caf33eaa1a638c9
Reviewed-on: https://gerrit.libreoffice.org/36110
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-05 04:41:23 +00:00
Michael Meeks
61d912cd6f Use heap buffers for file transfer and disable deflate for now. 2017-04-04 13:18:11 +01:00
Ashod Nakashian
b734284b59 wsd: cleanup deflating HTTP responses
Change-Id: Id21bdfcb5d3e04f27b681ee9581a0ed06283d163
Reviewed-on: https://gerrit.libreoffice.org/36058
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-04 04:29:23 +00:00
Ashod Nakashian
7ca1f03770 wsd: don't invoke onDisconnect from wrong thread
...and warn if we are in the wrong thread.

This can happen when the socket is not properly
closed from the poll thread and is being destroyed.

Change-Id: I749c09b15d04b49038f7cee6a7a13e8f0145acff
Reviewed-on: https://gerrit.libreoffice.org/36057
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-04 04:18:52 +00:00
Ashod Nakashian
762ba09370 wsd: fix SSL initialization/uninitialization error
Valgrind found a number of erroneous data access
during the construction and destruction of SslContext.

Change-Id: Ie5072798a3660ed8acc707ba32ac196fa2d0f8af
Reviewed-on: https://gerrit.libreoffice.org/36055
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-04 04:16:53 +00:00
Jan Holesovsky
a9389687a4 Don't try to clean up after a runtime error.
We don't know in what state we are...

Change-Id: I8d144000ba684ca23ff67977959c95b31de34367
2017-04-03 11:39:09 +02:00
Ashod Nakashian
8932a1e92e wsd: remove LOOL_CHECK_THREADS
isCorrectThread now always checks
with ENABLE_DEBUG.

Change-Id: I2b5747f3ab18c8ebdbc92e7ffc86a2469b8c7d13
Reviewed-on: https://gerrit.libreoffice.org/36038
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-03 05:18:53 +00:00
Ashod Nakashian
95d51493aa wsd: remove nextmessage
This was a workaround to Poco's limitation
of requiring socket receiveFrame be given
preallocated buffer, which couldn't be
exceeded by a larger payload. This meant
the receiver had to know the maximum
payload in advance.

Since only the Kit uses Poco sockets,
and the Kit never receives large payloads,
this preamble is now obsolete.

100% (94/94) of old-style tests PASS.

Change-Id: I76776f89497409e5755e335a3e25553e91cf0876
Reviewed-on: https://gerrit.libreoffice.org/36037
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-03 05:18:09 +00:00
Ashod Nakashian
b52a8ac6e2 wsd: const correctness and avoid unnecessary shared_ptr promotion
Change-Id: I4352d82e7b5c6873837e73ec04d894dce9a716b7
Reviewed-on: https://gerrit.libreoffice.org/36036
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-03 05:16:49 +00:00
Ashod Nakashian
78d1cc4ac5 wsd: process callbacks before poll handlers
Callbacks are used to initialize handlers,
as is the case with addSession on DocumentBroker.

If the socket gets data before the callback is
invoked, the handler will fail since the expected
initialization hasn't happened yet.

This race indeed happens (rarely) with addSession.

100% (94/94) of old-style tests PASS.

Change-Id: Id9b4f63b45c5564add252e1671b7b0b08aff8150
Reviewed-on: https://gerrit.libreoffice.org/36035
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-03 05:16:05 +00:00
Ashod Nakashian
6e596d11f3 wsd: catch exceptions from callbacks and wakup hook
Change-Id: Ib4579a34c91cfe43e5bd7038b175175a9ab0036a
Reviewed-on: https://gerrit.libreoffice.org/36033
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-03 05:14:58 +00:00
Ashod Nakashian
d7858b08b9 wsd: fix race in setting SocketPoll owner thread id
Change-Id: Idace925ab02425ed66ac07efc22ab933d229d42e
Reviewed-on: https://gerrit.libreoffice.org/36032
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-03 05:14:23 +00:00
Ashod Nakashian
d6577654bd wsd: initialization and logging
Change-Id: Icd82a966b94875a65ddb3817c88a3c4c7bedd4ff
Reviewed-on: https://gerrit.libreoffice.org/36030
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-03 05:13:14 +00:00
Ashod Nakashian
e0822f8516 wsd: better thread affinity logging
Change-Id: I9e4bc3fe864aa409dc4874a9d6fc4ab22bfea592
Reviewed-on: https://gerrit.libreoffice.org/36029
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-03 05:11:57 +00:00
Michael Meeks
aeb204fb14 Kill race during DocumentBroker shutdown over child process.
==20033== Invalid read of size 4
==20033==    at 0x466504: ChildProcess::close(bool) (DocumentBroker.hpp:111)
==20033==    by 0x44EA28: DocumentBroker::terminateChild(std::string const&, bool) (DocumentBroker.cpp:1313)
==20033==    by 0x45F70E: DocumentBroker::pollThread() (DocumentBroker.cpp:264)
==20033==    by 0x504B2F: SocketPoll::pollingThreadEntry() (Socket.hpp:486)
==20033==    by 0x7310E6F: execute_native_thread_routine (thread.cc:84)
==20033==    by 0x7AF60A3: start_thread (pthread_create.c:309)
==20033==    by 0x7DF002C: clone (clone.S:111)
==20033==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
2017-03-31 17:28:20 +01:00
Michael Meeks
194c169f68 Remove obsolete write-lock.
The lock was used incompletely & inconsistently, and we should
always and only ever write in the associated SocketPoll's thread.
2017-03-31 14:58:37 +01:00
Michael Meeks
913c469aa8 Cleanup whitespace, return is not a function. 2017-03-30 17:34:52 +01:00
Michael Meeks
a4ac00d854 Add zlib cflags and libs to configuration. 2017-03-30 12:09:12 +01:00
dewana-dewan
4322045667 tdf#106579 - serving gzipped file content
Change-Id: I320b22babf1bf65a0f1d4b1809a6ffb1f5ec8344
2017-03-30 12:09:12 +01:00
Jan Holesovsky
1d335b92ce Avoid extensive warning about a normal situation.
Change-Id: Ie67a12847afddac087f74e4872744b2b8bb07b1e
2017-03-30 11:21:10 +02:00