1313#include < mutex>
1414
1515namespace launchdarkly ::network {
16-
1716/* *
1817 * Manages CURL multi interface integrated with ASIO event loop.
1918 *
@@ -57,7 +56,9 @@ class CurlMultiManager : public std::enable_shared_from_this<CurlMultiManager> {
5756 * @param headers The curl_slist headers (will be freed automatically)
5857 * @param callback Called when the transfer completes
5958 */
60- void add_handle (CURL * easy, curl_slist* headers, CompletionCallback callback);
59+ void add_handle (CURL * easy,
60+ curl_slist* headers,
61+ CompletionCallback callback);
6162
6263 /* *
6364 * Remove an easy handle from management.
@@ -69,8 +70,11 @@ class CurlMultiManager : public std::enable_shared_from_this<CurlMultiManager> {
6970 explicit CurlMultiManager (boost::asio::any_io_executor executor);
7071
7172 // Called by CURL when socket state changes
72- static int socket_callback (CURL * easy, curl_socket_t s, int what,
73- void * userp, void * socketp);
73+ static int socket_callback (CURL * easy,
74+ curl_socket_t s,
75+ int what,
76+ void * userp,
77+ void * socketp);
7478
7579 // Called by CURL when timer should be set
7680 static int timer_callback (CURLM * multi, long timeout_ms, void * userp);
@@ -95,19 +99,18 @@ class CurlMultiManager : public std::enable_shared_from_this<CurlMultiManager> {
9599 };
96100
97101 void start_socket_monitor (SocketInfo* socket_info, int action);
98- void stop_socket_monitor (SocketInfo* socket_info);
99102
100103 boost::asio::any_io_executor executor_;
101- CURLM * multi_handle_;
104+ // CURLM* multi_handle_;
105+ std::unique_ptr<CURLM , decltype (&curl_multi_cleanup)> multi_handle_;
102106 boost::asio::steady_timer timer_;
103107
104108 std::mutex mutex_;
105109 std::map<CURL *, CompletionCallback> callbacks_;
106110 std::map<CURL *, curl_slist*> headers_;
107- std::map<curl_socket_t , SocketInfo> sockets_; // Managed socket info
111+ std::map<curl_socket_t , SocketInfo> sockets_; // Managed socket info
108112 int still_running_{0 };
109113};
110-
111114} // namespace launchdarkly::network
112115
113- #endif // LD_CURL_NETWORKING
116+ #endif // LD_CURL_NETWORKING
0 commit comments