Fixed connexion exception retry (#5261).
This commit is contained in:
parent
9a3bf64417
commit
03e346554f
@ -400,6 +400,7 @@ public class Hebdobot extends PircBot
|
||||
*/
|
||||
public void run() throws HebdobotException
|
||||
{
|
||||
//
|
||||
try
|
||||
{
|
||||
logger.info("Cron initializing.");
|
||||
@ -408,46 +409,59 @@ public class Hebdobot extends PircBot
|
||||
this.cronManager.start();
|
||||
}
|
||||
logger.info("Cron initialized.");
|
||||
|
||||
logger.info("Bot connection.");
|
||||
this.connect(this.host, this.port);
|
||||
logger.info("Bot connected.");
|
||||
|
||||
if (this.identifyPassword == null)
|
||||
{
|
||||
logger.info("Skipped identify.");
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.info("Apply identify.");
|
||||
sendMessage("NickServ", "identify " + this.identifyNick + " " + this.identifyPassword);
|
||||
logger.info("Applied identify.");
|
||||
}
|
||||
|
||||
logger.info("Bot joining channel ({}).", this.channel);
|
||||
this.joinChannel(this.channel);
|
||||
logger.info("Bot ready.");
|
||||
}
|
||||
catch (NickAlreadyInUseException exception)
|
||||
{
|
||||
throw new HebdobotException(exception);
|
||||
}
|
||||
catch (IOException exception)
|
||||
{
|
||||
throw new HebdobotException(exception);
|
||||
}
|
||||
catch (IrcException exception)
|
||||
{
|
||||
throw new HebdobotException(exception);
|
||||
}
|
||||
catch (SchedulerException exception)
|
||||
catch (SchedulerException | ParseException exception)
|
||||
{
|
||||
throw new HebdobotException("Error in cron settings.", exception);
|
||||
}
|
||||
catch (ParseException exception)
|
||||
|
||||
// Manage "Caused by: java.net.UnknownHostException: irc.freenode.org".
|
||||
boolean ended = false;
|
||||
while (!ended)
|
||||
{
|
||||
throw new HebdobotException(exception);
|
||||
try
|
||||
{
|
||||
logger.info("Bot connection.");
|
||||
this.connect(this.host, this.port);
|
||||
logger.info("Bot connected.");
|
||||
ended = true;
|
||||
}
|
||||
catch (NickAlreadyInUseException exception)
|
||||
{
|
||||
throw new HebdobotException(exception);
|
||||
}
|
||||
catch (IOException exception)
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread.sleep(60000);
|
||||
}
|
||||
catch (InterruptedException subException)
|
||||
{
|
||||
subException.printStackTrace();
|
||||
}
|
||||
}
|
||||
catch (IrcException exception)
|
||||
{
|
||||
throw new HebdobotException(exception);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (this.identifyPassword == null)
|
||||
{
|
||||
logger.info("Skipped identify.");
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.info("Apply identify.");
|
||||
sendMessage("NickServ", "identify " + this.identifyNick + " " + this.identifyPassword);
|
||||
logger.info("Applied identify.");
|
||||
}
|
||||
|
||||
logger.info("Bot joining channel ({}).", this.channel);
|
||||
this.joinChannel(this.channel);
|
||||
logger.info("Bot ready.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user