AWS IoT Device SDK C++ v2 1.44.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
61
65 class AWS_CRT_CPP_API HttpClientConnectionManager final
66 : public std::enable_shared_from_this<HttpClientConnectionManager>
67 {
68 public:
69 ~HttpClientConnectionManager();
70
81 bool AcquireConnection(const OnClientConnectionAvailable &onClientConnectionAvailable) noexcept;
82
90 std::future<void> InitiateShutdown() noexcept;
91
99 static std::shared_ptr<HttpClientConnectionManager> NewClientConnectionManager(
100 const HttpClientConnectionManagerOptions &connectionManagerOptions,
101 Allocator *allocator = ApiAllocator()) noexcept;
102
103 private:
104 HttpClientConnectionManager(
106 Allocator *allocator = ApiAllocator()) noexcept;
107
108 Allocator *m_allocator;
109
110 aws_http_connection_manager *m_connectionManager;
111
113 std::promise<void> m_shutdownPromise;
114 std::atomic<bool> m_releaseInvoked;
115
116 static void s_onConnectionSetup(
117 aws_http_connection *connection,
118 int errorCode,
119 void *userData) noexcept;
120
121 static void s_shutdownCompleted(void *userData) noexcept;
122
123 friend class ManagedConnection;
124 };
125 } // namespace Http
126 } // namespace Crt
127} // namespace Aws
std::future< void > InitiateShutdown() noexcept
Definition HttpConnectionManager.cpp:169
bool AcquireConnection(const OnClientConnectionAvailable &onClientConnectionAvailable) noexcept
Definition HttpConnectionManager.cpp:152
static std::shared_ptr< HttpClientConnectionManager > NewClientConnectionManager(const HttpClientConnectionManagerOptions &connectionManagerOptions, Allocator *allocator=ApiAllocator()) noexcept
Definition HttpConnectionManager.cpp:37
friend class ManagedConnection
Definition HttpConnectionManager.h:123
Definition HttpConnectionManager.h:33
HttpClientConnectionManagerOptions & operator=(const HttpClientConnectionManagerOptions &rhs)=default
HttpClientConnectionOptions ConnectionOptions
Definition HttpConnectionManager.h:45
HttpClientConnectionManagerOptions() noexcept
Definition HttpConnectionManager.cpp:32
size_t MaxConnections
Definition HttpConnectionManager.h:50
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