|
3 | 3 |
|
4 | 4 | #include "countly/constants.hpp" |
5 | 5 |
|
6 | | -#include <iterator> |
7 | 6 | #include <chrono> |
| 7 | +#include <iterator> |
| 8 | +#include <map> |
| 9 | +#include <memory> |
| 10 | +#include <mutex> |
8 | 11 | #include <string> |
9 | 12 | #include <thread> |
10 | | -#include <mutex> |
11 | | -#include <map> |
12 | 13 |
|
13 | 14 | #ifndef COUNTLY_USE_SQLITE |
14 | 15 | #include <deque> |
@@ -244,39 +245,39 @@ class Countly { |
244 | 245 |
|
245 | 246 | void updateLoop(); |
246 | 247 |
|
247 | | - void (*logger_function)(LogLevel level, const std::string& message); |
248 | | - HTTPResponse (*http_client_function)(bool is_post, const std::string& url, const std::string& data); |
| 248 | + void (*logger_function)(LogLevel level, const std::string& message) = nullptr; |
| 249 | + HTTPResponse (*http_client_function)(bool is_post, const std::string& url, const std::string& data) = nullptr; |
249 | 250 |
|
250 | 251 | std::string host; |
251 | 252 |
|
252 | | - int port; |
253 | | - bool use_https; |
254 | | - bool always_use_post; |
| 253 | + int port = 0; |
| 254 | + bool use_https = false; |
| 255 | + bool always_use_post = false; |
255 | 256 |
|
256 | | - bool began_session; |
257 | | - bool is_being_disposed; |
258 | | - bool is_sdk_initialized; |
| 257 | + bool began_session = false; |
| 258 | + bool is_being_disposed = false; |
| 259 | + bool is_sdk_initialized = false; |
259 | 260 |
|
260 | 261 | std::chrono::system_clock::time_point last_sent_session_request; |
261 | 262 |
|
262 | 263 | json session_params; |
263 | 264 | std::string salt; |
264 | 265 |
|
265 | | - std::thread *thread; |
| 266 | + std::unique_ptr<std::thread> thread; |
266 | 267 | std::mutex mutex; |
267 | | - bool stop_thread; |
268 | | - bool running; |
269 | | - size_t wait_milliseconds; |
| 268 | + bool stop_thread = false; |
| 269 | + bool running = false; |
| 270 | + size_t wait_milliseconds = COUNTLY_KEEPALIVE_INTERVAL; |
270 | 271 | unsigned short _auto_session_update_interval = 60; // value is in seconds; |
271 | 272 |
|
272 | | - size_t max_events; |
| 273 | + size_t max_events = COUNTLY_MAX_EVENTS_DEFAULT; |
273 | 274 | #ifndef COUNTLY_USE_SQLITE |
274 | 275 | std::deque<std::string> event_queue; |
275 | 276 | #else |
276 | 277 | std::string database_path; |
277 | 278 | #endif |
278 | 279 |
|
279 | | - bool remote_config_enabled; |
| 280 | + bool remote_config_enabled = false; |
280 | 281 | json remote_config; |
281 | 282 | }; |
282 | 283 |
|
|
0 commit comments