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
2 
7 
8 #include <atomic>
9 #include <condition_variable>
10 #include <future>
11 #include <mutex>
12 
13 struct aws_http_connection_manager;
14 
15 namespace 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 
68  };
69 
74  : public std::enable_shared_from_this<HttpClientConnectionManager>
75  {
76  public:
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:
113  const HttpClientConnectionManagerOptions &options,
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
Definition: HttpConnectionManager.h:73
HttpClientConnectionOptions ConnectionOptions
Definition: HttpConnectionManager.h:45
#define AWS_CRT_CPP_API
Definition: Exports.h:36
uint64_t MinThroughputBytesPerSecond
Definition: HttpConnectionManager.h:66
bool EnableBlockingShutdown
Definition: HttpConnectionManager.h:59
aws_allocator Allocator
Definition: Allocator.h:14
Definition: HttpConnectionManager.h:32
std::function< void(std::shared_ptr< HttpClientConnection >, int errorCode)> OnClientConnectionAvailable
Definition: HttpConnectionManager.h:27
Definition: HttpConnectionManager.cpp:188
Definition: HttpConnection.h:441
AWS_CRT_CPP_API Allocator * ApiAllocator() noexcept
Definition: Allocator.cpp:24
uint32_t AllowableThroughputFailureIntervalSeconds
Definition: HttpConnectionManager.h:67
size_t MaxConnections
Definition: HttpConnectionManager.h:50
Definition: Allocator.h:10