Skip to content

Commit

Permalink
Bring semaphore synchronization updates in retry delegating handler t…
Browse files Browse the repository at this point in the history
…o LTS (#3148)

* fix(iot-dev): Fix bug where client's retry policy applied n^2 times rather than n times (#2209)
* Fix synchronization of semaphore in retry delegating handler (#3135)
---------

Co-authored-by: timtay-microsoft <[email protected]>
  • Loading branch information
abhipsaMisra and timtay-microsoft authored Mar 8, 2023
1 parent 784e866 commit 6463887
Show file tree
Hide file tree
Showing 8 changed files with 616 additions and 316 deletions.
2 changes: 1 addition & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ Function BuildPackage($path, $message)
SignDotNetBinary $filesToSign
}

& dotnet pack --verbosity $verbosity --configuration $configuration --no-build --include-symbols --include-source --output $localPackages
& dotnet pack --verbosity $verbosity --configuration $configuration --no-build --include-symbols --include-source --property:PackageOutputPath=$localPackages

if ($LASTEXITCODE -ne 0)
{
Expand Down
1 change: 1 addition & 0 deletions e2e/test/iothub/FileUploadE2ETests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public async Task FileUpload_SmallFile_Http_GranularSteps_x509()

[LoggedTestMethod]
[TestCategory("LongRunning")]
[TestCategory("Proxy")]
public async Task FileUpload_SmallFile_Http_GranularSteps_Proxy()
{
string filename = await GetTestFileNameAsync(FileSizeSmall).ConfigureAwait(false);
Expand Down
1 change: 1 addition & 0 deletions e2e/test/iothub/service/RegistryManagerE2ETests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public async Task RegistryManager_AddDeviceWithTwinWithDeviceCapabilities()
}

[LoggedTestMethod]
[TestCategory("Proxy")]
public async Task RegistryManager_AddDeviceWithProxy()
{
string deviceId = _devicePrefix + Guid.NewGuid();
Expand Down
5 changes: 3 additions & 2 deletions iothub/device/src/Transport/DefaultDelegatingHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ namespace Microsoft.Azure.Devices.Client.Transport
{
internal abstract class DefaultDelegatingHandler : IDelegatingHandler
{
private volatile IDelegatingHandler _innerHandler;
protected const string ClientDisposedMessage = "The client has been disposed and is no longer usable.";
protected volatile bool _disposed;
private volatile IDelegatingHandler _innerHandler;

protected DefaultDelegatingHandler(IPipelineContext context, IDelegatingHandler innerHandler)
{
Expand Down Expand Up @@ -208,7 +209,7 @@ protected void ThrowIfDisposed()
{
if (_disposed)
{
throw new ObjectDisposedException("IoT Client");
throw new ObjectDisposedException("IoT client", ClientDisposedMessage);
}
}

Expand Down
553 changes: 405 additions & 148 deletions iothub/device/src/Transport/RetryDelegatingHandler.cs

Large diffs are not rendered by default.

358 changes: 200 additions & 158 deletions iothub/device/tests/RetryDelegatingHandlerTests.cs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions iothub/service/src/IoTHubExceptionResult.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Diagnostics.CodeAnalysis;
using Newtonsoft.Json;

namespace Microsoft.Azure.Devices
Expand All @@ -10,6 +11,8 @@ namespace Microsoft.Azure.Devices
/// </summary>
internal class IoTHubExceptionResult
{
[SuppressMessage("Usage", "CA1507: Use nameof in place of string literal 'Message'",
Justification = "This JsonProperty annotation depends on service-defined contract (name) and is independent of the property name selected by the SDK.")]
[JsonProperty("Message")]
internal string Message { get; set; }
}
Expand Down
9 changes: 2 additions & 7 deletions vsts/vsts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -532,13 +532,8 @@ jobs:
pool:
vmImage: windows-2022
steps:
- script: |
rem Run dotnet first experience.
dotnet new
rem Start build
build.cmd -clean -build -configuration Debug -package
displayName: build
- powershell: .\build.ps1 -clean -build -configutaion Debug -package
displayName: Build Package

- task: ComponentGovernanceComponentDetection@0
displayName: "Component Detection"
Expand Down

0 comments on commit 6463887

Please sign in to comment.