From 5eae9c9e007667f2ba582b553137002e843dbcf5 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 24 Jun 2021 12:05:10 +0200 Subject: [IrcClient] Handle (dis)connects better --- src/main/java/org/openslx/satserver/util/IrcClient.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/org/openslx/satserver/util/IrcClient.java b/src/main/java/org/openslx/satserver/util/IrcClient.java index f7b6632..423c7c7 100644 --- a/src/main/java/org/openslx/satserver/util/IrcClient.java +++ b/src/main/java/org/openslx/satserver/util/IrcClient.java @@ -118,12 +118,17 @@ public class IrcClient synchronized ( wrapper ) { if ( !wrapper.connection.isConnected() ) { try { + wrapper.channels.clear(); wrapper.connection.connect(); } catch ( KeyManagementException | NoSuchAlgorithmException | IOException e ) { LOGGER.warn( "Cannot connect to " + host + " port " + port + " SSL: " + ssl, e ); outErrors.add( "Cannot connect to " + host + " port " + port + " SSL: " + ssl ); return; } + try { + Thread.sleep( 5000 ); + } catch ( InterruptedException e ) { + } } if ( wrapper.connection.isConnected() ) { wrapper.sendMessage( channel, message ); @@ -156,6 +161,7 @@ public class IrcClient { try { if ( !channels.contains( channel.toLowerCase() ) ) { + LOGGER.info( "Joining " + channel ); connection.doJoin( channel ); } connection.doPrivmsg( channel, message ); -- cgit v1.2.3-55-g7522