1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2026-02-16 14:13:46 +00:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Jkorf
de0a954a91 Updated to version 10.4.0 2026-02-06 12:00:50 +01:00
Jkorf
4a79ce22ec Added timeout/ct task cleanup AsyncResetEvent 2026-02-06 11:57:56 +01:00
3 changed files with 59 additions and 27 deletions

View File

@ -6,9 +6,9 @@
<PackageId>CryptoExchange.Net</PackageId>
<Authors>JKorf</Authors>
<Description>CryptoExchange.Net is a base library which is used to implement different cryptocurrency (exchange) API's. It provides a standardized way of implementing different API's, which results in a very similar experience for users of the API implementations.</Description>
<PackageVersion>10.3.1</PackageVersion>
<AssemblyVersion>10.3.1</AssemblyVersion>
<FileVersion>10.3.1</FileVersion>
<PackageVersion>10.4.0</PackageVersion>
<AssemblyVersion>10.4.0</AssemblyVersion>
<FileVersion>10.4.0</FileVersion>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageTags>OKX;OKX.Net;Mexc;Mexc.Net;Kucoin;Kucoin.Net;Kraken;Kraken.Net;Huobi;Huobi.Net;CoinEx;CoinEx.Net;Bybit;Bybit.Net;Bitget;Bitget.Net;Bitfinex;Bitfinex.Net;Binance;Binance.Net;CryptoCurrency;CryptoCurrency Exchange;CryptoExchange.Net</PackageTags>
<RepositoryType>git</RepositoryType>

View File

@ -53,17 +53,26 @@ namespace CryptoExchange.Net.Objects
_waiters.Enqueue(tcs);
}
CancellationTokenSource? delayCts = null;
try
{
if (timeout.HasValue || ct.CanBeCanceled)
{
// Wait for either timeout, cancellation token or set result
var delayTask = Task.Delay(timeout ?? Timeout.InfiniteTimeSpan, ct);
var completedTask = await Task.WhenAny(tcs.Task, delayTask).ConfigureAwait(false);
delayCts = CancellationTokenSource.CreateLinkedTokenSource(ct);
var delayTask = Task.Delay(
timeout ?? Timeout.InfiniteTimeSpan,
delayCts.Token);
var completedTask =
await Task.WhenAny(tcs.Task, delayTask)
.ConfigureAwait(false);
if (completedTask != tcs.Task)
{
// This was a timeout or cancellation, need to remove tcs from waiters
// if the tcs was set instead it will be removed in the Set method
if (tcs.TrySetResult(false))
{
lock (_waitersLock)
@ -89,6 +98,13 @@ namespace CryptoExchange.Net.Objects
return true;
}
finally
{
// Actively stop the delay if tcs.Task won
delayCts?.Cancel();
delayCts?.Dispose();
}
}
/// <summary>
/// Signal a waiter

View File

@ -67,6 +67,22 @@ Make a one time donation in a crypto currency of your choice. If you prefer to d
Alternatively, sponsor me on Github using [Github Sponsors](https://github.com/sponsors/JKorf).
## Release notes
* Version 10.4.0 - 06 Feb 2026
* Added user data tracking logic
* Added LastReceiveTime, SocketStatus and SubscriptionStatus properties to UpdateSubscription
* Added SharedTransferStatus Enum and property to SharedDeposit
* Added PositionMode property to SharedPosition model
* Added IsZero property to SharedQuantity
* Added additional methods for requesting supported symbols to Shared ISpotSymbolRestClient/IFuturesSymbolRestClient interfaces
* Added Disposed property on BaseClient and IRestClient/ISocketClient interfaces
* Added AutoTimestamp option for socket client
* Renamed IWebSocket LastActionTime to LastReceiveTime
* Refactored AsyncResetEvent implementation
* Updated CryptoExchangeWebsocketClient LastReceiveTime logic
* Updated Subscription status change event handler to run sync instead of separate task
* Updated Interval property access on KlineTracker to public
* Fixed socket client timestamp offset bug
* Version 10.3.1 - 27 Jan 2026
* Fixed potential collection modified exception upon logging message not handled in websocket message handling