From 0bc1136a60256a1f2724ff5daaf7a292f64fb02b Mon Sep 17 00:00:00 2001 From: Yann Malet Date: Sun, 18 May 2014 22:49:55 +0200 Subject: [PATCH] refs #15. give a grace period of 3 missed reply to Ping. --- network/irc/irc.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/network/irc/irc.go b/network/irc/irc.go index 6cde4b9..8b9e750 100644 --- a/network/irc/irc.go +++ b/network/irc/irc.go @@ -102,6 +102,7 @@ func (bot *ircBot) monitor() { for bot.IsRunning() { if pongCounter > maxPongWithoutMessage { glog.Infoln("More than maxPongWithoutMessage pong without message for", bot) + glog.Infoln("IRC monitoring KO", bot) bot.reconnect() } select { @@ -121,8 +122,9 @@ func (bot *ircBot) monitor() { } case <-time.After(time.Second * 10): glog.Infoln("No pong from ircBot server", bot) - glog.Infoln("IRC monitoring KO.") - bot.reconnect() + // Do not kill the server on the first missed PONG + // 3 chances 15/5 + pongCounter += 5 } } }