Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Microsoft.IO.RecyclableMemoryStream to version 3.0.0. #266

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions UaClient/ServiceModel/Ua/Channels/ClientSecureChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,11 @@ private async Task SendRequestAsync(ServiceOperation operation, CancellationToke
{
_sendingSemaphore.Release();
}
}

private RecyclableMemoryStream GetRecyclableMemoryStreams(string tag)
{
return new RecyclableMemoryStream(_streamManager, tag);
}

/// <summary>
Expand All @@ -325,7 +330,7 @@ private async Task SendRequestAsync(ServiceOperation operation, CancellationToke
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
private async Task SendOpenSecureChannelRequestAsync(OpenSecureChannelRequest request, CancellationToken token)
{
var bodyStream = _streamManager.GetStream("SendOpenSecureChannelRequestAsync");
var bodyStream = GetRecyclableMemoryStreams("SendOpenSecureChannelRequestAsync");
using (var bodyEncoder = StackProfile.EncodingProvider.CreateEncoder(bodyStream, this, keepStreamOpen: false))
{
bodyEncoder.WriteRequest(request);
Expand All @@ -344,7 +349,7 @@ private async Task SendOpenSecureChannelRequestAsync(OpenSecureChannelRequest re
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
private async Task SendCloseSecureChannelRequestAsync(CloseSecureChannelRequest request, CancellationToken token)
{
var bodyStream = _streamManager.GetStream("SendCloseSecureChannelRequestAsync");
var bodyStream = GetRecyclableMemoryStreams("SendCloseSecureChannelRequestAsync");
using (var bodyEncoder = StackProfile.EncodingProvider.CreateEncoder(bodyStream, this, keepStreamOpen: false))
{
bodyEncoder.WriteRequest(request);
Expand All @@ -363,7 +368,7 @@ private async Task SendCloseSecureChannelRequestAsync(CloseSecureChannelRequest
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
private async Task SendServiceRequestAsync(IServiceRequest request, CancellationToken token)
{
var bodyStream = _streamManager.GetStream("SendServiceRequestAsync");
var bodyStream = GetRecyclableMemoryStreams("SendServiceRequestAsync");
using (var bodyEncoder = StackProfile.EncodingProvider.CreateEncoder(bodyStream, this, keepStreamOpen: false))
{
bodyEncoder.WriteRequest(request);
Expand Down Expand Up @@ -463,7 +468,7 @@ private async Task ReceiveResponsesAsync(CancellationToken token = default)
token.ThrowIfCancellationRequested();
ThrowIfClosedOrNotOpening();

var bodyStream = _streamManager.GetStream("ReceiveResponseAsync");
var bodyStream = GetRecyclableMemoryStreams("ReceiveResponseAsync");
using (var bodyDecoder = StackProfile.EncodingProvider.CreateDecoder(bodyStream, this, keepStreamOpen: false))
{
var ret = await _conversation!.DecryptMessageAsync(bodyStream, ReceiveAsync, token).ConfigureAwait(false);
Expand Down
2 changes: 1 addition & 1 deletion UaClient/Workstation.UaClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.2.1" />
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="[2.2.1,4.0.0)" />
<PackageReference Include="Portable.BouncyCastle" Version="1.9.0" />
<PackageReference Include="System.Reactive" Version="5.0.0" />
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="7.0.0" />
Expand Down