mirror of
				https://github.com/JKorf/CryptoExchange.Net
				synced 2025-10-31 02:17:45 +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> |         /// </summary> | ||||||
|         public int Weight { get; } |         public int Weight { get; } | ||||||
| 
 | 
 | ||||||
|  |         /// <summary> | ||||||
|  |         /// Whether the query should wait for a response or not | ||||||
|  |         /// </summary> | ||||||
|  |         public bool ExpectsResponse { get; set; } = true; | ||||||
|  | 
 | ||||||
|         /// <summary> |         /// <summary> | ||||||
|         /// Get the type the message should be deserialized to |         /// Get the type the message should be deserialized to | ||||||
|         /// </summary> |         /// </summary> | ||||||
| @ -116,11 +121,20 @@ namespace CryptoExchange.Net.Sockets | |||||||
|         /// </summary> |         /// </summary> | ||||||
|         public void IsSend(TimeSpan timeout) |         public void IsSend(TimeSpan timeout) | ||||||
|         { |         { | ||||||
|             // Start timeout countdown |  | ||||||
|             RequestTimestamp = DateTime.UtcNow; |             RequestTimestamp = DateTime.UtcNow; | ||||||
|  |             if (ExpectsResponse) | ||||||
|  |             { | ||||||
|  |                 // Start timeout countdown | ||||||
|                 _cts = new CancellationTokenSource(timeout); |                 _cts = new CancellationTokenSource(timeout); | ||||||
|                 _cts.Token.Register(Timeout, false); |                 _cts.Token.Register(Timeout, false); | ||||||
|             } |             } | ||||||
|  |             else | ||||||
|  |             { | ||||||
|  |                 Completed = true; | ||||||
|  |                 Result = CallResult.SuccessResult; | ||||||
|  |                 _event.Set(); | ||||||
|  |             } | ||||||
|  |         } | ||||||
| 
 | 
 | ||||||
|         /// <summary> |         /// <summary> | ||||||
|         /// Wait until timeout or the request is completed |         /// Wait until timeout or the request is completed | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user