aws-crt-cpp
C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++.
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
33 {
34 public:
38
41
46
51
60 };
61
66 : public std::enable_shared_from_this<HttpClientConnectionManager>
67 {
68 public:
70
77 bool AcquireConnection(const OnClientConnectionAvailable &onClientConnectionAvailable) noexcept;
78
85 std::future<void> InitiateShutdown() noexcept;
86
90 static std::shared_ptr<HttpClientConnectionManager> NewClientConnectionManager(
91 const HttpClientConnectionManagerOptions &connectionManagerOptions,
92 Allocator *allocator = g_allocator) noexcept;
93
94 private:
97 Allocator *allocator = g_allocator) noexcept;
98
99 Allocator *m_allocator;
100
101 aws_http_connection_manager *m_connectionManager;
102
104 std::promise<void> m_shutdownPromise;
105 std::atomic<bool> m_releaseInvoked;
106
107 static void s_onConnectionSetup(
108 aws_http_connection *connection,
109 int errorCode,
110 void *userData) noexcept;
111
112 static void s_shutdownCompleted(void *userData) noexcept;
113
114 friend class ManagedConnection;
115 };
116 } // namespace Http
117 } // namespace Crt
118} // namespace Aws
#define AWS_CRT_CPP_API
Definition: Exports.h:37
Definition: HttpConnectionManager.h:67
Definition: HttpConnectionManager.h:33
HttpClientConnectionManagerOptions & operator=(const HttpClientConnectionManagerOptions &rhs)=default
HttpClientConnectionOptions ConnectionOptions
Definition: HttpConnectionManager.h:45
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:337
Definition: HttpConnectionManager.cpp:166
std::function< void(std::shared_ptr< HttpClientConnection >, int errorCode)> OnClientConnectionAvailable
Definition: HttpConnectionManager.h:27
aws_allocator Allocator
Definition: StlAllocator.h:17
AWS_CRT_CPP_API Allocator * g_allocator
Definition: Api.cpp:21
Definition: Api.h:17