summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2021-06-24 12:05:10 +0200
committerSimon Rettberg2021-06-24 12:05:10 +0200
commit5eae9c9e007667f2ba582b553137002e843dbcf5 (patch)
treed2926960da900478cf16619700d267d69e4d1d91
parentJava 1.8 (diff)
downloadtmlite-bwlp-5eae9c9e007667f2ba582b553137002e843dbcf5.tar.gz
tmlite-bwlp-5eae9c9e007667f2ba582b553137002e843dbcf5.tar.xz
tmlite-bwlp-5eae9c9e007667f2ba582b553137002e843dbcf5.zip
[IrcClient] Handle (dis)connects better
-rw-r--r--src/main/java/org/openslx/satserver/util/IrcClient.java6
1 files changed, 6 insertions, 0 deletions
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 );