Commit graph

5194 commits

Author SHA1 Message Date
Michael Meeks
fad3a046ae AdminConsole - get credentials sorted, and serve the HTML pieces. 2017-03-13 21:48:19 +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
Andras Timar
e5fbdb2cde loleaflet: add new localizable files to Makefile.am and regenerate pot file
Change-Id: I6a91186eba13da6745c2cddb6e96b7b148d797dc
2017-03-13 13:03:19 +01:00
Ashod Nakashian
3d78e5f2a1 wsd: improved logging of extant DocBrokers after cleanup
Change-Id: I4de8fde607e9e94cbadd8e100d39e0e21f2f2bdc
Reviewed-on: https://gerrit.libreoffice.org/35126
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-13 04:25:57 +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
c4d27fd060 wsd: prevent and warn when joining own thread
Change-Id: I8405a1aacb1281e52bbd07d32cdcf35bdc484d8b
Reviewed-on: https://gerrit.libreoffice.org/35124
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-13 04:25:04 +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
8901fcf074 wsd: ChildProcess doesn't need friends
Change-Id: I1911920c9b49adecac4ea4d8fc4b0830687b80c7
Reviewed-on: https://gerrit.libreoffice.org/35121
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-13 04:21:25 +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
Ashod Nakashian
851195215a wsd: log testHandshake traffic
Change-Id: Iee79dfe2e7987838a528d5705cbb0d476f73dce7
Reviewed-on: https://gerrit.libreoffice.org/35117
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-13 04:10:26 +00: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
Ashod Nakashian
c939eeab68 wsd: remove the last session immediately if no saving needed
Change-Id: I509c7a83f16caf0d55fcb6af9c7ce707b7a0e389
Reviewed-on: https://gerrit.libreoffice.org/35115
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-13 04:09:36 +00:00
Ashod Nakashian
388d7b1dbf wsd: TerminatingPoll always starts its own thread
Since all TerminatingPoll instances need to fire
a thread, no reason to do it manually and risk
races. Now TerminatingPoll does it in the ctor.

Change-Id: I59850ad48b3789f3a23d01abb05a7f28e5717031
Reviewed-on: https://gerrit.libreoffice.org/35114
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-13 04:09:15 +00:00
Ashod Nakashian
cbd00bf7c8 wsd: simplify DocumentBroker construction
DocumentBrokerPoll is always owned by a
single DocumentBroker instance, so we
can hold a reference to it. This eliminates
the need to hold a shared_ptr to the owner
which, in turn, eliminates the need for
a create wrapper.

Change-Id: I954c9dddcc3b2cfdd5dfcc8248ab3d47a897f684
Reviewed-on: https://gerrit.libreoffice.org/35113
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-13 04:08:40 +00:00
Ashod Nakashian
d1f201c63c wsd: testHandshake test doc filename includes test name
Change-Id: Id741daca14a7590ae66ee2206be99c35fe10fc33
Reviewed-on: https://gerrit.libreoffice.org/35112
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-13 04:08:11 +00:00
Michael Meeks
71a1e188a7 Handle If-None-Match / ETag (hopefully) - hard to test ... 2017-03-11 22:28:59 +00:00
Michael Meeks
51ae42d513 DocumentBroker: log load time and dump it on request. 2017-03-11 22:01:27 +00:00
Michael Meeks
bf8f8f1738 tdf#106488 - fix by disabling un-necessary locking for the kit. 2017-03-11 21:47:21 +00:00
Michael Meeks
1f5b7b6def Include config layer to override kit config simply.
The config is read once during the forkit startup. Add a read-only
user configuration layer, and also disable config writing: no
writable user config.
2017-03-11 21:47:05 +00:00
Ashod Nakashian
57e7d22e28 wsd: logging and formatting cleanup
Change-Id: I5bfbd517c37b6df864d181abe7c70857815b9ece
Reviewed-on: https://gerrit.libreoffice.org/35082
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-11 19:50:08 +00:00
Ashod Nakashian
e9614fc697 wsd: support logging file and line with logger objects
Change-Id: Ibf82105d91ece29c0a4742c6b2e81f6b179c0be4
Reviewed-on: https://gerrit.libreoffice.org/35081
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-11 19:49:09 +00:00
Ashod Nakashian
2e16fd2852 nb: don't read socket data without handling
When we read data, we must also handle it,
otherwise the next poll might have no
more data (the request data was read
completely the first time) and we dead
lock waiting for data to process.

Change-Id: I26c69ecc1f0550e8371cf77a6f3928a7a877eff7
Reviewed-on: https://gerrit.libreoffice.org/35080
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-11 19:48:22 +00:00
Michael Meeks
93d46fc469 Don't treat a session as non-editable when it is not (yet) loaded. 2017-03-10 23:52:28 +00:00
Michael Meeks
5cafa006dc Wakeup poll after queueing a new session. 2017-03-10 23:28:54 +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
3b370022c0 Improve state dumping. 2017-03-10 15:37:09 +00:00
Michael Meeks
7a90430f85 Cleanup logging on single packet websocket messages more cleanly. 2017-03-10 14:49:19 +00:00
Michael Meeks
11f3a29cb2 WebSocket - several messages can appear in a single packet. 2017-03-10 14:36:21 +00:00
Michael Meeks
34d9d52207 Avoid assert failure and zero size socket buffer in product build. 2017-03-10 12:12:10 +00:00
Pranav Kant
eb9c0fa619 Do not create tags file for loleaflet
Change-Id: I0a2103bc4550d6deacddd1bfc07a23a3cf317d07
2017-03-10 17:29:44 +05:30
Michael Meeks
f4f083e6fe Cache JS etc. on the client side for 128 days. 2017-03-10 11:36:10 +00:00
Pranav Kant
ffd00d8824 loleaflet: Allow keeping document always active via PostMessage
To instruct the loleaflet iframe to not dim the document, it needs to
send the message in following format :

{
 MessageId: 'Set_Settings',
 SendTime: 1329014075000,
 Values: {
	AlwaysActive: true
 }
}

Similarly, set AlwaysActive to false to active dimming the screen again.

Change-Id: Icb5d615268e4da2c3ed2f22df8c0f3e52f370a70
2017-03-10 16:37:34 +05:30
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
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
Miklos Vajna
400c580800 net: fix -Werror,-Wconstant-conversion
Change-Id: If2bbad6d3909c7d6df9eed5edf260609d64db3a8
2017-03-10 11:06:43 +01:00
Miklos Vajna
33cbe908c5 net: fix -Werror,-Winconsistent-missing-override
Change-Id: Ia8c1f0233e0b65f5fae01272b4f31638aceac9ee
2017-03-10 10:54:08 +01:00
Miklos Vajna
2e2381b5b3 wsd: fix -Werror,-Winconsistent-missing-override
Change-Id: I0f009aea715e93c90683f333c96a04088d103964
2017-03-10 10:53:40 +01:00
Jan Holesovsky
4ba2325c81 Move Replay.hpp to headers.
Change-Id: Id65e81ce2b8a9b77d910524a00d9f42164365ab2
2017-03-10 10:47:44 +01:00
Ashod Nakashian
5677eb30b7 nb: fix saving when last client disconnects
When the last client session is disconnected
docBroker must first issue a save and wait
until the kit processes the save and sends
back notfication. Since said notification
goes to the ChildSession (which is the last)
and said ChildSession is the one that signals
to docBroker to persist the doc to the Storage,
we need to keep all components alive and kicking
during this final saving.

As such, when the last session is to be removed
from docBroker, we instead issue an autosave and
continue everything as normal. When the save
notification even arrives and ChildSession signals
docBroker to persist the doc, we check if we were
destroying and in that even remove that last session
and stop the polling thread.

The docBroker instance itself will get cleaned up
in due time.

Change-Id: Ie84e784284e1ec12b0b201d6bf75170b31f66147
2017-03-10 10:47:44 +01:00