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
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 = g_allocator) noexcept;
102
103 private:
106 Allocator *allocator = g_allocator) 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
#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:347
Definition: HttpConnectionManager.cpp:177
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:23
Definition: Api.h:14