Commit graph

141 commits

Author SHA1 Message Date
Tor Lillqvist
c2370c56ef Use 'using' consistenly 2016-04-04 09:31:03 +03:00
Tor Lillqvist
8e7196ffa0 Insert LOOLKit.cpp contents into LOOLBroker.cpp
As we don't build a separate loolkit program any more we don't need
LOOLKit.cpp.
2016-04-04 09:23:38 +03:00
Tor Lillqvist
a132e06409 Bin the non-preinit and non-fork code paths
Preiniting LibreOfficeKit and forking kit processes (instead of
spawning) has worked fine for a while, and has been the default way
this works.

No 'loolkit' program gets built any more.
2016-04-04 09:07:59 +03:00
Ashod Nakashian
c118987dc6 loolwsd: Removed Broker <-> Kit pipes
Broker is now just a simple spawn-machine.
It only gets requests from WSD to spawn
new kit instances, which it doesn't even
track.

Once a kit instance is initialized, it
connects to WSD with a control WS.
From there on, it's up to WSD to manage
the kit process.

Also was removed the benchmark logic
since it can no longer function.

Change-Id: I1bf56bc6416c9eadafba637276bbb8b3107e5727
Reviewed-on: https://gerrit.libreoffice.org/23790
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:08:35 +00:00
Ashod Nakashian
f4b80e630a loolwsd: consume new child from wsd
And spawn new child instances.

Change-Id: I51886f4645a1c8944ccde2e0fae415afc7c8fc24
Reviewed-on: https://gerrit.libreoffice.org/23788
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:07:27 +00:00
Ashod Nakashian
ae8ce06162 loolwsd: removed unnecessary from pipe messages
Change-Id: I5fc310f98764b31fc50f877c28d6076bbb14866f
Reviewed-on: https://gerrit.libreoffice.org/23784
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:05:46 +00:00
Ashod Nakashian
aacd162673 loolwsd: FIFO_NOTIFY -> FIFO_ADMIN_NOTIFY
Change-Id: Ia42983010b3962ca9228032817c6f9024a74c59f
Reviewed-on: https://gerrit.libreoffice.org/23783
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:05:31 +00:00
Ashod Nakashian
bcf6ab75b8 loolwsd: statics are PascalCased and other cleanups
Change-Id: I1c7c62eb812d2e727b7256152c0c774350d24b52
Reviewed-on: https://gerrit.libreoffice.org/23782
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:05:10 +00:00
Ashod Nakashian
8a318c879a loolwsd: merged child command dispatching into a single class and renamed
Change-Id: I894849ea7a6c69c084e922c76468c5e9eb621406
Reviewed-on: https://gerrit.libreoffice.org/23781
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:04:55 +00:00
Michael Meeks
0a42ab7b81 Remove bogus 10 second sleep.
Change-Id: If44f28fdca37997eca09679bb9865944909ef4f2
Reviewed-on: https://gerrit.libreoffice.org/23778
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:03:58 +00:00
Ashod Nakashian
285026b6f6 loolwsd: removed PipeRunnable thread from Broker and merged it with main
Change-Id: Ie10f046ed230d891eb0647e409756a34a4b146b8
Reviewed-on: https://gerrit.libreoffice.org/23776
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:03:21 +00:00
Ashod Nakashian
ba7db55353 loolwsd: cosmetics
Change-Id: I6c0c2e088e1e428d45cc56a31e7c1f3b8966dc2b
Reviewed-on: https://gerrit.libreoffice.org/23775
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:03:07 +00:00
Ashod Nakashian
265210741e loolwsd: removed unused read pipe from ChildProcess
Change-Id: I8307488227bf65a6f6fdd829728cd74722a24f58
Reviewed-on: https://gerrit.libreoffice.org/23774
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:02:51 +00:00
Michael Meeks
7f13face52 Attempt at loolbroker benchmark mode.
Change-Id: Ia1d7450b1e99686e3c654f427c231fd7e0cf8254
Reviewed-on: https://gerrit.libreoffice.org/23773
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:02:24 +00:00
Ashod Nakashian
ceaefabc91 Revert "loolwsd: replace fifo for socket WSD -> Broker"
This reverts commit 97c8f35ddf.

Since the Broker design has been extremely simplified,
all communication between Broker <-> Kit are gone.
Only a pipe between WSD and Broker remain.

Temporarily reverting this to apply the Broker redesign,
after which this patch can be reviewed and merged.
This will be easier than trying to merge the redesigned
Broker on top of this.

Change-Id: Ia901fad604008654c01841df62e88918adad45e1
Reviewed-on: https://gerrit.libreoffice.org/23769
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:00:45 +00:00
Henry Castro
97c8f35ddf loolwsd: replace fifo for socket WSD -> Broker 2016-04-03 08:12:10 -04:00
Tor Lillqvist
a20344b520 Bin PipeRunnable::syncChildren() which died in cbabd6177d 2016-04-01 18:57:06 +03:00
Ashod Nakashian
cbabd6177d loolwsd: improved child spawning and management
Spare child processes are now in a separate
container. A FIFO that gives older instances
priority to avoid using instances too young
to have initialized fully.

In addition, spare instances are now
proactively spawned such that there
is at least a minimum number of
spares at any given time.

Change-Id: Ibdb206d88473adb306c274f4af39798c784258a0
Reviewed-on: https://gerrit.libreoffice.org/23647
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-30 02:05:57 +00:00
Ashod Nakashian
2ba9bddf9a loolwsd: logging improvements
Change-Id: Ie656aa9d9f19762a960f6608cdadccf3c7eee665
Reviewed-on: https://gerrit.libreoffice.org/23646
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-30 02:03:25 +00:00
Ashod Nakashian
fe69c4d5b6 loolwsd: pipe plumbing cleanup
Change-Id: I5519235a4601e1e38cedc3f06ffe9386434a292d
Reviewed-on: https://gerrit.libreoffice.org/23645
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-30 02:02:53 +00:00
Ashod Nakashian
ecce874315 loolwsd: new PipeReader class to poll and tokenize pipe messages
Change-Id: I5676b313ca4c7e711ead04c1491fe36591a00531
Reviewed-on: https://gerrit.libreoffice.org/23644
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-30 01:59:31 +00:00
Ashod Nakashian
9150d560c0 loolwsd: thread -> session
Change-Id: I7d9f84a2c9afea5f541f5815929745d2de93c8fa
Reviewed-on: https://gerrit.libreoffice.org/23642
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-30 01:56:45 +00:00
Ashod Nakashian
59db6cbc09 loolwsd: recursive_mutex -> mutex in LOOLBroker
Change-Id: I72be54cc67b965bbd13a6630d1243d8d59ba0fc4
Reviewed-on: https://gerrit.libreoffice.org/23641
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-30 01:55:55 +00:00
Ashod Nakashian
3d2c2fde3b loolwsd: logging and misc cleanup
Change-Id: If3cea8191fe15fc752c436cd33d2a68dc2d88598
Reviewed-on: https://gerrit.libreoffice.org/23638
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-30 01:46:34 +00:00
Ashod Nakashian
ce2fabb733 loolwsd: moved IO utilities into IoUtil file
Change-Id: I1e8d5562787134cbb490c38b19d83b7514ec9baa
Reviewed-on: https://gerrit.libreoffice.org/23586
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-29 14:09:04 +00:00
Tor Lillqvist
a219819ebf Avoid defining constant strings in multiple places
It is not a good idea to have the same string somewhat arbitrarily
both as a static const members of the LOOLWSD class and then as a
file-local static const in another file. Or defined as a separate
local const static in each compilation unit that includes
Common.hpp. Use constexpr instead, in Common.hpp.
2016-03-28 14:17:30 +03:00
Ashod Nakashian
a35006cdef loolwsd: no need to lock in destructor
Change-Id: I1650bc5b44c23f1de8b5f65e621da43f1a2755eb
Reviewed-on: https://gerrit.libreoffice.org/23529
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-26 16:53:07 +00:00
Ashod Nakashian
ca9c14dfdd loolwsd: logs and comments
Change-Id: I2fbfb7ee7ada48390bec65ee6911bde00885fbdb
Reviewed-on: https://gerrit.libreoffice.org/23450
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-23 00:03:36 +00:00
Ashod Nakashian
c42ea2ea13 loolwsd: avoid complaining when killing exited child
Change-Id: If819cc2171d241d9e059f2b563cc8f6b8161d304
Reviewed-on: https://gerrit.libreoffice.org/23224
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-14 03:16:07 +00:00
Ashod Nakashian
2a11e1840a loolwsd: improved creating kit sessions
Change-Id: Icc49dc37296fcc87928fc5d4fa4a6a18c3413deb
Reviewed-on: https://gerrit.libreoffice.org/23210
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-14 03:04:56 +00:00
Ashod Nakashian
0d8fcf5699 loolwsd: logging
Change-Id: I9a4dc248aca87983e3d7d3ace0071e5bbf92e688
Reviewed-on: https://gerrit.libreoffice.org/23209
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-14 03:04:17 +00:00
Pranav Kant
e366aa8e0b loolwsd: Support for killing children
Change-Id: Iab62a7e0dab7732f552a1b5f9eb5f67a5b96d74a
Reviewed-on: https://gerrit.libreoffice.org/22991
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-03-08 09:33:12 +00:00
Tor Lillqvist
61ee1ae842 Use std::getenv() instead of Poco::Environment::get()
Much simpler.

Also, don't duplicate the code informing that LD_BIND_NOW or
LOK_VIEW_CALLBACK are not set. Not that I understand why we need to
inform about that? If the "normal" thing should be that they are set,
why don't make it so by default then?
2016-03-08 09:16:01 +02:00
Tor Lillqvist
0194e8d577 Use assert()
It is loolwsd that spawns loolbroker so we control what arguments it
gets, so no need to give verbose errors if our own code is
inconsistent. That is what assert() is for.
2016-03-07 12:57:18 +02:00
Pranav Kant
ada6a74dc0 loolwsd: Basic layout and interaction with AdminModel
Admin web sessions are added as subscribers to AdminModel. Live
notification fill up the AdminModel, and notifies to
subscribers, if present any. AdminModel can also be queried to
fetch any previous data since the start of the server including
expired documents/views with timestamps for analysis.

There is lot of stuff that can be added in future. This commit
just lays the foundation of appropriate classes.

Change-Id: Ifcf6c2896ef46b33935802e79cd28240fd4f980e
Reviewed-on: https://gerrit.libreoffice.org/22869
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-03-03 18:30:33 +00:00
Pranav Kant
c1ca746f66 loolwsd: Make notify pipe accessible from child processes
Change-Id: Id91a38c2997cfb359aff0a42d000e9659653598b
Reviewed-on: https://gerrit.libreoffice.org/22830
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-03-03 18:28:40 +00:00
Pranav Kant
85c6467344 loolwsd: Move Admin class to separate header
As a test, add command to fetch documents from AdminModel.

Change-Id: I3cb7097ba7dde049f3b2478fe7b6b6c309da1d92
Reviewed-on: https://gerrit.libreoffice.org/22781
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-03-03 18:26:55 +00:00
Pranav Kant
1908613951 loolwsd: Factor out pipe reading polling logic
Change-Id: I7c06c68031ea14147130d21376ab348bdc672a7f
Reviewed-on: https://gerrit.libreoffice.org/22820
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-03-03 16:23:21 +00:00
Pranav Kant
c5aa122fcb loolwsd: Create notification pipe
... and Admin and AdminModel containing all the required data
that we need to expose to Admin panel.

Admin processor will keep listening to any data on this
notification pipe and update AdminModel accordingly.

Change-Id: I0dd6f07ae60158733c34d17f53a35def70600513
Reviewed-on: https://gerrit.libreoffice.org/22780
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-03-03 03:34:47 +00:00
Tor Lillqvist
d55ba592b4 Log also when the syncChildren() is done
It does quite a lot of work that can produce very many lines of log,
so it is good to be able to quickly find when that is done when
perusing a log file.
2016-03-02 16:51:53 +02:00
Tor Lillqvist
02913dcbfc Use std:: consistently for cstdlib functions 2016-03-02 08:47:13 +02:00
Tor Lillqvist
73282c50d6 Make preinit the default. Turn off with LOK_NO_PREINIT 2016-03-02 08:26:15 +02:00
Tor Lillqvist
4f701d5d84 Avoid aligning equal signs on sequential lines in a few arbitrary places
If we would use such style, we would need to do it consistently.
2016-03-01 17:28:47 +02:00
Tor Lillqvist
dc305b2b08 Don't confuse Poco::Util::Application::ExitCode and EXIT_SUCCESS/FAILURE
The getChildStatus() and getSignalStatus() functions returned the
latter, still the returned values were compared against
Poco::Util::Application::EXIT_OK. (Sure, both Poco's
Application::EXIT_SUCCESS and stdlib.h's EXIT_OK are zero, but that
doesn't mean one should mix them up.)

Also add two comments pondering the meaning of the code.
2016-03-01 16:49:12 +02:00
Tor Lillqvist
ec33f7b96a Don't use pre-increment when there is no need
We are not interested in the variable being assigned an incremented
value. Its value is not used any more. We are just interested in the
value of the variable plus one. Using pre-increment gives the wrong
impression.

Sure, this is nit-picking.
2016-03-01 15:53:35 +02:00
Tor Lillqvist
673b08bb81 We know that there is a = in the arg as we found a string that includes it
No need to to test again whether it is found. Also, std::strchr()
works fine.
2016-03-01 15:50:39 +02:00
Tor Lillqvist
f8aad3d31f Use the std:: versions of C standard library functions
As mentioned in the coding style part of README.
2016-03-01 15:44:22 +02:00
Tor Lillqvist
aa4fe42d24 English 2016-03-01 13:25:09 +02:00
Tor Lillqvist
9d655cbcc0 Don't pretend this will work on anything except Linux 2016-02-29 14:25:12 +02:00
Tor Lillqvist
fbee03cae2 Minor clarification
No need to pass the value of a variable, initialised much earlier, to
a system call when one can pass the required constant value as
such. Much clearer.
2016-02-23 17:59:52 +02:00