summaryrefslogtreecommitdiff
path: root/indra/llcorehttp
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2024-08-31 21:25:47 +0800
committerErik Kundiman <erik@megapahit.org>2024-09-01 20:43:42 +0800
commit95582654e49422d51b55665c3f2821c848ad1cb8 (patch)
treed6d03a887b8e1b6c3be1b139d63b1638c5d0fdcd /indra/llcorehttp
parentab3f483a3e5ed213882a83b882095cfdb6a4de57 (diff)
parentb0fefd62adbf51f32434ba077e9f52d8a9241d15 (diff)
Merge remote-tracking branch 'secondlife/release/2024.08-DeltaFPS' into 2024.08-DeltaFPS
Diffstat (limited to 'indra/llcorehttp')
-rw-r--r--indra/llcorehttp/CMakeLists.txt40
-rw-r--r--indra/llcorehttp/_httpinternal.h52
-rw-r--r--indra/llcorehttp/bufferarray.h1
-rw-r--r--indra/llcorehttp/httpcommon.h6
-rw-r--r--indra/llcorehttp/httprequest.cpp2
-rw-r--r--indra/llcorehttp/httpstats.h12
6 files changed, 35 insertions, 78 deletions
diff --git a/indra/llcorehttp/CMakeLists.txt b/indra/llcorehttp/CMakeLists.txt
index aa56407e35..ab3a86b37e 100644
--- a/indra/llcorehttp/CMakeLists.txt
+++ b/indra/llcorehttp/CMakeLists.txt
@@ -135,46 +135,6 @@ if (LL_TESTS AND LLCOREHTTP_TESTS)
"${CMAKE_CURRENT_SOURCE_DIR}/tests/test_llcorehttp_peer.py"
)
-if (DARWIN)
- # Path inside the app bundle where we'll need to copy libraries
- set(LL_TEST_DESTINATION_DIR
- ${CMAKE_BINARY_DIR}/sharedlibs/$<IF:$<BOOL:${LL_GENERATOR_IS_MULTI_CONFIG}>,,../>Resources
- )
-
- # Create the Contents/Resources directory
- add_custom_command(
- TARGET INTEGRATION_TEST_llcorehttp PRE_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS
- -E
- make_directory
- ${LL_TEST_DESTINATION_DIR}
- COMMENT "Creating Resources directory in app bundle."
- )
-
- # Copy the required libraries to the package app. We used to use a sequence
- # of '${CMAKE_COMMAND} -E copy' commands, but 'cmake -E copy' does only a
- # single file at a time: it doesn't understand wildcards. 'cmake -E copy' is
- # for portability. This operation is Darwin-specific. We can count on the
- # 'cp' command.
- set(copy_dylibs
- libapr-1.0.dylib
- libaprutil-1.0.dylib
- libnghttp2*.dylib
- liburiparser*.dylib
- ${EXPAT_COPY}
- )
-
- add_custom_command(TARGET INTEGRATION_TEST_llcorehttp PRE_BUILD
- WORKING_DIRECTORY "${AUTOBUILD_INSTALL_DIR}/lib/release"
- COMMAND cp -v
- ${copy_dylibs}
- ${LL_TEST_DESTINATION_DIR}
- DEPENDS ${copy_dylibs}
- )
-
-endif (DARWIN)
-
#
# Example Programs
#
diff --git a/indra/llcorehttp/_httpinternal.h b/indra/llcorehttp/_httpinternal.h
index 768ef98330..2a191fa550 100644
--- a/indra/llcorehttp/_httpinternal.h
+++ b/indra/llcorehttp/_httpinternal.h
@@ -106,17 +106,17 @@ namespace LLCore
// Maxium number of policy classes that can be defined.
// *TODO: Currently limited to the default class + 1, extend.
// (TSN: should this be more dynamically sized. Is there a reason to hard limit the number of policies?)
-const int HTTP_POLICY_CLASS_LIMIT = 32;
+constexpr int HTTP_POLICY_CLASS_LIMIT = 32;
// Debug/informational tracing. Used both
// as a global option and in per-request traces.
-const int HTTP_TRACE_OFF = 0;
-const int HTTP_TRACE_LOW = 1;
-const int HTTP_TRACE_CURL_HEADERS = 2;
-const int HTTP_TRACE_CURL_BODIES = 3;
+constexpr int HTTP_TRACE_OFF = 0;
+constexpr int HTTP_TRACE_LOW = 1;
+constexpr int HTTP_TRACE_CURL_HEADERS = 2;
+constexpr int HTTP_TRACE_CURL_BODIES = 3;
-const int HTTP_TRACE_MIN = HTTP_TRACE_OFF;
-const int HTTP_TRACE_MAX = HTTP_TRACE_CURL_BODIES;
+constexpr int HTTP_TRACE_MIN = HTTP_TRACE_OFF;
+constexpr int HTTP_TRACE_MAX = HTTP_TRACE_CURL_BODIES;
// Request retry limits
//
@@ -127,41 +127,41 @@ const int HTTP_TRACE_MAX = HTTP_TRACE_CURL_BODIES;
// We want to span a few windows to allow transport to slow
// after onset of the throttles and then recover without a final
// failure. Other systems may need other constants.
-const int HTTP_RETRY_COUNT_DEFAULT = 5;
-const int HTTP_RETRY_COUNT_MIN = 0;
-const int HTTP_RETRY_COUNT_MAX = 100;
-const HttpTime HTTP_RETRY_BACKOFF_MIN_DEFAULT = 1E6L; // 1 sec
-const HttpTime HTTP_RETRY_BACKOFF_MAX_DEFAULT = 5E6L; // 5 sec
-const HttpTime HTTP_RETRY_BACKOFF_MAX = 20E6L; // 20 sec
+constexpr int HTTP_RETRY_COUNT_DEFAULT = 5;
+constexpr int HTTP_RETRY_COUNT_MIN = 0;
+constexpr int HTTP_RETRY_COUNT_MAX = 100;
+constexpr HttpTime HTTP_RETRY_BACKOFF_MIN_DEFAULT = 1000000UL; // 1 sec
+constexpr HttpTime HTTP_RETRY_BACKOFF_MAX_DEFAULT = 50000006UL; // 5 sec
+constexpr HttpTime HTTP_RETRY_BACKOFF_MAX = 20000000UL; // 20 sec
-const int HTTP_REDIRECTS_DEFAULT = 10;
+constexpr int HTTP_REDIRECTS_DEFAULT = 10;
// Timeout value used for both connect and protocol exchange.
// Retries and time-on-queue are not included and aren't
// accounted for.
-const long HTTP_REQUEST_TIMEOUT_DEFAULT = 30L;
-const long HTTP_REQUEST_XFER_TIMEOUT_DEFAULT = 0L;
-const long HTTP_REQUEST_TIMEOUT_MIN = 0L;
-const long HTTP_REQUEST_TIMEOUT_MAX = 3600L;
+constexpr long HTTP_REQUEST_TIMEOUT_DEFAULT = 30L;
+constexpr long HTTP_REQUEST_XFER_TIMEOUT_DEFAULT = 0L;
+constexpr long HTTP_REQUEST_TIMEOUT_MIN = 0L;
+constexpr long HTTP_REQUEST_TIMEOUT_MAX = 3600L;
// Limits on connection counts
-const int HTTP_CONNECTION_LIMIT_DEFAULT = 8;
-const int HTTP_CONNECTION_LIMIT_MIN = 1;
-const int HTTP_CONNECTION_LIMIT_MAX = 256;
+constexpr int HTTP_CONNECTION_LIMIT_DEFAULT = 8;
+constexpr int HTTP_CONNECTION_LIMIT_MIN = 1;
+constexpr int HTTP_CONNECTION_LIMIT_MAX = 256;
// Pipelining limits
-const long HTTP_PIPELINING_DEFAULT = 0L;
-const long HTTP_PIPELINING_MAX = 20L;
+constexpr long HTTP_PIPELINING_DEFAULT = 0L;
+constexpr long HTTP_PIPELINING_MAX = 20L;
// Miscellaneous defaults
-const bool HTTP_USE_RETRY_AFTER_DEFAULT = true;
-const long HTTP_THROTTLE_RATE_DEFAULT = 0L;
+constexpr bool HTTP_USE_RETRY_AFTER_DEFAULT = true;
+constexpr long HTTP_THROTTLE_RATE_DEFAULT = 0L;
// Tuning parameters
// Time worker thread sleeps after a pass through the
// request, ready and active queues.
-const int HTTP_SERVICE_LOOP_SLEEP_NORMAL_MS = 2;
+constexpr int HTTP_SERVICE_LOOP_SLEEP_NORMAL_MS = 2;
// Block allocation size (a tuning parameter) is found
// in bufferarray.h.
diff --git a/indra/llcorehttp/bufferarray.h b/indra/llcorehttp/bufferarray.h
index 0269d1785e..5105dbc4f7 100644
--- a/indra/llcorehttp/bufferarray.h
+++ b/indra/llcorehttp/bufferarray.h
@@ -30,7 +30,6 @@
#include <cstdlib>
#include <vector>
-#include "boost/intrusive_ptr.hpp"
#include "_refcounted.h"
diff --git a/indra/llcorehttp/httpcommon.h b/indra/llcorehttp/httpcommon.h
index 0a1c5ed101..511a17e000 100644
--- a/indra/llcorehttp/httpcommon.h
+++ b/indra/llcorehttp/httpcommon.h
@@ -189,13 +189,9 @@
#include "linden_common.h" // Modifies curl/curl.h interfaces
#include "llsd.h"
-#include "boost/intrusive_ptr.hpp"
-#include "boost/shared_ptr.hpp"
-#include "boost/weak_ptr.hpp"
-#include "boost/function.hpp"
-#include "boost/noncopyable.hpp"
#include <string>
#include <curl/curl.h>
+#include "boost/noncopyable.hpp"
namespace LLCore
{
diff --git a/indra/llcorehttp/httprequest.cpp b/indra/llcorehttp/httprequest.cpp
index 216d407deb..2aaf71f8a4 100644
--- a/indra/llcorehttp/httprequest.cpp
+++ b/indra/llcorehttp/httprequest.cpp
@@ -489,6 +489,7 @@ HttpStatus HttpRequest::createService()
HttpRequestQueue::init();
HttpRequestQueue * rq = HttpRequestQueue::instanceOf();
HttpService::init(rq);
+ HTTPStats::createInstance();
has_inited = true;
}
@@ -502,6 +503,7 @@ HttpStatus HttpRequest::destroyService()
if (has_inited)
{
+ HTTPStats::deleteSingleton();
HttpService::term();
HttpRequestQueue::term();
has_inited = false;
diff --git a/indra/llcorehttp/httpstats.h b/indra/llcorehttp/httpstats.h
index e1387d9df5..5c0f26d34e 100644
--- a/indra/llcorehttp/httpstats.h
+++ b/indra/llcorehttp/httpstats.h
@@ -35,24 +35,24 @@
namespace LLCore
{
- class HTTPStats : public LLSingleton<HTTPStats>
+ class HTTPStats final : public LLSimpleton<HTTPStats>
{
- LLSINGLETON(HTTPStats);
- virtual ~HTTPStats();
-
public:
+ HTTPStats();
+ ~HTTPStats();
+
void resetStats();
typedef LLStatsAccumulator StatsAccumulator;
void recordDataDown(size_t bytes)
{
- mDataDown.push(bytes);
+ mDataDown.push((F32)bytes);
}
void recordDataUp(size_t bytes)
{
- mDataUp.push(bytes);
+ mDataUp.push((F32)bytes);
}
void recordHTTPRequest() { ++mRequests; }