That is our convention, and this also avoids a global variable in the
kit process.
Change-Id: I37d2d53aa7eb24f9848fa8ef98bc57d75db90d13
Signed-off-by: Tor Lillqvist <tml@collabora.com>
For now, an argument object should have all keys and values as strings
not containing any spaces because of the trivial way in which it is
parsed.
This is a bit sad, yes, but necessary until we move to some more
structured syntax for the messages.
Also fix an incorrect comment.
Change-Id: I8a1408a4a1787b66a3cf7b26b3d92c07df244c47
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Instead of requiring that information in the query string of the loleaflet.html URL.
Change-Id: I8c41e87c7f561561adeb03ec34ce0c19fe9d7fa5
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Make it contain a proper empty JSON array if no trace objects have
been written to it.
Change-Id: Ided1992a822659561a909ac545536261b91adbac
Signed-off-by: Tor Lillqvist <tml@collabora.com>
It enables turning Trace Event recording on (and off again). The
option is passed down to the client through loleaflet.html, and to the
KIT processes. If the option is not used, the new JS functions that
send trace events to the server turn into no-ops to avoid wasting
bandwidth.
It is always on in a "make run".
Change-Id: Iafe1919ccba7c376137d3e0568b857e20780bbc8
Signed-off-by: Tor Lillqvist <tml@collabora.com>
wsd/ClientSession.cpp:411:31: error: object backing the pointer will be destroyed at the end of the full-expression [-Werror,-Wdangling-gsl]
const char* str = tokens[2].data();
^~~~~~~~~
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I67e4aa5f61e049ad13663dc1e11ae2bd67399bea
Add a function emitInstantTraceEvent() to leaflet that sends an
"Instant" Trace Event to the server for logging.
Add a function createAsyncTraceEvent() that creates an object that
records the timestamp of its creation and sends the 'b' event to the
server for logging, and when you call finish() on the object, sends
the corresponding 'e' event.
Finally, add a function createCompleteTraceEvent() that creates an
object for a "Complete" Trace Event that includes the end timestamp
*and* the duration. The event is sent to the server when you call
finish() on the object.
Loleaflet sends timestamps in the above messages from
performance.now(). To enable the server to turn those into absolute
timestamps, the loolclient message is amended to include the current
Date.now() and performance.now() values.
Note that the intent is that when generating Trace Event logs, the
server and the web browser run on the same machine, so there is no
wall-clock synchronisation issues between server and client.
Change-Id: Ie9e68b093b769cc942e1e1d17083febeb07ccf5e
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Also avoid generating abbreviations in various message handling loops
unless debugging is enabled.
Change-Id: I22f4929b0bfd4da36917db6882bb2f5f5be02780
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Avoiding default values for parameters makes the code easier to read.
Especially true for bool parameters. But sure, just a question of
taste.
Change-Id: I473f70bdfafe3a9ccfb325def8760d78fee7e9a6
Signed-off-by: Tor Lillqvist <tml@collabora.com>
When toggling tile debugging in the Help>About, toggle Trace Event
recordning, too. Add a comment with an example of how to turn on
SAL_LOG overriding at the same place.
The following new messages from client to server are introduced:
traceeventrecording <start/stop>
Starts or stops comphelper::TraceEvent recording.
sallogoverride <string>
Overrides the SAL_LOG value, or stops overriding if no parameter
or parameter is "default".
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I8b56c28cd99d39115cd796c44e5051d934d21a1f
Signed-off-by: Tor Lillqvist <tml@collabora.com>
It is (for now) produced (by the ProfileZone things in core) whenever
logging level is "trace". The Event Trace file pathname can be given
in the loolesd.xml file or on the loolwsd command line.
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I6d5829121e71460a4600ee94d2ebf51043c8893f
This enables writing multiple WS frames
at a time, up to the capacity (rounded
to the next full-frame's size).
Change-Id: I30d25f9ba1e405156d1e44886b2f3ac8017f0f3c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
When writing to the socket, it's always more efficient
to fill the buffer up to the hardware limit for each
write. This is doubly important for efficiency with
SSL, due to the overhead of encrypting multiple
small buffers instead of one large one.
Currently we don't write more than one message
at a time, primarily due to limitations in
the Poco sockets in the unit-tests, which
have a hard time consuming multiple WS frames
with a single poll (subsequent calls to poll
doesn't enter signalled state until new data
arrives, possibly because the data is read and
buffered internally, making the whole scheme
of using poll unreliable and meaningless).
Change-Id: Ic2e2cf1babfb5ab4116efd93f392977ba234d92b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
... without copying the token.
And use it in TileDesc::parse(), which is known to be a hot path.
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I0dcf2eb26c93254cdc6a1c11f9708daf213a825d
And use it in TileDesc::parse(), which is known to be a hot path.
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I20375d7a1c31f61662446979e4d6799fd45b49d3
In some rare cases Poco throws "Exists" exception.
It's not clear what causes it, so this should
log more of the original exception, hoping that
it would shed some light.
Change-Id: I51723f35c9e062c56608e8f7b80c9a65d3f0488f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Even if we use http:// locally via a tunnel the new outgoing socket
code needs SSL initialized to connect securely to remote servers.
Change-Id: If64a3838267182757591a8026097bf08d9ba732f
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Used for comments added to documents by the user.
The setting, like templateListURL, can be set through a mobile device
management system.
There is no trivial way on iOS for an app to programmatically find out
the name of the user, and that is good from a privacy point of view.
Fixes https://github.com/CollaboraOnline/online/issues/1843
Change-Id: Ie68fcbacf886ec8f1c74021a71879b38d4180c15
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Per the RFC, the server must set the 'Connection'
header to 'close' to signify that the current
request is the last.
With this patch, we now properly notify all the
clients when we do not intend on resuming communication.
Although, technically, there is no reason why we
shouldn't allow the client to reuse the connection,
we may consider that in the future.
See https://tools.ietf.org/html/rfc7230#section-6.3
Change-Id: Ic6250c0afe8124314a9122452040f6a75728a525
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Since the return value of syncRequest and syncDownload
was derived from Response anyway, there is no reason
to have multiple values for callers to look at.
This simplifies the API.
Change-Id: I0f136e515dd0ef6eda84f6a7cd662b260809d2f1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Rendering PDF documents to images can consume
large amount of memory. Here we limit the
maximum allowed resolution to 384. This is
about 400% zoom resolution, given that the
100% resolution is 96 dpi.
If this proves limiting, it can be increased
to 480 dpi, which is about 500% zoom scale.
Change-Id: I719118d517bbaf8b204411223f1e26a31b97ca99
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
The defined envar is used by Core to override its
default resolution (of 96 dpi), when specified.
Change-Id: Ie7164e78f98990ac88b02dbfe2becbae8c134e9c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
User-Agent is designed for client-side use only,
in http requests. For servers, the Server header
is designed to announce the server name and version.
This tries to normalize the use and documents
the proper intent and usage.
Change-Id: I42d68d65611cab64c45adf03fe74f9466798b093
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This makes things more consistent in naming
and in namespace.
Change-Id: I2149c9e0b96eddf9fe2ad1dbc80c932fa7582f84
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This moves WebServerPoll and PrisonerPoll
from the global namespace into LOOLWSD
while converting them to unique_ptr. This
is to manage their lifetimes better and
avoid having out-of-order destruction,
especially with regards to Poco and other
statics that are out of our control.
The PrisonerPoll class had to be renamed
to PrisonPoll because the following is
otherwise invalid:
PrisonerPoll = Util::make_unique<PrisonerPoll>();
Change-Id: Id6c50ebf12ad0f313fea130ffba364beff54f686
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
LOOLWSDServer needs to shutdown its
accept_poll SocketPoll in its destructor,
which may be called after Poco's Logging
subsystem has been destroyed.
Instead of managing the lifetime of
accept_poll member of LOOLWSDServer,
it is safer to manage the lifetime
of LOOLWSDServer itself, and destroy
it in the cleanup stage. This makes
sure that its other members, or indeed
LOOLWSDServer itself, can't have any
late-destoryed objects that can cause
trouble.
The stacktrace for this crash:
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007ffff613f801 in __GI_abort () at abort.c:79
#2 0x00007ffff6d51957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3 0x00007ffff6d57ae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4 0x00007ffff6d56b49 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5 0x00007ffff6d574b8 in __gxx_personality_v0 () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6 0x00007ffff671f573 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
#7 0x00007ffff671fad1 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
#8 0x00007ffff6d57d47 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#9 0x00007ffff6d582dc in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#10 0x00005555556b6127 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.41] ()
#11 0x0000555555986b94 in Poco::Message::Message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority) ()
#12 0x000055555585ea49 in SocketPoll::~SocketPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at net/Socket.cpp:145
#13 0x000055555575d794 in TerminatingPoll::~TerminatingPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at ./net/Socket.hpp:832
#14 LOOLWSDServer::AcceptPoll::~AcceptPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at wsd/LOOLWSD.cpp:3766
#15 LOOLWSDServer::~LOOLWSDServer (this=0x555555d13480 <srv>, __in_chrg=<optimized out>) at wsd/LOOLWSD.cpp:3640
#16 0x00007ffff6142041 in __run_exit_handlers (status=0, listp=0x7ffff64ea718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
#17 0x00007ffff614213a in __GI_exit (status=<optimized out>) at exit.c:139
#18 0x0000555555753658 in LOOLWSD::innerInitialize (this=<optimized out>, self=...) at wsd/LOOLWSD.cpp:1213
#19 0x0000555555789527 in LOOLWSD::initialize (this=<optimized out>, self=...) at wsd/LOOLWSD.hpp:439
#20 0x00005555558e1964 in Poco::Util::Application::run() ()
#21 0x00005555556b6d74 in main (argc=3, argv=0x7fffffffe4f8) at wsd/LOOLWSD.cpp:4286
Change-Id: I28ea6215ce49c752cbb90bc33269ab3b662accf1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
The lifetime management of static objects
is extremely unpredictable and depends on
many variables outside of our control or
even reliable reproducibility.
Complex static objects that own threads
and other objects are doubly problematic
because of their dependency and/or
interaction with other objects.
Here we replace the static DelayPoll
instance with one we control its lifetime
in the LOOLWSD main body, such that it
is destroyed properly.
Specifically, DelayPoll's dtor was
accessing Poco's Logging subsystem out of
order. That is, after Poco had been
destroyed.
Another advantage to this approach is that
we don't even create the DelayPoll at all
if we don't need it. The onus now is on
the user of DelayPoll to make sure they
create a Delay object with a long-enough
lifetime to encompase it use.
For completeness, here is the stacktrace:
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007ffff613f801 in __GI_abort () at abort.c:79
#2 0x00007ffff6d51957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3 0x00007ffff6d57ae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4 0x00007ffff6d56b49 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5 0x00007ffff6d574b8 in __gxx_personality_v0 () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6 0x00007ffff671f573 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
#7 0x00007ffff671fad1 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
#8 0x00007ffff6d57d47 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#9 0x00007ffff6d582dc in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#10 0x00005555556b5927 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.41] ()
#11 0x0000555555982a14 in Poco::Message::Message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority) ()
#12 0x000055555585a909 in SocketPoll::~SocketPoll (this=0x555555d10f60 <DelayPoll>, __in_chrg=<optimized out>) at net/Socket.cpp:145
#13 0x00007ffff6142041 in __run_exit_handlers (status=0, listp=0x7ffff64ea718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
#14 0x00007ffff614213a in __GI_exit (status=<optimized out>) at exit.c:139
#15 0x0000555555752d78 in LOOLWSD::innerInitialize (this=<optimized out>, self=...) at wsd/LOOLWSD.cpp:1213
#16 0x0000555555788b07 in LOOLWSD::initialize (this=<optimized out>, self=...) at wsd/LOOLWSD.hpp:432
#17 0x00005555558dd7e4 in Poco::Util::Application::run() ()
#18 0x00005555556b6574 in main (argc=2, argv=0x7fffffffe528) at wsd/LOOLWSD.cpp:4276
Change-Id: Ifda55fe869fa6734b9c2490da4497d2551ac21c1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Makes it accessible to more code.
Change-Id: I73dd1895defe47ae40873b6155203768055206ec
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
"Specifies whether the macro execution is enabled in
general. This will disable Basic, Beanshell, Javascript
and Python scripts. If it is set to false, the
macro_security_level is ignored. If it is set to true,
the mentioned entry specified the level of macro security".
Change-Id: I4bc5b690268a93994d17e2b02b7b60b6398646b7
Signed-off-by: Henry Castro <hcastro@collabora.com>
The clipboard content is handled by the DocBroker,
if it it's available, otherwise, we fallback to the
cached clipboard entries.
When DocBroker has already terminated polling and
is no longer valid, we may end up using it for
the clipboard. In this case, we don't send anything
back, since there is no SocketPoll thread to
process the request or the socket data plumbing.
We avoid this by simply using the fallback (cache)
when we don't have a valid DocBroker.
Change-Id: Idf7f27b453605d173dd8e40d4a5d101f50355468
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Especially error reporting is now better.
Change-Id: I032f6e8403660c2ac24be2d80b53b63831ec1066
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
When loading hasn't completed yet, DocBroker can't
simply send a message to Kit that the session is
disconnected, because there would be no UI or
handlers for events if that were the only session.
Of course letting the document load, only to close
it, is also less than helpful to resource consumption.
Here, we recognize this case and simply terminate the
loading by killing the Kit process altogether to
avoid any potential hangs or resource wastage.
Change-Id: Ia72de715cc6238831c244444bb47b417b9b1e1a4
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Add a new state before load the document,
when Macro Security dialog popup, and avoid
to send the event load timeout.
Change-Id: I5973c5205e90e5447e5478cbab895709a68606f6
Signed-off-by: Henry Castro <hcastro@collabora.com>
This converts Poco to http::Request in sync mode,
thereby not changing functionality. In a follow-up,
this will be converted to async.
Change-Id: Ifbecd44ff599394799c1131470d77f803ed8cc45
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Normally the client session waits for a message
"status:" when the document has loaded to forward
to client side. However, when the document has macros
embedded, and a Macro Warning Security dialog popup
it will never receive the "status:" message.
So it is added "statusindicatorfinish:" to formally set that
the document has loaded.
Change-Id: Id40b853c002403577d7664c4f8206cb5a01403b6
Signed-off-by: Henry Castro <hcastro@collabora.com>
```
wsd/DocumentBroker.cpp:772:57: error: constexpr variable cannot have non-literal type 'const std::chrono::system_clock::time_point' (aka 'const time_point<std::__1::chrono::system_clock>')
constexpr std::chrono::system_clock::time_point Zero;
^
/usr/include/c++/v1/chrono:1355:28: note: 'time_point<std::__1::chrono::system_clock, std::__1::chrono::duration<long long, std::__1::ratio<1, 1000000>>>' is not literal because it is not an aggregate and has no constexpr constructors other than copy or move con
class _LIBCPP_TEMPLATE_VIS time_point
^
```
Signed-off-by: Gleb Popov <6yearold@gmail.com>
Change-Id: I88c5466b8ad104178cf7fa4101f5f5265ccf5e86
Consistent with names elsewhere and less confusing.
Change-Id: Ia72cdef0f6d6cd9589ce54028472e10008cf882c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
The download operation itself is done
after reading the response from the Poco
object. Therefore, the time duration that
was captured for the GetFile operation
was inaccurate. Luckily, we only need
to time the download API of the Storage
object, which actually is simpler, and
more accurate.
Change-Id: I05c94a29fa59d5efae215f2daea17672abc6efc7
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
For some reason, the duration of the CheckFileInfo
request was not set/updated, and therefore it was
always 0. This fixes this oversight and also
moves the duration variable locally, since
the request is synchronous anyway and there is
hardly any reason to store it elsewhere.
Change-Id: I613b24311bc5c8ee9ab98d675057f354990226e8
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
We use download/upload in the storage
and load/save elsewhere, to avoid confusion.
This renames 'save' to 'upload' in the storage
for consistency.
Change-Id: I9ac991c2b52e2586b97c58db02110ff04bfd17d3
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Templates were downloaded by Core
upon loading. This works fine, as
long as there is no special network
setup in loolwsd. However, when
loolwsd has a complex network setup,
such as when using reverse proxies,
Core wouldn't know about the details
and would likely fail to download
the template.
Luckily, there is no reason to rely
on Core for downloading templates.
Instead, we download it in loolwsd,
just like any other document, and
load it in Core as normal. The
remaining post-load saving of
templates remain unchanged.
Change-Id: Ib22ada4ae469863d5e5c8baeee27f667f7cd40ff
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Instead of inheritance we use composition
to preserve the uniqueness of the members
of SaveManager and StorageManager.
Change-Id: Ifad82787e54089d49226085e009ade67bfc7938a
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This will be used to detect whether we need
to upload the document or not.
Change-Id: I2c5f6d058b1a8e0a6ab20c9561b6701413fb5878
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This is to encapsulate and track the
common logic between SaveManager and
StorageManager.
Change-Id: I0c5a59edb8a26b258ba66d65983e2f76198ecbc9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This is to encapsulate and track the logic
for uploading documents from the Storage.
Change-Id: I5b972151fe9548526755d18063d37cc95949e68f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
We should only update the save timestamps when we
really save a new version of the document.
Requesting renaming or moving ("save as") in storage
should not be confused with actually saving in Core.
Here we take the first step in this separation,
and we only update the last save response time
when we truely get a response from Core, and
not when we execute a document path/name in storage.
Change-Id: I931c62b306dd3b4906a9e910f844a35fb3f4b6f0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
The SaveManager is responsible for the file on disk.
Change-Id: I92f7843375fdc875bc7d1af3fba387f67a4f0ca5
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
The SaveManager is responsible for the document's
save state. It also encapsulates the members
necessary to track the save state and related
data.
Change-Id: I3ed0f1d93f25988b1ad8b1a121a2080288866a53
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
And a couple of const cases.
The removed const is to allow move on return.
Change-Id: I7a81b531e75c39379871f5ffeb82d49ba1110ab1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
We already access _storage before the assertion,
so it must move before the first use.
Also, we have no use for _tileCache when uploading,
so no point in asserting its validity here.
Change-Id: I4196d0719e6750cfd2dba8d5f449a1b76286bde9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This details the design of the DocumentBroker
states and state-machines as they are to be
eventually implemented. Not everything described
is current, but the goal is to document what
the design ought to be, not what it is.
Change-Id: I938177812777af058b46c41a396407d0a083cbc4
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Only the last argument (force) was implicit, and only
in one call (of total two calls). Explicit is better.
Change-Id: Ic26f4dd265f48156d1730f1b95bb70145ca47873
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
The loaded flag is used to track whether or not
the document was ever loaded. It does *not* reflect
whether or not the document is currently loaded,
rather it is used to save the document, if necessary,
before unloaded.
This is why we need to track it as a separate boolean,
rather than implicitly tracking this state via the
DocumentState enum, which would not be able to
differentiate between a failed-to-load state and
one of a normal end-of-life, after loading.
Change-Id: I1fc3fb09c31cadf7ebb6b0123e462e78dd0af356
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
The markToDestroy flag tracks whether or not the
document is in the process of being unloaded.
Change-Id: I8f2339f75ed6d7c5d318eb1d467d6a9cbc1d61c2
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
DocumentState is responsible for tracking
the state of the document, properly documenting
the different stages of the document lifetime
and encapsulating all the relevant members.
DocumentState is still unused in this commit.
Change-Id: Ic2c8de3a9f2d42c5550c5f4ad5f889040f697890
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This prepares for moving this flag into
the upcoming state machine.
Change-Id: I0fa0e26f72a8f4da6813c3be6df5b16a94773591
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
To differentiate between the different stages
of document lifecycle, fetching documents
from the storage is now called 'download',
as opposed to the previous 'load', which is
reserved to loading document in Core.
This is a cosmetic renaming to avoid
confusing usage and intent going forward.
Change-Id: Ib9451e6f73bab19b877a3e6c8fb5b17ba82a06ab
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This code is executed regularly, at every poll.
The config getter internally throws exceptions,
catches and handles, before returning. While
this isn't performance sensitive, it is noisy
to have such poor-behaving code executed
frequently and regularly.
But the real motivation is the pain this exception
causes when debugging an exception. GDB ends up
catching this rogue exception, which is hardly
useful or helpful.
At any rate, we don't need to get a config entry
more than once, as they can't change during the
lifetime of the process.
Change-Id: Ic69fb94674b74b298987131d44d9baa27e9fa4aa
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Add support for configuring the SSL certificates
when running the test binary as well as setting
up the SSL context.
Also adds the SSL socket headers with proper
compile-time guards for when SSL is disabled.
Change-Id: I99992639a66a64871f8ff8a2b2105279ead63ca1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Technically, the poll interval should be
irrelevant because the tests should wakeupWorld
when they need to break the poll. However, it
turns out that many tests implicitly rely on
the poll interval to be large, and if for
any reason the poll wakes up, the tests either
advance their phase too soon, or assert, causing
random failures and reliability issues.
As the tests should now be more robust (at
least the ones that were non-deterministic
in this way), we can now lower the interval
to catch other cases (either extant or in the
future).
Change-Id: Id0d472e70875db8669bb21c6582b0d5052b19bfb
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>