1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2025-06-07 07:56:12 +00:00

Close socket when connecting and authentication fails

This commit is contained in:
JKorf 2024-06-23 14:55:20 +02:00
parent 09ed7d1436
commit e927bc3d20

View File

@ -383,7 +383,11 @@ namespace CryptoExchange.Net.Clients
if (!authenticated || socket.Authenticated)
return new CallResult(null);
return await AuthenticateSocketAsync(socket).ConfigureAwait(false);
var result = await AuthenticateSocketAsync(socket).ConfigureAwait(false);
if (!result)
await socket.CloseAsync().ConfigureAwait(false);
return result;
}
/// <summary>