diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2009-01-15 04:46:50 +0100 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2009-01-15 04:48:36 +0100 |
commit | 4a9285ca12580656a8269c16e90e2bcd9374ae74 (patch) | |
tree | a50209680fa0bd73c8e7ab826042c04d7dbc28c1 | |
parent | 37f2e09f71f53226ccc167a485ffc7286324cdcb (diff) |
ircbot: SIGUSR1 forces a reconnect
-rw-r--r-- | lib/rbot/ircbot.rb | 4 |
1 files changed, 3 insertions, 1 deletions
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 |