Commit graph

409 commits

Author SHA1 Message Date
Michael Meeks
cacaefc287 perftrace: Annotate idleness and render it better as gaps.
Change-Id: If4d7853d02ca736f8cab12bd9dcc7c4b60ec7d27
2019-04-04 19:18:45 +01:00
Michael Meeks
5fe3cb0a4d Creds.
Change-Id: Iee6f567f3046461c8d034192f282ac7e8fd2f468
2019-04-02 20:18:28 +01:00
Henry Castro
9657e4dfa3 fix build: "sockaddr_un addrunix’ has incomplete type ...
and cannot be defined"

Change-Id: I2c136fc47c800ec3efd6268b4601100033e22724
2019-04-02 10:31:08 -04:00
Samuel Mehrbrodt
71b9faca7c Fix -Werror=maybe-uninitialized
Change-Id: I076fb4b9ef80e4fbf13cdd22cff51ab1e99a2c6c
2019-04-01 14:18:23 +02:00
Miklos Vajna
150ae4e8db net: fix -Werror,-Winconsistent-missing-override
Change-Id: I5e7bce35cd9892a3f74d6d57e094c006bd13b991
2019-04-01 12:00:27 +02:00
Michael Meeks
7b70aab367 peercred: fixup compile issues.
Change-Id: I87d956f5754e7b353776c538b7bb9dfea7f62883
2019-04-01 10:56:15 +01:00
Tor Lillqvist
9c02d82f7c Fix build in the MOBILEAPP case
Did not check how well it works.

Change-Id: I5ca1b349aafcfddaed517e51ca6bd25e9749779d
2019-03-31 14:34:24 +03:00
Michael Meeks
201bcb0762 Use peercreds to identify processes connecting rather than URL params.
Change-Id: I241e80962fb8cf2f3fff1bb4be81d9f0ee74c648
2019-03-30 21:37:05 +00:00
Michael Meeks
81a27e26aa Switch local prisoner sockets to abstract UDS
Unix Domain Sockets are inaddressable remotely, and more efficient,
as well as allowing future SCM_CREDENTIALS / SCM_RIGHTS.

Change-Id: Ia2472260f75feb43e9022cdfa0fe005ccd489454
2019-03-30 16:51:06 +00:00
Michael Meeks
d832fb3c9d Crop socket buffer removal to socket buffer size & warn.
Change-Id: I734b4682941d71eee02a25aab61c8e4353a11718
Reviewed-on: https://gerrit.libreoffice.org/69948
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2019-03-30 17:50:59 +01:00
Tor Lillqvist
08da078546 When FAKESOCKET_LOG_ALWAYS_STDERR, output also the thread id 2019-03-20 15:18:43 +02:00
Gabriel Masei
023cbfc32d Added support for defragmentation of incoming websocket fragmented messages and handled some protocol error cases
Change-Id: I4d11a6527b6b131c65101fd53b71015529645f74
Reviewed-on: https://gerrit.libreoffice.org/68901
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2019-03-12 15:19:42 +01:00
Jan Holesovsky
f76b36193d android: #if(n)def MOBILEAPP -> #if (!)MOBILEAPP for better reliability.
Change-Id: I5f9c9420b6c83601db1c8fdba4ae5a10b17b2107
2019-02-12 12:20:11 +01:00
Ashod Nakashian
9811b0fc98 wsd: reduce warnings
Don't stop the polling thread and attempt cleanup
when the thread is no longer alive; just avoid
logging warnings and other noise.

Demote a couple warning logs to info since
they are neither critical nor actionable.

Change-Id: Ibe8e8491723f1beeaea03a6e935d606b01e275f0
2019-01-22 14:52:40 +01:00
Miklos Vajna
bb2257c2ee net: make members private in clientnb
None of these were used externally.

Change-Id: I2ac504a1c671dd7d315aa4e1a0a5b5e070bec857
2019-01-21 09:13:23 +01:00
Miklos Vajna
6d57f0a005 net: make members private in DelaySocket
Change-Id: I5970d55f0723e46892ed5bea87bb79376c7ea530
2019-01-17 08:46:11 +01:00
Miklos Vajna
85f24ccb55 CRYPTO_dynlock_value: make members private
Change-Id: I5328bd272d4aaef1a445b9ddc5dd4c878d803777
2018-12-03 09:11:22 +01:00
Michael Meeks
d00aa78c9b Don't name parameter after a local method.
Change-Id: I06929d23009b851cf3fb20da5bfe66d9795dcdd9
2018-11-07 17:37:25 +00:00
Michael Meeks
738abc1de7 Respond to SSL/TLS over http - when we don't expect it.
Change-Id: I48c7607cd4e1416fb4ac28c552c2cd96b51d60a6
2018-11-07 17:36:18 +00:00
Tor Lillqvist
f8a0fb4c32 WaE: -Werror=unused-parameter
Change-Id: Icadfcb19ce1fff2b5009d42acf33297cda6e36f2
2018-11-01 21:34:16 +02:00
Tor Lillqvist
9a0decc406 WaE: -Werror=sign-compare
Change-Id: Iaac48bd91864d44ce9442dd68aa26ec74fb5507a
2018-11-01 21:30:16 +02:00
Tor Lillqvist
ffe66b3efc Avoid 'Unused variable' warnings in the MOBILEAPP casse
Change-Id: I30d631559379da4baa5a73712f002435b1a36360
2018-10-30 22:03:04 +02:00
Tor Lillqvist
4ce96fb8ff Don't access nonexistent vector element in the EOF case 2018-10-30 00:47:26 +02:00
Tor Lillqvist
9fec3b0e27 Handle EOF case (when fakeSocketAvailableDataLength() returns 0) 2018-10-30 00:47:21 +02:00
Miklos Vajna
d1e183f20d SocketPoll: make members private
All these protected members are unused by child classes, except read
access to a single member.
2018-10-29 09:06:33 +01:00
Miklos Vajna
5167cf9f58 StreamSocket: make members private
Only a single member needed a setter, otherwise getters were enough.
2018-10-26 09:07:30 +02:00
Tor Lillqvist
a4b4f6bf36 Fix fakeSocketAvailableDataLength() when peer socket is closed
Also bin a few lines of unnecessary code.
2018-10-25 21:57:44 +03:00
Tor Lillqvist
8bc97c0f9e Adapt after 4724aa0cf7 2018-10-25 21:33:57 +03:00
Miklos Vajna
4724aa0cf7 Socket: do what the TODO says
Drop the list of friends and just add getters for the relevant
members.
2018-10-25 16:39:02 +02:00
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