Closed Davide95 closed 7 years ago
Hello! In theory, KICL should automatically retry things. Could I get more of that exception?
Hi. I'm so sorry for the delay but now there are lots of university exams here and I'm quite busy. The code I'm actually using is that:
public class IrcBot implements Bot {
private Client client;
public IrcBot() {
client = Client.builder()
.nick(configs.get(USERNAME_KEY))
.serverHost(configs.get(HOST_KEY))
.listenInput(line -> logger.debug("[I]: " + line))
.listenOutput(line -> logger.debug("[O]: " + line))
.listenException(logger::error)
.defaultMessageMap(new SimpleDefaultMessageMap())
.build();
client.getEventManager().registerEventListener(this);
}
@Handler
private void onClientConnected(ClientConnectedEvent event) {
if (configs.containsKey(PASSWORD_KEY)) {
AuthManager auth = client.getAuthManager();
auth.addProtocol(new SaslPlain(client,
client.getIntendedNick(), configs.get(PASSWORD_KEY)));
}
for (String channel : channels) {
try {
client.addChannel(channel);
logger.info("Joined '{}'", channel);
} catch (IllegalArgumentException e) {
logger.error("Invalid channel name '{}' on '{}'.",
channel,
configs.get(HOST_KEY), e);
}
}
}
}
During this time I realized that maybe the client is reconnecting, but it doesn't automatically re-call onClientConnected after the reconnection, so it doesn't join channels. Is this is the problem, why it doesn't call automatically this event? And what can I do to re-join channels?
I'm so sorry if it's my fault and I forgot to do something
The event should fire every time. Though it could be worth checking to see via WHOIS if the client is there.
Either way, could you give me some more of that exception from the log?
The only thing is showing is that exception. I'm going to set log4j in debug mode so we can see all inputs / outputs, but we've to wait until the next timeout from freenode. Can I do something more in the meantime?
...yes, but you haven't given an actual stacktrace. You gave a single line.
@Davide95 Polite ping asking for the rest of the stacktrace! :smile:
My messages in @kashike 's post actually appear to be unrelated.
This commit should resolve issues with not reconnecting. Later commits will involve better reconnection handling support, too.
https://github.com/KittehOrg/KittehIRCClientLib/commit/c9ce3494be072042d9579c8bfb42699987160497
To be released in 4.0.0
I haven't find any way to implement auto-reconnect after a timeout. The error log returns a org.kitteh.irc.client.library.exception.KittehConnectionException: io.netty.channel.ConnectTimeoutException: connection timed out: chat.freenode.net/71.11.84.232:6697 In the README / docs there aren't infos about reconnecting, maybe I'm missing something but I think there isn't any way to do so now and it could be a good feature. Sorry for my bad English but I'm not native