From 4a9285ca12580656a8269c16e90e2bcd9374ae74 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 15 Jan 2009 04:46:50 +0100 Subject: [PATCH] ircbot: SIGUSR1 forces a reconnect --- lib/rbot/ircbot.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index 0ae1bce0..098a7292 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -829,7 +829,8 @@ class Bot # things to do when we receive a signal def got_sig(sig, func=:quit) debug "received #{sig}, queueing #{func}" - $interrupted += 1 + # this is not an interruption if we just need to reconnect + $interrupted += 1 unless func == :reconnect self.send(func) unless @quit_mutex.locked? debug "interrupted #{$interrupted} times" if $interrupted >= 3 @@ -845,6 +846,7 @@ class Bot trap("SIGINT") { got_sig("SIGINT") } trap("SIGTERM") { got_sig("SIGTERM") } trap("SIGHUP") { got_sig("SIGHUP", :restart) } + trap("SIGUSR1") { got_sig("SIGUSR1", :reconnect) } rescue ArgumentError => e debug "failed to trap signals (#{e.pretty_inspect}): running on Windows?" rescue Exception => e -- 2.39.2