16 #ifndef ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_INCLUDE_AVSCOMMON_UTILS_LIBCURLUTILS_LIBCURLHTTP2CONNECTION_H_ 17 #define ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_INCLUDE_AVSCOMMON_UTILS_LIBCURLUTILS_LIBCURLHTTP2CONNECTION_H_ 19 #include <condition_variable> 32 namespace libcurlUtils {
34 class LibcurlHTTP2Request;
45 static std::shared_ptr<LibcurlHTTP2Connection>
create(
46 const std::shared_ptr<LibcurlSetCurlOptionsCallbackInterface>& setCurlOptionsCallback =
nullptr);
58 void addObserver(std::shared_ptr<avsCommon::utils::http2::HTTP2ConnectionObserverInterface> observer)
override;
59 void removeObserver(std::shared_ptr<avsCommon::utils::http2::HTTP2ConnectionObserverInterface> observer)
override;
70 const std::shared_ptr<LibcurlSetCurlOptionsCallbackInterface>& setCurlOptionsCallback =
nullptr);
82 bool addStream(std::shared_ptr<LibcurlHTTP2Request> stream);
181 std::shared_ptr<avsCommon::utils::libcurlUtils::CurlMultiHandleWrapper>
m_multi;
201 std::unordered_set<std::shared_ptr<avsCommon::utils::http2::HTTP2ConnectionObserverInterface>>
m_observers;
215 #endif // ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_INCLUDE_AVSCOMMON_UTILS_LIBCURLUTILS_LIBCURLHTTP2CONNECTION_H_ std::deque< std::shared_ptr< LibcurlHTTP2Request > > m_requestQueue
Queue of requests send. Serialized by m_mutex.
Definition: LibcurlHTTP2Connection.h:195
bool addStream(std::shared_ptr< LibcurlHTTP2Request > stream)
std::shared_ptr< avsCommon::utils::libcurlUtils::CurlMultiHandleWrapper > m_multi
Represents a CURL multi handle. Intended to only be accessed by the network loop thread and in addStr...
Definition: LibcurlHTTP2Connection.h:181
Definition: HTTP2RequestConfig.h:42
Definition: HTTP2ConnectionInterface.h:34
void cleanupCancelledAndStalledStreams()
void unPauseActiveStreams()
void removeObserver(std::shared_ptr< avsCommon::utils::http2::HTTP2ConnectionObserverInterface > observer) override
void processNextRequest()
void cancelActiveStreams()
bool cancelActiveStream(ActiveStreamMap::iterator &iterator)
void notifyObserversOfGoawayReceived()
std::shared_ptr< LibcurlHTTP2Request > dequeueRequest()
std::condition_variable m_cv
Definition: LibcurlHTTP2Connection.h:188
ActiveStreamMap m_activeStreams
Definition: LibcurlHTTP2Connection.h:192
~LibcurlHTTP2Connection()
std::shared_ptr< avsCommon::utils::http2::HTTP2RequestInterface > createAndSendRequest(const http2::HTTP2RequestConfig &config) override
std::unordered_set< std::shared_ptr< avsCommon::utils::http2::HTTP2ConnectionObserverInterface > > m_observers
Observers.
Definition: LibcurlHTTP2Connection.h:201
static std::shared_ptr< LibcurlHTTP2Connection > create(const std::shared_ptr< LibcurlSetCurlOptionsCallbackInterface > &setCurlOptionsCallback=nullptr)
void cancelPendingStreams()
std::shared_ptr< LibcurlSetCurlOptionsCallbackInterface > m_setCurlOptionsCallback
The LibcurlSetCurlOptionsCallbackInterface used for this connection.
Definition: LibcurlHTTP2Connection.h:207
Definition: LibcurlHTTP2Connection.h:36
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
bool releaseStream(ActiveStreamMap::iterator &iterator)
void disconnect() override
std::thread m_networkThread
Main thread for this class.
Definition: LibcurlHTTP2Connection.h:178
LibcurlHTTP2Connection(const std::shared_ptr< LibcurlSetCurlOptionsCallbackInterface > &setCurlOptionsCallback=nullptr)
std::mutex m_mutex
Serializes concurrent access to the m_requestQueue and m_isStopping members.
Definition: LibcurlHTTP2Connection.h:184
std::mutex m_observersMutex
Mutex for observers.
Definition: LibcurlHTTP2Connection.h:198
bool m_isStopping
Set to true when we want to exit the network loop.
Definition: LibcurlHTTP2Connection.h:204
void addObserver(std::shared_ptr< avsCommon::utils::http2::HTTP2ConnectionObserverInterface > observer) override
void cleanupFinishedStreams()
std::map< CURL *, std::shared_ptr< LibcurlHTTP2Request > > ActiveStreamMap
Definition: LibcurlHTTP2Connection.h:75