Commit graph

89 commits

Author SHA1 Message Date
Henry Castro
9e3d5c0337 loolwsd: ensure chroot jail every lokit process 2016-02-13 10:15:28 -04:00
Pranav Kant
5a31f99178 loolwsd: Thread name should not be static
... as we can have multiple connections for same document.

Change-Id: Ic213299d6a4ba703f1e27cf252f3a10209f08148
Reviewed-on: https://gerrit.libreoffice.org/22204
Reviewed-by: Henry Castro <hcastro@collabora.com>
Tested-by: Henry Castro <hcastro@collabora.com>
2016-02-08 14:38:02 +00:00
Henry Castro
647d7c7783 loolwsd: first, establish pipe connection 2016-02-02 20:09:26 -04:00
Henry Castro
5fd2be332a loolwsd: use EXIT_SOFTWARE to indicate internal error 2016-02-01 21:53:16 -04:00
Henry Castro
b477f41636 loolwsd: add fatal signals handler 2016-02-01 21:26:19 -04:00
Ashod Nakashian
b596c80e34 loolwsd: simplified child searching
Change-Id: I0d817876f5b83acff69e51c2c64cd6acfa8dc27d
Reviewed-on: https://gerrit.libreoffice.org/21974
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-02-01 05:02:35 +00:00
Miklos Vajna
4b3c5ea8ff loolwsd: doxygenize class comments 2016-01-28 19:16:32 +01:00
Henry Castro
1ff52f2e2c loolwsd: remove unnecessary Poco thread default pool 2016-01-25 11:45:50 -04:00
Ashod Nakashian
65e06c1db7 loolwsd: per ChildProcessSession callback queue and thread
By giving dedicated queue to each session we eliminate
the bottleneck that a slow client will introduce
on every other session on the same document.

Change-Id: I715b80a8cd7bbef1268dc472d0b32e35f3dd6444
Reviewed-on: https://gerrit.libreoffice.org/21763
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-24 23:57:54 +00:00
Ashod Nakashian
904bf929f1 loolwsd: throttle traffic for inactive sessions
Sessions that have been inactive for a certain duration,
currently set at 120 seconds, will not receive updates.

A new statistics class tracks the activity of every
session and blocks callback updates from reaching
inactive clients.

Change-Id: I64296488b2c0be0598b218ba89a6d02f057a5f7e
Reviewed-on: https://gerrit.libreoffice.org/21760
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-24 21:14:57 +00:00
Ashod Nakashian
55f2105f00 loolwsd: logging improvements
Change-Id: I77844a2b549c1f497c2d44f054169bf11d9227d8
Reviewed-on: https://gerrit.libreoffice.org/21752
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-24 21:00:34 +00:00
Ashod Nakashian
4dc9fa7eb7 loolwsd: prevent deadlock when purging sessions
Change-Id: I293e28674ed721741fa0afc57b37a636833d2e0e
Reviewed-on: https://gerrit.libreoffice.org/21750
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-24 20:58:09 +00:00
Ashod Nakashian
dd374d8aec loolwsd: disconnect command to gracefully shutdown a socket
Change-Id: I8beb4c14fc95bdb2a98c7e5da44408511bce5e28
Reviewed-on: https://gerrit.libreoffice.org/21683
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-21 16:05:55 +00:00
Ashod Nakashian
291b0aac67 loolwsd: don't ignore the last few bytes of a closed socket
Change-Id: Id6332857e49ccbacfa6e63b87a1ed570e9598147
Reviewed-on: https://gerrit.libreoffice.org/21680
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-21 16:03:29 +00:00
Ashod Nakashian
d2bde985cc loolwsd: poll timeout of 500ms and handling priority events
Change-Id: Iadf449ee62700e1ac5da2be8c73c674657633808
Reviewed-on: https://gerrit.libreoffice.org/21679
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-21 16:02:04 +00:00
Ashod Nakashian
6b24eb7bba loolwsd: PIPE_BUFFER -> READ_BUFFER_SIZE = 2048
Change-Id: I12e9725549a15b2cb1c287db9de0fca732dafac2
Reviewed-on: https://gerrit.libreoffice.org/21678
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-21 15:59:47 +00:00
Ashod Nakashian
49d7c0e17f loolwsd: improved lokit callback notification dispatcher
Change-Id: I88abad83a3d06eb530200d921ef25b68465b82b6
Reviewed-on: https://gerrit.libreoffice.org/21675
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-21 15:45:00 +00:00
Ashod Nakashian
54d5138537 loolwsd: proper destruction of LibreOfficeKit instance
Change-Id: If39b0d534eb93044383766a51f26faac398c834e
Reviewed-on: https://gerrit.libreoffice.org/21673
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-21 15:44:03 +00:00
Ashod Nakashian
ad7509d449 loolwsd: writeFIFO overload to take std::string
Change-Id: Ibfac97d1d4f101a10bd0f696b8b89a22170b1b11
Reviewed-on: https://gerrit.libreoffice.org/21672
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-21 15:43:11 +00:00
Miklos Vajna
201c9fb590 loolwsd: handle 'nextmessage:' in master -> prisoner traffic
ToPrisoner already generated 'nextmessage:' when it was necessary, but
the other side did not handle that message type, since previously
(before multi-line paste) only the prisoner -> master direction needed
'nextmessage:' for tile data.
2016-01-18 11:47:57 +01:00
Miklos Vajna
3eeecacfb9 Document::_callbackQueue -> CallbackQueue
AFAICS this was the last member named not following the coding style.
2016-01-18 09:43:49 +01:00
Miklos Vajna
1977f07d5c paste: handle data containing newlines
By changing the protocol, so that instead of "paste ... data=<data>",
the client is now expected to send "paste ...\n<data>".
2016-01-15 14:43:59 +01:00
Ashod Nakashian
558dfd40e0 loolwsd: unloading of disconnected documents
Documents that do not have any client connections to
are unloaded.

Currently we do not check for saved state of the
document before unloading.

Change-Id: I0f4f2ec1a7ddb15262833fe3d4ab73af16a2a959
Reviewed-on: https://gerrit.libreoffice.org/21472
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-14 13:55:50 +00:00
Ashod Nakashian
bdd3f73bd5 loolwsd: misc child cleanup
Change-Id: I5ed100e053925264db2cb8f60de67cf6a536a65b
Reviewed-on: https://gerrit.libreoffice.org/21470
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-14 13:40:40 +00:00
Ashod Nakashian
c2af36d0ef loolwsd: simplified Connection
Change-Id: Ia7ff0d4b636513ce1b08641bb6db85c97ee5c2f9
Reviewed-on: https://gerrit.libreoffice.org/21468
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-14 13:38:45 +00:00
Ashod Nakashian
ecc35dcdb2 loolwsd: using recursive_mutex since callbacks invoke public functions
Change-Id: Iddcf342cf59c4bd534be52a4b4661bc630f07007
Reviewed-on: https://gerrit.libreoffice.org/21378
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-12 04:34:23 +00:00
Ashod Nakashian
37a4d8ec10 loolwsd: uniqueLock -> lock, lock() -> getLock()
Change-Id: I3ea58a1ee0f8c0d7a153b78a2a03104d07416760
Reviewed-on: https://gerrit.libreoffice.org/21377
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-12 04:33:42 +00:00
Ashod Nakashian
55f857e17c loolwsd: Poco::Mutex -> std::mutex and callback locks on session
Change-Id: I9c7d16352110566e5fc31c280784ded30cd3a9be
Reviewed-on: https://gerrit.libreoffice.org/21333
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-11 04:12:11 +00:00
Ashod Nakashian
5130aa214d loolwsd: better locking in Document
Change-Id: Ia6cef55201f5505e703026a8461282b5fb79fd85
Reviewed-on: https://gerrit.libreoffice.org/21330
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-11 04:10:04 +00:00
Ashod Nakashian
f577e48f18 loolwsd: child Session ID in URI
Change-Id: Ide04425fe29d17dd2db1aea532de421b8f0e3669
Reviewed-on: https://gerrit.libreoffice.org/21329
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-11 04:09:34 +00:00
Ashod Nakashian
c83f3937d4 loolwsd: Document locks and view counters
Change-Id: I2bae3fd7136e5bb85276f5cad246497e51fbfdd0
Reviewed-on: https://gerrit.libreoffice.org/21328
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-11 04:09:07 +00:00
Ashod Nakashian
96c7fdd0f8 loolwsd: onUnload takes Session ID
Change-Id: I63dd21441a11981f09f6b4c2d36560094fc81f1f
Reviewed-on: https://gerrit.libreoffice.org/21327
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-11 04:08:32 +00:00
Ashod Nakashian
9b5a94b018 loolwsd: callbacks use shared_ptr to avoid race with destructors
Change-Id: I19e06850764c6dbd1cfcc15dcd9a64029ab4fc0c
Reviewed-on: https://gerrit.libreoffice.org/21326
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-11 04:07:30 +00:00
Ashod Nakashian
5bf75f56ca loolwsd: centralized signal handling and eased debugging
Change-Id: Ifdb3e2bca540bec3c6dea1ab24173c8ea0267706
Reviewed-on: https://gerrit.libreoffice.org/21325
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-11 04:06:56 +00:00
Ashod Nakashian
910b34de58 loolwsd: destroy ChildProcessSessions
Change-Id: I58e9f58047162e842e155b70284fe55a45af35c9
Reviewed-on: https://gerrit.libreoffice.org/21324
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-11 04:06:02 +00:00
Ashod Nakashian
9523769e94 loolwsd: better callback handling and shutdown
Change-Id: Id9cc9f748d2dac3afb7d7d002062f8c423bce775
Reviewed-on: https://gerrit.libreoffice.org/21321
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-11 04:04:27 +00:00
Ashod Nakashian
b2b983476c loolwsd: more informative warnings
Change-Id: I8dba6d003bd5c0b3c16b3cd57c3737638ce56bd1
Reviewed-on: https://gerrit.libreoffice.org/21320
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-11 04:04:02 +00:00
Ashod Nakashian
b3d06869f5 loolwsd: centralized document loading in Document
Change-Id: I1ff7e0a53cc415958e46aea74c775d7f265b8b8e
Reviewed-on: https://gerrit.libreoffice.org/21319
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-11 04:03:38 +00:00
Ashod Nakashian
2e34e2c8cf loolwsd: public -> private
Change-Id: Ibd662a17389d4a77bc31b84a50bc7a2e3b48bde0
Reviewed-on: https://gerrit.libreoffice.org/21318
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-11 04:02:55 +00:00
Ashod Nakashian
efb1fecbf1 loolwsd: control multiview api via env
Change-Id: Ic385188a4d57e10a260827709d4666857fd8aae5
Reviewed-on: https://gerrit.libreoffice.org/21317
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-11 04:02:05 +00:00
Ashod Nakashian
a66a12004d loolwsd: better handling of multiple connections
Change-Id: I3acd9810b63426ea4b811bf2f4f4341ba70e4ba0
Reviewed-on: https://gerrit.libreoffice.org/21316
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-11 03:57:58 +00:00
Ashod Nakashian
4b028e1506 loolwsd: localized lokit lock and other cleanups
Change-Id: I16453924d90ab22e57f8b6a3bbb937fef853ea2c
Reviewed-on: https://gerrit.libreoffice.org/21315
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-11 03:57:18 +00:00
Henry Castro
f3c8ace597 loolwsd: request abnormal termination 2016-01-09 12:26:04 -04:00
Henry Castro
d20e9399fc loolwsd: revert, refactor lokit Document
I did not consider shared document case.
2016-01-09 07:27:57 -04:00
Henry Castro
584e68e6d1 loolwsd: remove expired session URL cached 2016-01-08 19:05:58 -04:00
Henry Castro
82b3b25d0a loolwsd: refactor lokit Document
+ Every lokit process acquire an unique URL document to open it
+ Every lokit process acquired with an URL document could open multiple view of the same URL document
+ Every lokit process acquire a new unique URL document if and only if no exists opened documents.
+ if a lokit process dies is an abnormal state, and it should take actions to recovery session document.
+ An initial lokit process with no acquire URL document is in waiting state.
2016-01-08 10:37:48 -04:00
Henry Castro
ab1a3a147e loolwsd: not necessary to find session
Every lokit instances has a unique URL, that could contain
multiple views.
2016-01-07 23:43:09 -04:00
Henry Castro
2c7b4490ec loolwsd: ensure to remove the connection of unloaded document 2016-01-07 23:24:40 -04:00
Henry Castro
b213464b3d loolwsd: ensure unique URL per lokit process 2016-01-07 14:55:11 -04:00
Ashod Nakashian
7f9485e318 loolwsd: jailId now static member
Change-Id: I7142038d421d642a3e9dfd3e1069c7401ec7db5c
Reviewed-on: https://gerrit.libreoffice.org/21183
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-07 05:56:25 +00:00