From 2f730303c2844426b7ef26d117f6f75bd8a4ae7e Mon Sep 17 00:00:00 2001 From: Benjamin Sergeant Date: Wed, 14 Aug 2019 19:53:57 -0700 Subject: [PATCH] CobraMetricThreadedPublisher _enable flag is an atomic, and CobraMetricsPublisher is enabled by default --- CHANGELOG.md | 3 +++ README.md | 2 +- ixwebsocket/IXHttpClient.cpp | 3 +++ ws/ixcobra/IXCobraMetricsPublisher.cpp | 2 +- ws/ixcobra/IXCobraMetricsPublisher.h | 5 +++-- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c208a09b..a55e15bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog All notable changes to this project will be documented in this file. +## [5.0.3] - 2019-08-14 +- CobraMetricThreadedPublisher _enable flag is an atomic, and CobraMetricsPublisher is enabled by default + ## [5.0.2] - 2019-08-01 - ws cobra_subscribe has a new -q (quiet) option - ws cobra_subscribe knows to and display msg stats (count and # of messages received per second) diff --git a/README.md b/README.md index f7f76ad6..69a52612 100644 --- a/README.md +++ b/README.md @@ -170,7 +170,7 @@ out = httpClient.post(url, std::string("foo=bar"), args); // // Result // -auto errorCode = response->errorCode; // Can be HttpErrorCode::Ok, HttpErrorCode::UrlMalformed, etc... +auto statusCode = response->statusCode; // Can be HttpErrorCode::Ok, HttpErrorCode::UrlMalformed, etc... auto errorCode = response->errorCode; // 200, 404, etc... auto responseHeaders = response->headers; // All the headers in a special case-insensitive unordered_map of (string, string) auto payload = response->payload; // All the bytes from the response as an std::string diff --git a/ixwebsocket/IXHttpClient.cpp b/ixwebsocket/IXHttpClient.cpp index 2d2d0408..36467e95 100644 --- a/ixwebsocket/IXHttpClient.cpp +++ b/ixwebsocket/IXHttpClient.cpp @@ -14,6 +14,7 @@ #include #include +#include #include namespace ix @@ -52,6 +53,8 @@ namespace ix bool HttpClient::performRequest(HttpRequestArgsPtr args, const OnResponseCallback& onResponseCallback) { + assert(_async && "HttpClient needs its async parameter set to true " + "in order to call performRequest"); if (!_async) return false; // Enqueue the task diff --git a/ws/ixcobra/IXCobraMetricsPublisher.cpp b/ws/ixcobra/IXCobraMetricsPublisher.cpp index 7fd5cc2a..05a589a5 100644 --- a/ws/ixcobra/IXCobraMetricsPublisher.cpp +++ b/ws/ixcobra/IXCobraMetricsPublisher.cpp @@ -17,7 +17,7 @@ namespace ix const std::string CobraMetricsPublisher::kSetBlacklistId = "sms_set_blacklist_id"; CobraMetricsPublisher::CobraMetricsPublisher() : - _enabled(false) + _enabled(true) { } diff --git a/ws/ixcobra/IXCobraMetricsPublisher.h b/ws/ixcobra/IXCobraMetricsPublisher.h index 693490aa..987de1a8 100644 --- a/ws/ixcobra/IXCobraMetricsPublisher.h +++ b/ws/ixcobra/IXCobraMetricsPublisher.h @@ -10,6 +10,7 @@ #include #include #include +#include #include namespace ix @@ -132,8 +133,8 @@ namespace ix CobraMetricsThreadedPublisher _cobra_metrics_theaded_publisher; /// A boolean to enable or disable this system - /// push becomes a no-op when _enabled is true - bool _enabled; + /// push becomes a no-op when _enabled is false + std::atomic _enabled; /// A uuid used to uniquely identify a session std::string _session;