diff --git a/src/OpenAPI.Net/OpenAPI.Net.csproj b/src/OpenAPI.Net/OpenAPI.Net.csproj index ae7ec2c..72b7bdb 100644 --- a/src/OpenAPI.Net/OpenAPI.Net.csproj +++ b/src/OpenAPI.Net/OpenAPI.Net.csproj @@ -9,7 +9,7 @@ cTrader, Open API, Spotware A .NET RX library for Spotware Open API Spotware.OpenAPI.Net - 1.3.7-rc0 + 1.3.7-rc1 AnyCPU Spotware Spotware diff --git a/src/OpenAPI.Net/OpenClient.cs b/src/OpenAPI.Net/OpenClient.cs index 59ffdb2..7d28d4f 100644 --- a/src/OpenAPI.Net/OpenClient.cs +++ b/src/OpenAPI.Net/OpenClient.cs @@ -387,7 +387,9 @@ private async Task ReadTcp(CancellationToken cancellationToken) { var count = lengthArray.Length - readBytes; - readBytes += await _sslStream.ReadAsync(lengthArray, readBytes, count, cancellationToken).ConfigureAwait(false); + var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(20)); + + readBytes += await _sslStream.ReadAsync(lengthArray, readBytes, count, cancellationTokenSource.Token).ConfigureAwait(false); } while (readBytes < lengthArray.Length); @@ -405,7 +407,9 @@ private async Task ReadTcp(CancellationToken cancellationToken) { var count = data.Length - readBytes; - readBytes += await _sslStream.ReadAsync(data, readBytes, count, cancellationToken).ConfigureAwait(false); + var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(20)); + + readBytes += await _sslStream.ReadAsync(data, readBytes, count, cancellationTokenSource.Token).ConfigureAwait(false); } while (readBytes < length);