From 21fc9d537548f7694177f8bb3a1e31cb94995624 Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Tue, 28 Dec 2021 05:22:42 +0800 Subject: [PATCH] replay/util: initialize curl at startup (#23314) --- selfdrive/ui/replay/util.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/selfdrive/ui/replay/util.cc b/selfdrive/ui/replay/util.cc index d6791465f21132..97e824ea29c165 100644 --- a/selfdrive/ui/replay/util.cc +++ b/selfdrive/ui/replay/util.cc @@ -17,13 +17,14 @@ namespace { -static std::atomic enable_http_logging = false; - struct CURLGlobalInitializer { CURLGlobalInitializer() { curl_global_init(CURL_GLOBAL_DEFAULT); } ~CURLGlobalInitializer() { curl_global_cleanup(); } }; +static CURLGlobalInitializer curl_initializer; +static std::atomic enable_http_logging = false; + template struct MultiPartWriter { T *buf; @@ -98,8 +99,6 @@ void enableHttpLogging(bool enable) { template bool httpDownload(const std::string &url, T &buf, size_t chunk_size, size_t content_length, std::atomic *abort) { - static CURLGlobalInitializer curl_initializer; - int parts = 1; if (chunk_size > 0 && content_length > 10 * 1024 * 1024) { parts = std::nearbyint(content_length / (float)chunk_size);