Undo the connection change for Hermes client.

This commit is contained in:
Tom 2025-01-14 01:21:11 +00:00
parent 75fa154546
commit 4099322ce2

View File

@ -34,7 +34,6 @@ namespace TwitchChatTTS.Hermes.Socket
public bool LoggedIn { get; set; } public bool LoggedIn { get; set; }
public bool Ready { get; set; } public bool Ready { get; set; }
private bool _attempting;
public HermesSocketClient( public HermesSocketClient(
@ -85,29 +84,23 @@ namespace TwitchChatTTS.Hermes.Socket
{ {
lock (_lock) lock (_lock)
{ {
if (Connected || _attempting) if (Connected)
return; return;
_attempting = true;
} }
_logger.Debug($"Attempting to connect to {URL}"); _logger.Debug($"Attempting to connect to {URL}");
await ConnectAsync(URL); await ConnectAsync(URL);
_attempting = false;
} }
private async Task Disconnect() private async Task Disconnect()
{ {
lock (_lock) lock (_lock)
{ {
if (!Connected || _attempting) if (!Connected)
return; return;
_attempting = true;
} }
await DisconnectAsync(new SocketDisconnectionEventArgs("Normal disconnection", "Disconnection was executed")); await DisconnectAsync(new SocketDisconnectionEventArgs("Normal disconnection", "Disconnection was executed"));
_attempting = false;
} }
public async Task CreateTTSVoice(string voiceName) public async Task CreateTTSVoice(string voiceName)