blob: 85420233936200e5889c7ff4bb269ba58a37bda6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/core/http/HttpClient.h>
#include <aws/core/http/HttpRequest.h>
using namespace Aws;
using namespace Aws::Http;
HttpClient::HttpClient() :
m_disableRequestProcessing( false ),
m_requestProcessingSignalLock(),
m_requestProcessingSignal()
{
}
void HttpClient::DisableRequestProcessing()
{
m_disableRequestProcessing = true;
m_requestProcessingSignal.notify_all();
}
void HttpClient::EnableRequestProcessing()
{
m_disableRequestProcessing = false;
}
bool HttpClient::IsRequestProcessingEnabled() const
{
return m_disableRequestProcessing.load() == false;
}
void HttpClient::RetryRequestSleep(std::chrono::milliseconds sleepTime)
{
std::unique_lock< std::mutex > signalLocker(m_requestProcessingSignalLock);
m_requestProcessingSignal.wait_for(signalLocker, sleepTime, [this](){ return m_disableRequestProcessing.load() == true; });
}
bool HttpClient::ContinueRequest(const Aws::Http::HttpRequest& request) const
{
if (request.GetContinueRequestHandler())
{
return request.GetContinueRequestHandler()(&request);
}
return true;
}
|