The reconnect() call in the main loop must be protected in the
begin/rescue blocks. Most of the rescue blocks can be fall-through,
because the begin/end is wrapped in a loop. The only exception is the
ServerError block that issues a retry lest too_fast is reset to false
even when it should be true.
while true
too_fast = false
begin
- quit if $interrupted > 0
quit_msg = nil
+ reconnect(quit_msg, too_fast)
+ quit if $interrupted > 0
while @socket.connected?
quit if $interrupted > 0
# received an ERROR from the server
quit_msg = "server ERROR: " + e.message
too_fast = e.message.index("reconnect too fast")
+ retry
rescue BDB::Fatal => e
fatal "fatal bdb error: #{e.pretty_inspect}"
DBTree.stats
log_session_end
exit 2
end
- reconnect(quit_msg, too_fast)
end
end