summaryrefslogtreecommitdiff
path: root/lib/rbot/ircbot.rb
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2021-06-02 21:25:58 +0200
committerMatthias Hecker <36882671+mattzque@users.noreply.github.com>2021-06-05 18:06:45 +0200
commitab23670d711ce0ab3e609421df96d837b6b93350 (patch)
treecfb3bab1848b815f429b19e8c60568e27093d5bb /lib/rbot/ircbot.rb
parent03d0839fa48fd9424b7a968986e96b7e69e84d25 (diff)
fix: restore logging of session start/end
Diffstat (limited to 'lib/rbot/ircbot.rb')
-rw-r--r--lib/rbot/ircbot.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb
index 817acd71..f9f1758a 100644
--- a/lib/rbot/ircbot.rb
+++ b/lib/rbot/ircbot.rb
@@ -456,6 +456,8 @@ class Bot
end
return str.to_s.size
end
+
+ LoggerManager.instance.log_session_start
end
File.open($opts['pidfile'] || File.join(@botclass, 'rbot.pid'), 'w') do |pf|
@@ -927,7 +929,8 @@ class Bot
# begin event handling loop
def mainloop
- while true
+ @keep_looping = true
+ while @keep_looping
too_fast = 0
quit_msg = nil
valid_recv = false # did we receive anything (valid) from the server yet?
@@ -957,7 +960,8 @@ class Bot
# exceptions that ARENT SocketError's. How am I supposed to handle
# that?
rescue SystemExit
- exit 0
+ @keep_looping = false
+ break
rescue Errno::ETIMEDOUT, Errno::ECONNABORTED, TimeoutError, SocketError => e
error "network exception: #{e.pretty_inspect}"
quit_msg = e.to_s
@@ -1254,7 +1258,7 @@ class Bot
begin
shutdown(message)
ensure
- exit 0
+ @keep_looping = false
end
end
@@ -1264,6 +1268,10 @@ class Bot
:wait => @config['server.reconnect_wait']
} if (!message || message.empty?)
shutdown(message)
+
+ Irc::Bot::LoggerManager.instance.flush
+ Irc::Bot::LoggerManager.instance.log_session_end
+
sleep @config['server.reconnect_wait']
begin
# now we re-exec