From e141cf1a6b9a2d8f75c6208dd3013292e6ebe554 Mon Sep 17 00:00:00 2001 From: Victor Vazquez Date: Tue, 5 Jan 2021 16:28:05 -0800 Subject: [PATCH] Update canceled to cancelled (#1256) * rename all `canceled` to `cancelled` * Adding changelog breaking changes --- sdk/core/azure-core/CHANGELOG.md | 5 + .../azure-core/inc/azure/core/context.hpp | 22 ++-- .../azure-core/inc/azure/core/credentials.hpp | 2 +- .../inc/azure/core/http/body_stream.hpp | 8 +- .../inc/azure/core/http/curl/curl.hpp | 2 +- .../inc/azure/core/http/pipeline.hpp | 2 +- .../azure-core/inc/azure/core/http/policy.hpp | 4 +- .../inc/azure/core/http/transport.hpp | 2 +- .../core/http/winhttp/win_http_client.hpp | 4 +- sdk/core/azure-core/src/http/body_stream.cpp | 6 +- sdk/core/azure-core/src/http/curl/curl.cpp | 6 +- .../src/http/curl/curl_connection_private.hpp | 106 +++++++++--------- .../src/http/curl/curl_session_private.hpp | 12 +- sdk/core/azure-core/src/http/retry_policy.cpp | 2 +- .../src/http/winhttp/win_http_transport.cpp | 4 +- sdk/core/azure-core/test/ut/context.cpp | 6 +- .../test/ut/transport_adapter_base.cpp | 8 +- .../src/storage_retry_policy.cpp | 2 +- 18 files changed, 107 insertions(+), 96 deletions(-) diff --git a/sdk/core/azure-core/CHANGELOG.md b/sdk/core/azure-core/CHANGELOG.md index 5234dc8e6..7b0ed2115 100644 --- a/sdk/core/azure-core/CHANGELOG.md +++ b/sdk/core/azure-core/CHANGELOG.md @@ -17,6 +17,11 @@ - Removed option `AllowBeast` from `CurlTransportSSLOptions` in `CurlTransportOptions`. - Changed default option `NoRevoke` from `CurlTransportSSLOptions` for the `CurlTransportOptions` to `true`. This disables the revocation list checking by default. - Changed type of `Token::ExpiresOn` to `DateTime`. +- Renamed exception `OperationCanceledException` to `OperationCancelledException`. +- Renamed methods from `Azure::Core::Context`. + - `IsCanceled` to `IsCancelled` + - `ThrowIfCanceled` to `ThrowIfCancelled`. + ### Bug Fixes diff --git a/sdk/core/azure-core/inc/azure/core/context.hpp b/sdk/core/azure-core/inc/azure/core/context.hpp index 2ac6eb740..9acf1cfd0 100644 --- a/sdk/core/azure-core/inc/azure/core/context.hpp +++ b/sdk/core/azure-core/inc/azure/core/context.hpp @@ -27,17 +27,19 @@ namespace Azure { namespace Core { }; /** - * @brief An exception that gets thrown when some operation is canceled. + * @brief An exception that gets thrown when some operation is cancelled. * */ - class OperationCanceledException : public std::runtime_error { + class OperationCancelledException : public std::runtime_error { public: /** * @brief Construct with message string as description. * * @param message The description for the exception. */ - explicit OperationCanceledException(std::string const& message) : std::runtime_error(message) {} + explicit OperationCancelledException(std::string const& message) : std::runtime_error(message) + { + } }; /** @@ -392,19 +394,19 @@ namespace Azure { namespace Core { } /** - * @brief Check if the context is canceled. - * @return `true` if this context is canceled, `false` otherwise. + * @brief Check if the context is cancelled. + * @return `true` if this context is cancelled, `false` otherwise. */ - bool IsCanceled() const { return CancelWhen() < std::chrono::system_clock::now(); } + bool IsCancelled() const { return CancelWhen() < std::chrono::system_clock::now(); } /** - * @brief Throw an exception if the context was canceled. + * @brief Throw an exception if the context was cancelled. */ - void ThrowIfCanceled() const + void ThrowIfCancelled() const { - if (IsCanceled()) + if (IsCancelled()) { - throw OperationCanceledException("Request was canceled by context."); + throw OperationCancelledException("Request was cancelled by context."); } } }; diff --git a/sdk/core/azure-core/inc/azure/core/credentials.hpp b/sdk/core/azure-core/inc/azure/core/credentials.hpp index cac34bc21..76d5a9e3b 100644 --- a/sdk/core/azure-core/inc/azure/core/credentials.hpp +++ b/sdk/core/azure-core/inc/azure/core/credentials.hpp @@ -44,7 +44,7 @@ namespace Azure { namespace Core { /** * @brief Get an authentication token. * - * @param context #Context so that operation can be canceled. + * @param context #Context so that operation can be cancelled. * @param scopes Authentication scopes. */ virtual AccessToken GetToken(Context const& context, std::vector const& scopes) diff --git a/sdk/core/azure-core/inc/azure/core/http/body_stream.hpp b/sdk/core/azure-core/inc/azure/core/http/body_stream.hpp index 21e99e2c1..536876619 100644 --- a/sdk/core/azure-core/inc/azure/core/http/body_stream.hpp +++ b/sdk/core/azure-core/inc/azure/core/http/body_stream.hpp @@ -59,9 +59,9 @@ namespace Azure { namespace Core { namespace Http { /** * @brief Read portion of data into a buffer. - * @remark Throws if error/canceled. + * @remark Throws if error/cancelled. * - * @param conntext #Context so that operation can be canceled. + * @param conntext #Context so that operation can be cancelled. * @param buffer Pointer to a first byte of the byte buffer to read the data into. * @param count Size of the buffer to read the data into. * @@ -73,7 +73,7 @@ namespace Azure { namespace Core { namespace Http { * @brief Read #BodyStream into a buffer until the buffer is filled, or until the stream is * read to end. * - * @param conntext #Context so that operation can be canceled. + * @param conntext #Context so that operation can be cancelled. * @param body #BodyStream to read. * @param buffer Pointer to a first byte of the byte buffer to read the data into. * @param count Size of the buffer to read the data into. @@ -90,7 +90,7 @@ namespace Azure { namespace Core { namespace Http { * @brief Read #BodyStream until the stream is read to end, allocating memory for the entirety * of contents. * - * @param conntext #Context so that operation can be canceled. + * @param conntext #Context so that operation can be cancelled. * @param body #BodyStream to read. * * @return A vector of bytes containing the entirety of data read from the \p body. diff --git a/sdk/core/azure-core/inc/azure/core/http/curl/curl.hpp b/sdk/core/azure-core/inc/azure/core/http/curl/curl.hpp index cf03b5734..ca65724e4 100644 --- a/sdk/core/azure-core/inc/azure/core/http/curl/curl.hpp +++ b/sdk/core/azure-core/inc/azure/core/http/curl/curl.hpp @@ -114,7 +114,7 @@ namespace Azure { namespace Core { namespace Http { /** * @brief Implements interface to send an HTTP Request and produce an HTTP RawResponse * - * @param context #Context so that operation can be canceled. + * @param context #Context so that operation can be cancelled. * @param request an HTTP Request to be send. * @return unique ptr to an HTTP RawResponse. */ diff --git a/sdk/core/azure-core/inc/azure/core/http/pipeline.hpp b/sdk/core/azure-core/inc/azure/core/http/pipeline.hpp index 4651ab698..af66cdd8e 100644 --- a/sdk/core/azure-core/inc/azure/core/http/pipeline.hpp +++ b/sdk/core/azure-core/inc/azure/core/http/pipeline.hpp @@ -90,7 +90,7 @@ namespace Azure { namespace Core { namespace Http { /** * @brief Start the HTTP pipeline. * - * @param ctx #Context so that operation can be canceled. + * @param ctx #Context so that operation can be cancelled. * @param request The HTTP request to be processed. * * @return HTTP response after the request has been processed. diff --git a/sdk/core/azure-core/inc/azure/core/http/policy.hpp b/sdk/core/azure-core/inc/azure/core/http/policy.hpp index b4fd9853d..7371472b0 100644 --- a/sdk/core/azure-core/inc/azure/core/http/policy.hpp +++ b/sdk/core/azure-core/inc/azure/core/http/policy.hpp @@ -44,7 +44,7 @@ namespace Azure { namespace Core { namespace Http { /** * @brief Apply this HTTP policy. * - * @param context #Context so that operation can be canceled. + * @param context #Context so that operation can be cancelled. * @param request An HTTP #Request being sent. * @param policy #NextHttpPolicy to invoke after this policy has been applied. * @@ -96,7 +96,7 @@ namespace Azure { namespace Core { namespace Http { /** * @brief Apply this HTTP policy. * - * @param context #Context so that operation can be canceled. + * @param context #Context so that operation can be cancelled. * @param request An HTTP #Request being sent. * * @return An HTTP #RawResponse after this policy, and all subsequent HTTP policies in the stack diff --git a/sdk/core/azure-core/inc/azure/core/http/transport.hpp b/sdk/core/azure-core/inc/azure/core/http/transport.hpp index 0a22e785c..5053046b9 100644 --- a/sdk/core/azure-core/inc/azure/core/http/transport.hpp +++ b/sdk/core/azure-core/inc/azure/core/http/transport.hpp @@ -25,7 +25,7 @@ namespace Azure { namespace Core { namespace Http { /** * @brief Send an HTTP request over the wire. * - * @param context #Context so that operation can be canceled. + * @param context #Context so that operation can be cancelled. * @param request An HTTP #Request to send. */ // TODO - Should this be const diff --git a/sdk/core/azure-core/inc/azure/core/http/winhttp/win_http_client.hpp b/sdk/core/azure-core/inc/azure/core/http/winhttp/win_http_client.hpp index a4128c3b7..dd21cc0fb 100644 --- a/sdk/core/azure-core/inc/azure/core/http/winhttp/win_http_client.hpp +++ b/sdk/core/azure-core/inc/azure/core/http/winhttp/win_http_client.hpp @@ -101,7 +101,7 @@ namespace Azure { namespace Core { namespace Http { /** * @brief Implement #BodyStream read. Calling this function pulls data from the wire. * - * @param context #Context so that operation can be canceled. + * @param context #Context so that operation can be cancelled. * @param buffer Buffer where data from wire is written to. * @param count The number of bytes to read from the network. * @return The actual number of bytes read from the network. @@ -158,7 +158,7 @@ namespace Azure { namespace Core { namespace Http { * @brief Implements the Http transport interface to send an HTTP Request and produce an HTTP * RawResponse. * - * @param context #Context so that operation can be canceled. + * @param context #Context so that operation can be cancelled. * @param request an HTTP request to be send. * @return A unique pointer to an HTTP RawResponse. */ diff --git a/sdk/core/azure-core/src/http/body_stream.cpp b/sdk/core/azure-core/src/http/body_stream.cpp index 73d230032..e5f26874f 100644 --- a/sdk/core/azure-core/src/http/body_stream.cpp +++ b/sdk/core/azure-core/src/http/body_stream.cpp @@ -72,7 +72,7 @@ std::vector BodyStream::ReadToEnd(Context const& context, BodyStream& b int64_t MemoryBodyStream::Read(Context const& context, uint8_t* buffer, int64_t count) { - context.ThrowIfCanceled(); + context.ThrowIfCancelled(); int64_t copy_length = std::min(count, static_cast(this->m_length - this->m_offset)); // Copy what's left or just the count @@ -86,7 +86,7 @@ int64_t MemoryBodyStream::Read(Context const& context, uint8_t* buffer, int64_t #if defined(AZ_PLATFORM_POSIX) int64_t FileBodyStream::Read(Azure::Core::Context const& context, uint8_t* buffer, int64_t count) { - context.ThrowIfCanceled(); + context.ThrowIfCancelled(); auto result = pread( this->m_fd, @@ -105,7 +105,7 @@ int64_t FileBodyStream::Read(Azure::Core::Context const& context, uint8_t* buffe #elif defined(AZ_PLATFORM_WINDOWS) int64_t FileBodyStream::Read(Azure::Core::Context const& context, uint8_t* buffer, int64_t count) { - context.ThrowIfCanceled(); + context.ThrowIfCancelled(); DWORD numberOfBytesRead; auto o = OVERLAPPED(); diff --git a/sdk/core/azure-core/src/http/curl/curl.cpp b/sdk/core/azure-core/src/http/curl/curl.cpp index 1cc374ac0..b97cd7869 100644 --- a/sdk/core/azure-core/src/http/curl/curl.cpp +++ b/sdk/core/azure-core/src/http/curl/curl.cpp @@ -109,7 +109,7 @@ int pollSocketUntilEventOrTimeout( for (long counter = 0; counter < timeout && result == 0; counter = counter + interval) { // check cancelation - context.ThrowIfCanceled(); + context.ThrowIfCancelled(); #if defined(AZ_PLATFORM_POSIX) result = poll(&poller, 1, interval); #elif defined(AZ_PLATFORM_WINDOWS) @@ -340,7 +340,7 @@ CURLcode CurlConnection::SendBuffer( // expected to return CURLE_AGAIN (since socket is ready), so, a chuck of data will be uploaded // and result will be CURLE_OK which breaks the loop. Also, getting other than CURLE_OK or // CURLE_AGAIN throws. - context.ThrowIfCanceled(); + context.ThrowIfCancelled(); for (CURLcode sendResult = CURLE_AGAIN; sendResult == CURLE_AGAIN;) { size_t sentBytesPerRequest = 0; @@ -606,7 +606,7 @@ void CurlSession::ReadStatusLineAndHeadersFromRawResponse( // Read from curl session int64_t CurlSession::Read(Context const& context, uint8_t* buffer, int64_t count) { - context.ThrowIfCanceled(); + context.ThrowIfCancelled(); if (count <= 0 || this->IsEOF()) { diff --git a/sdk/core/azure-core/src/http/curl/curl_connection_private.hpp b/sdk/core/azure-core/src/http/curl/curl_connection_private.hpp index 17412f92e..e575ac73e 100644 --- a/sdk/core/azure-core/src/http/curl/curl_connection_private.hpp +++ b/sdk/core/azure-core/src/http/curl/curl_connection_private.hpp @@ -106,65 +106,69 @@ namespace Azure { namespace Core { namespace Http { // C26812: The enum type 'CURLcode' is unscoped. Prefer 'enum class' over 'enum' (Enum.3) #pragma warning(disable : 26812) #endif - auto result = curl_easy_getinfo(m_handle, CURLINFO_ACTIVESOCKET, &m_curlSocket); + auto result = curl_easy_getinfo(m_handle, CURLINFO_ACTIVESOCKET, &m_curlSocket); #if defined(_MSC_VER) #pragma warning(pop) #endif - if (result != CURLE_OK) - { - throw Http::TransportException( - "Broken connection. Couldn't get the active sockect for it." - + std::string(curl_easy_strerror(result))); + if (result != CURLE_OK) + { + throw Http::TransportException( + "Broken connection. Couldn't get the active sockect for it." + + std::string(curl_easy_strerror(result))); + } } - } - /** - * @brief Destructor. - * @detail Cleans up CURL (invokes `curl_easy_cleanup()`). - */ - ~CurlConnection() override { curl_easy_cleanup(this->m_handle); } + /** + * @brief Destructor. + * @detail Cleans up CURL (invokes `curl_easy_cleanup()`). + */ + ~CurlConnection() override { curl_easy_cleanup(this->m_handle); } - std::string const& GetConnectionKey() const override { return this->m_connectionKey; } + std::string const& GetConnectionKey() const override { return this->m_connectionKey; } - /** - * @brief Update last usage time for the connection. - */ - void updateLastUsageTime() override { this->m_lastUseTime = std::chrono::steady_clock::now(); } + /** + * @brief Update last usage time for the connection. + */ + void updateLastUsageTime() override + { + this->m_lastUseTime = std::chrono::steady_clock::now(); + } - /** - * @brief Checks whether this CURL connection is expired. - * @return `true` if this connection is considered expired, `false` otherwise. - */ - bool isExpired() override - { - auto connectionOnWaitingTimeMs = std::chrono::duration_cast( - std::chrono::steady_clock::now() - this->m_lastUseTime); - return connectionOnWaitingTimeMs.count() >= Details::c_DefaultConnectionExpiredMilliseconds; - } + /** + * @brief Checks whether this CURL connection is expired. + * @return `true` if this connection is considered expired, `false` otherwise. + */ + bool isExpired() override + { + auto connectionOnWaitingTimeMs = std::chrono::duration_cast( + std::chrono::steady_clock::now() - this->m_lastUseTime); + return connectionOnWaitingTimeMs.count() >= Details::c_DefaultConnectionExpiredMilliseconds; + } - /** - * @brief This function is used when working with streams to pull more data from the wire. - * Function will try to keep pulling data from socket until the buffer is all written or until - * there is no more data to get from the socket. - * - * @param context #Context so that operation can be canceled. - * @param buffer ptr to buffer where to copy bytes from socket. - * @param bufferSize size of the buffer and the requested bytes to be pulled from wire. - * @return return the numbers of bytes pulled from socket. It can be less than what it was - * requested. - */ - int64_t ReadFromSocket(Context const& context, uint8_t* buffer, int64_t bufferSize) override; + /** + * @brief This function is used when working with streams to pull more data from the wire. + * Function will try to keep pulling data from socket until the buffer is all written or until + * there is no more data to get from the socket. + * + * @param context #Context so that operation can be cancelled. + * @param buffer ptr to buffer where to copy bytes from socket. + * @param bufferSize size of the buffer and the requested bytes to be pulled from wire. + * @return return the numbers of bytes pulled from socket. It can be less than what it was + * requested. + */ + int64_t ReadFromSocket(Context const& context, uint8_t* buffer, int64_t bufferSize) override; - /** - * @brief This method will use libcurl socket to write all the bytes from buffer. - * - * @remarks Hardcoded timeout is used in case a socket stop responding. - * - * @param context #Context so that operation can be canceled. - * @param buffer ptr to the data to be sent to wire. - * @param bufferSize size of the buffer to send. - * @return CURL_OK when response is sent successfully. - */ - CURLcode SendBuffer(Context const& context, uint8_t const* buffer, size_t bufferSize) override; - }; + /** + * @brief This method will use libcurl socket to write all the bytes from buffer. + * + * @remarks Hardcoded timeout is used in case a socket stop responding. + * + * @param context #Context so that operation can be cancelled. + * @param buffer ptr to the data to be sent to wire. + * @param bufferSize size of the buffer to send. + * @return CURL_OK when response is sent successfully. + */ + CURLcode SendBuffer(Context const& context, uint8_t const* buffer, size_t bufferSize) + override; + }; }}} // namespace Azure::Core::Http diff --git a/sdk/core/azure-core/src/http/curl/curl_session_private.hpp b/sdk/core/azure-core/src/http/curl/curl_session_private.hpp index 89b8e8f5c..45ef673f0 100644 --- a/sdk/core/azure-core/src/http/curl/curl_session_private.hpp +++ b/sdk/core/azure-core/src/http/curl/curl_session_private.hpp @@ -271,7 +271,7 @@ namespace Azure { namespace Core { namespace Http { * @brief Function used when working with Streams to manually write from the HTTP Request to * the wire. * - * @param context #Context so that operation can be canceled. + * @param context #Context so that operation can be cancelled. * * @return CURL_OK when response is sent successfully. */ @@ -280,7 +280,7 @@ namespace Azure { namespace Core { namespace Http { /** * @brief Upload body. * - * @param context #Context so that operation can be canceled. + * @param context #Context so that operation can be cancelled. * * @return Curl code. */ @@ -290,7 +290,7 @@ namespace Azure { namespace Core { namespace Http { * @brief This function is used after sending an HTTP request to the server to read the HTTP * RawResponse from wire until the end of headers only. * - * @param context #Context so that operation can be canceled. + * @param context #Context so that operation can be cancelled. * @param reuseInternalBuffer Indicates whether the internal buffer should be reused. * * @return CURL_OK when an HTTP response is created. @@ -303,7 +303,7 @@ namespace Azure { namespace Core { namespace Http { * @brief Reads from inner buffer or from Wire until chunkSize is parsed and converted to * unsigned long long * - * @param context #Context so that operation can be canceled. + * @param context #Context so that operation can be cancelled. */ void ParseChunkSize(Context const& context); @@ -371,7 +371,7 @@ namespace Azure { namespace Core { namespace Http { * @brief Function will use the HTTP request received in constructor to perform a network call * based on the HTTP request configuration. * - * @param context #Context so that operation can be canceled. + * @param context #Context so that operation can be cancelled. * @return CURLE_OK when the network call is completed successfully. */ CURLcode Perform(Context const& context); @@ -394,7 +394,7 @@ namespace Azure { namespace Core { namespace Http { /** * @brief Implement #BodyStream read. Calling this function pulls data from the wire. * - * @param context #Context so that operation can be canceled. + * @param context #Context so that operation can be cancelled. * @param buffer Buffer where data from wire is written to. * @param count The number of bytes to read from the network. * @return The actual number of bytes read from the network. diff --git a/sdk/core/azure-core/src/http/retry_policy.cpp b/sdk/core/azure-core/src/http/retry_policy.cpp index d20e4ea2b..3b3d7c71d 100644 --- a/sdk/core/azure-core/src/http/retry_policy.cpp +++ b/sdk/core/azure-core/src/http/retry_policy.cpp @@ -183,6 +183,6 @@ std::unique_ptr Azure::Core::Http::RetryPolicy::Send( // Restore the original query parameters before next retry request.GetUrl().SetQueryParameters(std::move(originalQueryParameters)); - ctx.ThrowIfCanceled(); + ctx.ThrowIfCancelled(); } } diff --git a/sdk/core/azure-core/src/http/winhttp/win_http_transport.cpp b/sdk/core/azure-core/src/http/winhttp/win_http_transport.cpp index 5ec274c76..071ebfd6e 100644 --- a/sdk/core/azure-core/src/http/winhttp/win_http_transport.cpp +++ b/sdk/core/azure-core/src/http/winhttp/win_http_transport.cpp @@ -559,7 +559,7 @@ std::unique_ptr WinHttpTransport::Send(Context const& context, Requ // Read the response from the sent request. int64_t Details::WinHttpStream::Read(Context const& context, uint8_t* buffer, int64_t count) { - context.ThrowIfCanceled(); + context.ThrowIfCancelled(); if (count <= 0 || this->m_isEOF) { @@ -587,7 +587,7 @@ int64_t Details::WinHttpStream::Read(Context const& context, uint8_t* buffer, in + std::to_string(error) + "."); } - context.ThrowIfCanceled(); + context.ThrowIfCancelled(); DWORD numberOfBytesToRead = numberOfBytesAvailable; if (numberOfBytesAvailable > count) diff --git a/sdk/core/azure-core/test/ut/context.cpp b/sdk/core/azure-core/test/ut/context.cpp index 0d53ae374..cbb1407b2 100644 --- a/sdk/core/azure-core/test/ut/context.cpp +++ b/sdk/core/azure-core/test/ut/context.cpp @@ -81,16 +81,16 @@ TEST(Context, BasicChar) EXPECT_TRUE(kind == ContextValue::ContextValueType::StdString); } -TEST(Context, IsCanceled) +TEST(Context, IsCancelled) { auto duration = std::chrono::milliseconds(150); auto deadline = std::chrono::system_clock::now() + duration; Context context; auto c2 = context.WithDeadline(deadline); - EXPECT_FALSE(c2.IsCanceled()); + EXPECT_FALSE(c2.IsCancelled()); std::this_thread::sleep_for(duration); - EXPECT_TRUE(c2.IsCanceled()); + EXPECT_TRUE(c2.IsCancelled()); } TEST(Context, Alternative) diff --git a/sdk/core/azure-core/test/ut/transport_adapter_base.cpp b/sdk/core/azure-core/test/ut/transport_adapter_base.cpp index 9dcca7619..c892ec55d 100644 --- a/sdk/core/azure-core/test/ut/transport_adapter_base.cpp +++ b/sdk/core/azure-core/test/ut/transport_adapter_base.cpp @@ -367,8 +367,8 @@ namespace Azure { namespace Core { namespace Test { auto stream = Azure::Core::Http::MemoryBodyStream(bigBuffer); auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Put, host, &stream); - // Request will be canceled from main thread throwing the exception - EXPECT_THROW(m_pipeline->Send(cancelThis, request), Azure::Core::OperationCanceledException); + // Request will be cancelled from main thread throwing the exception + EXPECT_THROW(m_pipeline->Send(cancelThis, request), Azure::Core::OperationCancelledException); }; // Start request @@ -390,8 +390,8 @@ namespace Azure { namespace Core { namespace Test { auto threadRoutine = [&]() { auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Get, host); - // Request will be canceled from main thread throwing the exception - EXPECT_THROW(m_pipeline->Send(cancelThis, request), Azure::Core::OperationCanceledException); + // Request will be cancelled from main thread throwing the exception + EXPECT_THROW(m_pipeline->Send(cancelThis, request), Azure::Core::OperationCancelledException); }; // Start request diff --git a/sdk/storage/azure-storage-common/src/storage_retry_policy.cpp b/sdk/storage/azure-storage-common/src/storage_retry_policy.cpp index da2dca99e..3dfeed4e7 100644 --- a/sdk/storage/azure-storage-common/src/storage_retry_policy.cpp +++ b/sdk/storage/azure-storage-common/src/storage_retry_policy.cpp @@ -95,7 +95,7 @@ namespace Azure { namespace Storage { namespace Details { switchHost(); - ctx.ThrowIfCanceled(); + ctx.ThrowIfCancelled(); const int64_t baseRetryDelayMs = m_options.RetryDelay.count(); const int64_t maxRetryDelayMs = m_options.MaxRetryDelay.count();