c130231379
Squashed from feature/deltas-expanded. TileCache changes: + add montonic sequence (wid) numbers to TileData + account for sizes of TileData with multiple blobs + simplify saving and notifying of tiles Sends updates (via appendChanges) based on the sequence the right mix of keyframes and/or deltas required as a single message, and parse and apply those on the JS side. We continue to use PNG for slide previews and dialogs, but remove PngCache - used by document tiles only. Annotates delta: properly as a binary package for the websocket. Distinguishes between deltas and keyframes we get from the Kit based on an initial un-compressed prefix character which we then discard. kit can be forced to render a keyframe by oldWid=0 Track invalidity on tiles themselves - to keep the keyframe around. We need to be able to track that a tile is invalid, and so subscribe to the updated version as/when it is ready - but we also want to store the keyframe underneath any deltas. force rendering of a keyframe for an empty slot in the TileCache. force tile sequence to be zero for combinedtiles - so the client can always request standalone tiles with explicit combinedtiles, or tile requests. move Blob to Common.hpp use zero size for un-changed tiles. remove obsolete render-id, and color deltas in debug mode. cleanup unit tests for non-png tile results. Change-Id: I987f84ac4e58004758a243c233b19a6f0d60f8c2 Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
93 lines
3.6 KiB
C++
93 lines
3.6 KiB
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
|
/*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
#include <memory>
|
|
|
|
// Default values and other shared data between processes.
|
|
|
|
constexpr int DEFAULT_CLIENT_PORT_NUMBER = 9980;
|
|
|
|
// define to wrap strace around the forkit
|
|
#define STRACE_COOLFORKIT 0
|
|
// define to wrap valgrind around the forkit
|
|
#define VALGRIND_COOLFORKIT 0
|
|
|
|
#if VALGRIND_COOLFORKIT
|
|
constexpr int TRACE_MULTIPLIER = 20;
|
|
#else
|
|
constexpr int TRACE_MULTIPLIER = 1;
|
|
#endif
|
|
|
|
constexpr int COMMAND_TIMEOUT_MS = 5000 * TRACE_MULTIPLIER;
|
|
constexpr int CHILD_TIMEOUT_MS = COMMAND_TIMEOUT_MS;
|
|
constexpr int CHILD_REBALANCE_INTERVAL_MS = CHILD_TIMEOUT_MS / 10;
|
|
constexpr int POLL_TIMEOUT_MICRO_S = (COMMAND_TIMEOUT_MS / 5) * 1000;
|
|
constexpr int WS_SEND_TIMEOUT_MS = 1000 * TRACE_MULTIPLIER;
|
|
|
|
constexpr int TILE_ROUNDTRIP_TIMEOUT_MS = 5000 * TRACE_MULTIPLIER;
|
|
|
|
/// Pipe and Socket read buffer size.
|
|
/// Should be large enough for ethernet packets
|
|
/// which can be 1500 bytes long.
|
|
constexpr long READ_BUFFER_SIZE = 64 * 1024;
|
|
|
|
/// Message larger than this will be dropped as invalid
|
|
/// or as intentionally flooding the server.
|
|
constexpr int MAX_MESSAGE_SIZE = 2 * 1024 * READ_BUFFER_SIZE;
|
|
|
|
constexpr const char JAILED_DOCUMENT_ROOT[] = "/tmp/user/docs/";
|
|
constexpr const char CHILD_URI[] = "/coolws/child?";
|
|
constexpr const char NEW_CHILD_URI[] = "/coolws/newchild";
|
|
constexpr const char LO_JAIL_SUBPATH[] = "lo";
|
|
constexpr const char FORKIT_URI[] = "/coolws/forkit";
|
|
|
|
constexpr const char CAPABILITIES_END_POINT[] = "/hosting/capabilities";
|
|
|
|
/// The file suffix used to mark the file slated for uploading.
|
|
constexpr const char TO_UPLOAD_SUFFIX[] = ".upload";
|
|
/// The file suffix used to mark the file being uploaded.
|
|
constexpr const char UPLOADING_SUFFIX[] = "ing";
|
|
|
|
/// A shared threadname suffix in both the WSD and Kit processes
|
|
/// is highly helpful for filtering the logs for the same document
|
|
/// by simply grepping for this shared suffix+ID. e.g. 'grep "broker_123" coolwsd.log'
|
|
/// Unfortunately grepping for only "_123" would include more noise than desirable.
|
|
/// This also makes the threadname symmetric and the entries aligned.
|
|
/// The choice of "broker" as the suffix is historic: it implies the controller
|
|
/// of which there are two: one in WSD called DocumentBroker and one in Kit
|
|
/// called Document, which wasn't called DocumentBroker to avoid confusing it
|
|
/// with the one in WSD. No such confusion should be expected in the logs, since
|
|
/// the prefix is "doc" and "kit" respectively, and each log entry has the process
|
|
/// name prefixed. And of course these threads are unrelated to the classes in
|
|
/// the code: they are logical execution unit names.
|
|
#define SHARED_DOC_THREADNAME_SUFFIX "broker_"
|
|
|
|
/// The HTTP request User-Agent. Used only in Requests.
|
|
#define HTTP_AGENT_STRING "COOLWSD HTTP Agent " COOLWSD_VERSION
|
|
|
|
/// The WOPI User-Agent. Depricated: use HTTP_AGENT_STRING.
|
|
#define WOPI_AGENT_STRING HTTP_AGENT_STRING
|
|
|
|
/// The HTTP response Server. Used only in Responses.
|
|
#define HTTP_SERVER_STRING "COOLWSD HTTP Server " COOLWSD_VERSION
|
|
|
|
/// The client port number, both coolwsd and the kits have this.
|
|
extern int ClientPortNumber;
|
|
extern std::string MasterLocation;
|
|
|
|
/// Controls whether experimental features/behavior is enabled or not.
|
|
extern bool EnableExperimental;
|
|
|
|
/// More efficient use of vectors
|
|
using BlobData = std::vector<char>;
|
|
using Blob = std::shared_ptr<BlobData>;
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|