AWS IoT Device SDK C++ v2 1.45.1
AWS IoT Device SDK C++ v2
Loading...
Searching...
No Matches
HttpConnectionManager.h
Go to the documentation of this file.
1#pragma once
7
8#include <atomic>
9#include <condition_variable>
10#include <future>
11#include <mutex>
12
13struct aws_http_connection_manager;
14
15namespace Aws
16{
17 namespace Crt
18 {
19 namespace Http
20 {
27 std::function<void(std::shared_ptr<HttpClientConnection>, int errorCode)>;
28
69
73 class AWS_CRT_CPP_API HttpClientConnectionManager final
74 : public std::enable_shared_from_this<HttpClientConnectionManager>
75 {
76 public:
77 ~HttpClientConnectionManager();
78
89 bool AcquireConnection(const OnClientConnectionAvailable &onClientConnectionAvailable) noexcept;
90
98 std::future<void> InitiateShutdown() noexcept;
99
107 static std::shared_ptr<HttpClientConnectionManager> NewClientConnectionManager(
108 const HttpClientConnectionManagerOptions &connectionManagerOptions,
109 Allocator *allocator = ApiAllocator()) noexcept;
110
111 private:
112 HttpClientConnectionManager(
114 Allocator *allocator = ApiAllocator()) noexcept;
115
116 Allocator *m_allocator;
117
118 aws_http_connection_manager *m_connectionManager;
119
121 std::promise<void> m_shutdownPromise;
122 std::atomic<bool> m_releaseInvoked;
123
124 static void s_onConnectionSetup(
125 aws_http_connection *connection,
126 int errorCode,
127 void *userData) noexcept;
128
129 static void s_shutdownCompleted(void *userData) noexcept;
130
131 friend class ManagedConnection;
132 };
133 } // namespace Http
134 } // namespace Crt
135} // namespace Aws
std::future< void > InitiateShutdown() noexcept
Definition HttpConnectionManager.cpp:181
bool AcquireConnection(const OnClientConnectionAvailable &onClientConnectionAvailable) noexcept
Definition HttpConnectionManager.cpp:164
static std::shared_ptr< HttpClientConnectionManager > NewClientConnectionManager(const HttpClientConnectionManagerOptions &connectionManagerOptions, Allocator *allocator=ApiAllocator()) noexcept
Definition HttpConnectionManager.cpp:39
friend class ManagedConnection
Definition HttpConnectionManager.h:131
Definition HttpConnectionManager.h:33
HttpClientConnectionManagerOptions & operator=(const HttpClientConnectionManagerOptions &rhs)=default
HttpClientConnectionOptions ConnectionOptions
Definition HttpConnectionManager.h:45
HttpClientConnectionManagerOptions() noexcept
Definition HttpConnectionManager.cpp:33
uint32_t AllowableThroughputFailureIntervalSeconds
Definition HttpConnectionManager.h:67
size_t MaxConnections
Definition HttpConnectionManager.h:50
uint64_t MinThroughputBytesPerSecond
Definition HttpConnectionManager.h:66
HttpClientConnectionManagerOptions & operator=(HttpClientConnectionManagerOptions &&rhs)=default
HttpClientConnectionManagerOptions(HttpClientConnectionManagerOptions &&rhs)=default
bool EnableBlockingShutdown
Definition HttpConnectionManager.h:59
HttpClientConnectionManagerOptions(const HttpClientConnectionManagerOptions &rhs)=default
Definition HttpConnection.h:442
#define AWS_CRT_CPP_API
Definition Exports.h:36
Definition Credentials.h:28
std::function< void(std::shared_ptr< HttpClientConnection >, int errorCode)> OnClientConnectionAvailable
Definition HttpConnectionManager.h:26
Definition Allocator.h:13
AWS_CRT_CPP_API Allocator * ApiAllocator() noexcept
Definition Allocator.cpp:24
aws_allocator Allocator
Definition Allocator.h:14
Definition Allocator.h:11