mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2025-07-22 01:15:36 +00:00
Added support for sending query without expecting a response
This commit is contained in:
parent
f1342b5ff2
commit
2cf10668dd
@ -79,6 +79,11 @@ namespace CryptoExchange.Net.Sockets
|
||||
/// </summary>
|
||||
public int Weight { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the query should wait for a response or not
|
||||
/// </summary>
|
||||
public bool ExpectsResponse { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Get the type the message should be deserialized to
|
||||
/// </summary>
|
||||
@ -116,10 +121,19 @@ namespace CryptoExchange.Net.Sockets
|
||||
/// </summary>
|
||||
public void IsSend(TimeSpan timeout)
|
||||
{
|
||||
// Start timeout countdown
|
||||
RequestTimestamp = DateTime.UtcNow;
|
||||
_cts = new CancellationTokenSource(timeout);
|
||||
_cts.Token.Register(Timeout, false);
|
||||
if (ExpectsResponse)
|
||||
{
|
||||
// Start timeout countdown
|
||||
_cts = new CancellationTokenSource(timeout);
|
||||
_cts.Token.Register(Timeout, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
Completed = true;
|
||||
Result = CallResult.SuccessResult;
|
||||
_event.Set();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
x
Reference in New Issue
Block a user