Cleanup HttpClient to use inline initialization
For variables that aren't sent through the constructor, it's less code
and cleaner to initialize them inline as part of the struct.
Tested:
Per Appu:
"Did basic check and its initialized to default as before."
Per Sunitha:
"Tested the basic event notification scenario with this commit. Works
fine"
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I60e096686eb328edba51b26f27c3c879dae25a84
diff --git a/http/http_client.hpp b/http/http_client.hpp
index cd67398..d0b07a6 100644
--- a/http/http_client.hpp
+++ b/http/http_client.hpp
@@ -70,16 +70,16 @@
parser;
boost::circular_buffer_space_optimized<std::string> requestDataQueue{};
- ConnState state;
+ ConnState state = ConnState::initialized;
+
std::string subId;
std::string host;
std::string port;
- std::string uri;
- uint32_t retryCount;
- uint32_t maxRetryAttempts;
- uint32_t retryIntervalSecs;
- std::string retryPolicyAction;
- bool runningTimer;
+ uint32_t retryCount = 0;
+ uint32_t maxRetryAttempts = 5;
+ uint32_t retryIntervalSecs = 0;
+ std::string retryPolicyAction = "TerminateAfterRetries";
+ bool runningTimer = false;
void doResolve()
{
@@ -386,9 +386,7 @@
conn(ioc),
timer(ioc),
req(boost::beast::http::verb::post, destUri, 11, "", httpHeader),
- state(ConnState::initialized), subId(id), host(destIP), port(destPort),
- uri(destUri), retryCount(0), maxRetryAttempts(5), retryIntervalSecs(0),
- retryPolicyAction("TerminateAfterRetries"), runningTimer(false)
+ subId(id), host(destIP), port(destPort)
{
req.set(boost::beast::http::field::host, host);
req.keep_alive(true);