From b2152a0142ad536ff3d3868974620535203a7e8c Mon Sep 17 00:00:00 2001 From: franz Date: Tue, 20 Oct 2009 09:13:55 +0200 Subject: [PATCH] ircbot.rb: fix reconnect logic connect calls stop_server_pings, which resets @last_rec, and if @socket.connect raises exception, @last_rec remains nil, and reconnect will not wait for next try, causing hundreds of reconnect tries per second, which the logger thread cannot process fast enough, leading to memory leaks (growing $log_queue). --- lib/rbot/ircbot.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index 2f146c29..b5505262 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -912,9 +912,10 @@ class Bot begin quit if $interrupted > 0 @socket.connect - @last_rec = Time.now rescue => e raise e.class, "failed to connect to IRC server at #{@socket.server_uri}: #{e}" + ensure + @last_rec = Time.now end quit if $interrupted > 0 -- 2.32.0.93.g670b81a890