mirror of
				https://github.com/JKorf/CryptoExchange.Net
				synced 2025-10-31 02:17:45 +00:00 
			
		
		
		
	Don't close socket after failed auth when already closing
This commit is contained in:
		
							parent
							
								
									50715ff2f7
								
							
						
					
					
						commit
						41f17d0378
					
				| @ -392,11 +392,14 @@ namespace CryptoExchange.Net | |||||||
|             if (!authenticated || socket.Authenticated) |             if (!authenticated || socket.Authenticated) | ||||||
|                 return new CallResult<bool>(true); |                 return new CallResult<bool>(true); | ||||||
| 
 | 
 | ||||||
|  |             log.Write(LogLevel.Debug, $"Attempting to authenticate {socket.SocketId}"); | ||||||
|             var result = await AuthenticateSocketAsync(socket).ConfigureAwait(false); |             var result = await AuthenticateSocketAsync(socket).ConfigureAwait(false); | ||||||
|             if (!result) |             if (!result) | ||||||
|             { |             { | ||||||
|                 await socket.CloseAsync().ConfigureAwait(false); |  | ||||||
|                 log.Write(LogLevel.Warning, $"Socket {socket.SocketId} authentication failed"); |                 log.Write(LogLevel.Warning, $"Socket {socket.SocketId} authentication failed"); | ||||||
|  |                 if(socket.Connected) | ||||||
|  |                     await socket.CloseAsync().ConfigureAwait(false); | ||||||
|  | 
 | ||||||
|                 result.Error!.Message = "Authentication failed: " + result.Error.Message; |                 result.Error!.Message = "Authentication failed: " + result.Error.Message; | ||||||
|                 return new CallResult<bool>(result.Error); |                 return new CallResult<bool>(result.Error); | ||||||
|             } |             } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user