Commit graph

3912 commits

Author SHA1 Message Date
Pranav Kant
9ebd7a15e2 loolwsd: Improved loolwsd -> storage communication
Reduces the number of WOPI calls made during a document load. Earlier
effort was made in edfd3266f8
This commit cleans up and uses better approach for the same.

Other than that, access token of each session is now correctly
used when interacting with the storage. Earlier, we used to
use the same access token for each upload to storage which means
that irrespective of who clicked the save button, changes to the
document were only made on behalf of one person (of whom the
access token is used). This is fixed now.

Also includes minor cleanup left and right.

Change-Id: Id32702ff02aea4f63b7cc6afa9f62664807bb57d
Reviewed-on: https://gerrit.libreoffice.org/29931
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-16 22:02:25 +00:00
Ashod Nakashian
2ca592d0ac loolwsd: log the username, Core View-ID, and WSD Session-ID together
This helps debugging and tracing issues as this single log
entry links the three most important pieces together:
the user, how Core references the user's view to a
given document, and how WSD references the same.

Change-Id: I7bf88504b43eed85d40e6f8bc9c3bad713f372da
Reviewed-on: https://gerrit.libreoffice.org/29935
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-16 22:02:07 +00:00
Pranav Kant
07f10570cc loolwsd: Add wopiloadduration - time taken to interact with WOPI host
Change-Id: Ia2d763ef721128450bf402a61d0e0f3e75701441
2016-10-16 23:01:50 +05:30
Pranav Kant
7cacaa070d loolwsd: Make this const
Change-Id: Ieb1be92323061110798da23f066a5be0e8314472
2016-10-16 23:01:46 +05:30
Henry Castro
1d40b1eb79 loleaflet: fix mouse over text that it changes re-size cursor 2016-10-14 14:46:46 -04:00
Marco Cecchetti
78e707393e loleaflet: handle EMPTY invalid tiles msg with part in the payload
Change-Id: I84ae55440b540dc027bddf341994d34d411f2a3a
Reviewed-on: https://gerrit.libreoffice.org/29826
Reviewed-by: Marco Cecchetti <mrcekets@gmail.com>
Tested-by: Marco Cecchetti <mrcekets@gmail.com>
2016-10-14 13:26:16 +00:00
Pranav Kant
edfd3266f8 loolwsd: Reuse storage object; kill superfluous WOPI calls
This reduces the number of fileinfo calls made to storage. These calls can
be expensive in storage such as WOPI where loolwsd needs to
interact with another server to get the file information. Use the
same storage object once created so that fileinfo can be
cached and returned quickly for subsequent such calls.

3 GetFileInfo WOPI calls are now merged into 1.

Change-Id: I56c3d23d3d6d7dc3a4b42433f51304dac28a12e8
2016-10-14 17:18:58 +05:30
Pranav Kant
66fa578fb3 loolwsd: No need of passing URI again to getFileInfo
Lets use the internal URI stored in storage object.

Change-Id: I2bfefc8d41db86a940060fadaa8629e50ed14d7c
2016-10-14 17:18:45 +05:30
Pranav Kant
e4466b418b loolwsd: Storage class: std::string -> Poco::URI
This saves us from encoding/decoding mess of URIs. Poco::URI is
flexible enough and can give encoded or decoded version whenever
required, so lets avoid storing the URI in std::string where we
have no information about whether its encoded or not.

Change-Id: I4a6979e13b20d9f56fc5a0baa630cb1b35ca33b0
2016-10-14 17:18:45 +05:30
Tor Lillqvist
3757125b23 Use same indentation and whitespace style as in other source files
Only whitespace changes in this commit.
2016-10-14 13:10:15 +03:00
Tor Lillqvist
c628b00c3e Add Emacs mode line and license blurb here, too 2016-10-14 13:05:09 +03:00
Tor Lillqvist
650ab54d00 Log fatal errors as such 2016-10-14 13:02:58 +03:00
Tor Lillqvist
0e047c8a1a Add Log API for the 'FATAL' priority
To be used only for truly fatal configuration or resource errors when
the lool service cannot continue functioning at all.

Add also a sysfatal() variant that appends the strerror(errno)
message, like syserror().
2016-10-14 12:52:03 +03:00
Henry Castro
9d89989b99 loleaflet: remove unused query string 2016-10-13 17:03:48 -04:00
Henry Castro
a0a87276f9 loolwsd: fix media type 2016-10-13 16:54:27 -04:00
Tor Lillqvist
c8d5c279b9 Move comment 2016-10-13 23:49:27 +03:00
Andras Timar
cb4fb86794 loleaflet: add Insert - Comment to Calc menu 2016-10-13 12:58:04 +02:00
Tor Lillqvist
213c7c6d09 Catch by const ref
That's what we do everywhere else, not reason to do differently in
these two places.
2016-10-13 12:00:54 +03:00
Miklos Vajna
4104e341f5 Remove unused using declarations
And a few other minor fixes. No need to create an std::string object
when a char number is enough, nor need to copy an object when passing it
by reference is enough.

Change-Id: I3d6aba20ffce781532ea77fe079ce64378db6e12
2016-10-13 08:20:04 +02:00
Henry Castro
fbfd500a2e loleaflet: fix style names in Layout dropdown 2016-10-12 21:51:48 -04:00
Henry Castro
25dce7a30f loleaflet: column/row re-size cleanup 2016-10-12 17:30:52 -04:00
Henry Castro
5a2fe805db loleaflet: add localizable error message 2016-10-12 12:44:44 -04:00
Henry Castro
bd5e138aa9 loolwsd: fix error message localization 2016-10-12 12:44:44 -04:00
Tor Lillqvist
dc7f561481 Don't use 'FIFO' in function names as we don't use FIFOs any more
No functional changes.
2016-10-12 19:07:54 +03:00
Tor Lillqvist
58f78f8734 Don't use named pipes (FIFOs)
Use a plain pipe, as created by Poco::Process::launch() when you pass
a non-nullptr inPipe pointer to it. Leads to simpler code. No need to
explicitly create a FIFO and open it. In loolforkit, the read fd of
the pipe is now always 0 (stdin).

Creating the pipe ourselves in loolwsd using pipe() and passing the fd
of the read end of the pipe on the loolforkit command-line would not
be much more complex, and was what I first tried. But it did not work,
as Poco::ProcessImpl::launchByForkExecImpl() closes all file
descriptors >= 3. Which is a bit rude, and not documented, but there
you go.
2016-10-12 18:51:40 +03:00
Tor Lillqvist
d658a35c03 Fix copy-paste error 2016-10-12 15:15:39 +03:00
Tor Lillqvist
7872c5f083 I mean loolforkit, not loolkit 2016-10-12 15:13:26 +03:00
Tor Lillqvist
4655c73539 Check the capabilities only after opening the fifo
loolwsd is waiting in open() for loolkit to open its end of the pipe,
so if loolforkit exits before it has opened the pipe, loolwsd will
wait forever and not notice that loolkit has exited. Which is not
ideal.

Note that there are other sanity checks done before loolforkit opens
the pipe, and if some of them fail, and loolforkit exits, loolwsd will
be hanging in the open and not notice. Need to carefully look through
that and re-factor as necessary.

Using a named pipe (FIFO) is probably pointless. We should just create
a normal pipe in loolwsd and pass the fd of the reading end on the
command-line to loolforkit.
2016-10-12 14:56:34 +03:00
Tor Lillqvist
d0c856c535 Verify at run-time that the loolforkit program has the required capabilities
If not, log a mesage and exit.

Note that loolwsd does not notice that loolforkit exits. That is
obviously a problem, and I will see to that next.
2016-10-12 14:19:42 +03:00
Tor Lillqvist
07354f6f45 'syserror' does not correspond to a message priority level
Calling Log::syserror() just means errno is relevant and its string
should be included in the log line. It is the error() function of the
logger that it calls.

So don't mark log lines produced by calling Log::syserror() with a
separate "SYS" marker, but use the same "ERR" as for Log::error().
2016-10-12 14:16:47 +03:00
Tor Lillqvist
e07069eda2 Drop parameter when we always pass the same value for it
For the 'message' parameter of LOOLSession::shutdown(),
ClientSession::shutdownPeer(), and PrisonerSession::shutdownPeer() we
always passed "". It was passed on as the 'statusMessage' parameter to
WebSocet::shutdown() which has "" as default anyway.
2016-10-12 13:05:57 +03:00
Tor Lillqvist
4b5561c9b4 "" is the default value for the WebSocket::shutdown() statusMessage parameter
So no need to pass it.
2016-10-12 12:51:06 +03:00
Tor Lillqvist
55e6a76639 If saving fails, tell it to the user VERY VISIBLY 2016-10-12 12:27:14 +03:00
Tor Lillqvist
9fee650f43 Use std::getenv() consistently 2016-10-12 11:47:26 +03:00
László Németh
f910dcbf88 loleaflet: tile debug: show tile render count and cached tiles
- show total number of the rendered tiles of the document, also
  the difference between the previous number in the client

- show cached tiles in transparent yellow color (in debug build)

- send ping messages after every invalidation message instead of
  keypressing

- fix memory leak: remove unused leaflet rectangle overlays on the
  tiles
2016-10-11 17:43:25 +02:00
László Németh
2c744f75c6 loolwsd: count rendered tiles and serve the number for debugging
extend the 'pong' server message with the data "rendercount=num",
where "num" is the total number of rendered tiles of the document.
2016-10-11 17:18:16 +02:00
Henry Castro
c3c8235561 Revert "loolwsd: test: .uno:AutoSum"
This is no longer need it, because the unit test
was already added to sc/qa/unit/tiledrendering/tiledrendering.cxx

This reverts commit 9b1087e000.
2016-10-11 08:26:02 -04:00
Andras Timar
7ecf78a18e update pot files 2016-10-11 12:13:23 +02:00
Tor Lillqvist
9ff9452e4c It's 'error:', in lower case
Clearly this if branch has never been reached.
2016-10-11 13:05:17 +03:00
Aleksander Machniak
799b783968 Fix WOPI request header: X-WOPIOverride -> X-WOPI-Override
Change-Id: Ibd288beeffecea415c8524dfc03e77e71ba3c10e
Reviewed-on: https://gerrit.libreoffice.org/29662
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2016-10-11 08:11:20 +00:00
Henry Castro
c62344db81 loolwsd: websocket shutdown cleanup 2016-10-10 22:28:56 -04:00
Henry Castro
03f912115a loleaflet: do not show internal errors
Internal error message, it was intended for debugging purposes,
so it is not necessary to show them to final users
2016-10-10 16:03:30 -04:00
Tor Lillqvist
d5bbe8b52c There doesn't seem to be any 'invalidate:' message any longer
There is only 'invalidatetiles:'. Try to document that properly then
instead.
2016-10-10 18:16:13 +03:00
Pranav Kant
a01d2fc91d loleaflet: Restore old coloring algorithm for non-text documents
.uno:TrackedChangeAuthors doesn't give correct colors for
documents other than writer, lets use our old algorithm for color
assignment for these documents.

Change-Id: If865788154a80da2637aad84183a0e947bb4b7e8
2016-10-10 18:00:38 +05:30
Pranav Kant
176367b408 loleaflet: Fix incorrect reference to username
Change-Id: Ibd6433c862eaf5f5fe57244180691ef8b08e3fbb
2016-10-10 17:14:54 +05:30
Tor Lillqvist
44d7f26c89 Bin dead code
ClientSession::isLoadFailed() was not used anywhere. As a fallout, the
_loadFailed field and setLoadFailed() member function became useless,
too.
2016-10-10 13:46:07 +03:00
Pranav Kant
0ad39593d0 loleaflet: Use view colors directly from core
Change-Id: I2fdffd6dd0823a77ff52e40150a81db4b261ec81
2016-10-10 13:02:22 +05:30
Pranav Kant
587c0e5222 loolwsd: Forward 'color' property in 'viewinfo' message to client
Change-Id: Id7d28a46cacd662aeb371805509e5a81b90b9c90
2016-10-10 13:02:22 +05:30
Ashod Nakashian
e0ff6eef6b loolwsd: kill Connection object in child
Change-Id: Ic4d0d3e7286272a0765b299824dfa3556fe56f4b
Reviewed-on: https://gerrit.libreoffice.org/29652
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-10 06:32:30 +00:00
Ashod Nakashian
e33eff4abd loolwsd: cleanup of Connection in ChildSession
Change-Id: I07636163df7b2973dada55b9704abf7105ad285f
Reviewed-on: https://gerrit.libreoffice.org/29651
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-10 06:32:12 +00:00