Always close twitch client in connect() method
In case user cleared their crendentials this method should still at least close the client so it will not be running forever. Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
@@ -99,6 +99,13 @@ public class TwitchPlugin extends Plugin implements TwitchListener, ChatboxInput
|
||||
|
||||
private synchronized void connect()
|
||||
{
|
||||
if (twitchIRCClient != null)
|
||||
{
|
||||
log.debug("Terminating Twitch client {}", twitchIRCClient);
|
||||
twitchIRCClient.close();
|
||||
twitchIRCClient = null;
|
||||
}
|
||||
|
||||
if (!Strings.isNullOrEmpty(twitchConfig.username())
|
||||
&& !Strings.isNullOrEmpty(twitchConfig.oauthToken())
|
||||
&& !Strings.isNullOrEmpty(twitchConfig.channel()))
|
||||
@@ -111,11 +118,6 @@ public class TwitchPlugin extends Plugin implements TwitchListener, ChatboxInput
|
||||
|
||||
log.debug("Connecting to Twitch as {}", twitchConfig.username());
|
||||
|
||||
if (twitchIRCClient != null)
|
||||
{
|
||||
twitchIRCClient.close();
|
||||
}
|
||||
|
||||
twitchIRCClient = new TwitchIRCClient(
|
||||
this,
|
||||
twitchConfig.username(),
|
||||
|
||||
Reference in New Issue
Block a user