mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2026-02-16 14:13:46 +00:00
Compare commits
2 Commits
40d480e1fc
...
de0a954a91
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de0a954a91 | ||
|
|
4a79ce22ec |
@ -6,9 +6,9 @@
|
|||||||
<PackageId>CryptoExchange.Net</PackageId>
|
<PackageId>CryptoExchange.Net</PackageId>
|
||||||
<Authors>JKorf</Authors>
|
<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>
|
<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>
|
<PackageVersion>10.4.0</PackageVersion>
|
||||||
<AssemblyVersion>10.3.1</AssemblyVersion>
|
<AssemblyVersion>10.4.0</AssemblyVersion>
|
||||||
<FileVersion>10.3.1</FileVersion>
|
<FileVersion>10.4.0</FileVersion>
|
||||||
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
<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>
|
<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>
|
<RepositoryType>git</RepositoryType>
|
||||||
|
|||||||
@ -53,41 +53,57 @@ namespace CryptoExchange.Net.Objects
|
|||||||
_waiters.Enqueue(tcs);
|
_waiters.Enqueue(tcs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timeout.HasValue || ct.CanBeCanceled)
|
CancellationTokenSource? delayCts = null;
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
// Wait for either timeout, cancellation token or set result
|
if (timeout.HasValue || ct.CanBeCanceled)
|
||||||
var delayTask = Task.Delay(timeout ?? Timeout.InfiniteTimeSpan, ct);
|
|
||||||
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
|
delayCts = CancellationTokenSource.CreateLinkedTokenSource(ct);
|
||||||
// if the tcs was set instead it will be removed in the Set method
|
|
||||||
|
|
||||||
if (tcs.TrySetResult(false))
|
var delayTask = Task.Delay(
|
||||||
|
timeout ?? Timeout.InfiniteTimeSpan,
|
||||||
|
delayCts.Token);
|
||||||
|
|
||||||
|
var completedTask =
|
||||||
|
await Task.WhenAny(tcs.Task, delayTask)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
|
if (completedTask != tcs.Task)
|
||||||
{
|
{
|
||||||
lock (_waitersLock)
|
// 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))
|
||||||
{
|
{
|
||||||
// Dequeue and put in the back of the queue again except for the one we need to remove
|
lock (_waitersLock)
|
||||||
int count = _waiters.Count;
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
{
|
||||||
var w = _waiters.Dequeue();
|
// Dequeue and put in the back of the queue again except for the one we need to remove
|
||||||
if (w != tcs)
|
int count = _waiters.Count;
|
||||||
_waiters.Enqueue(w);
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
var w = _waiters.Dequeue();
|
||||||
|
if (w != tcs)
|
||||||
|
_waiters.Enqueue(w);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
await tcs.Task.ConfigureAwait(false);
|
||||||
await tcs.Task.ConfigureAwait(false);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
// Actively stop the delay if tcs.Task won
|
||||||
|
delayCts?.Cancel();
|
||||||
|
delayCts?.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
16
README.md
16
README.md
@ -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).
|
Alternatively, sponsor me on Github using [Github Sponsors](https://github.com/sponsors/JKorf).
|
||||||
|
|
||||||
## Release notes
|
## 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
|
* Version 10.3.1 - 27 Jan 2026
|
||||||
* Fixed potential collection modified exception upon logging message not handled in websocket message handling
|
* Fixed potential collection modified exception upon logging message not handled in websocket message handling
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user