lib/amq/client/async/adapters/coolio.rb in amq-client-0.7.0.alpha35 vs lib/amq/client/async/adapters/coolio.rb in amq-client-0.8.0
- old
+ new
@@ -120,10 +120,12 @@
}
@locale = @settings.fetch(:locale, "en_GB")
@client_properties = Settings.client_properties.merge(@settings.fetch(:client_properties, Hash.new))
+ @auto_recovery = (!!@settings[:auto_recovery])
+
socket
end
# Registers on_open callback
# @see #on_open
@@ -274,18 +276,33 @@
protected
# @api private
def post_init
+ if @had_successfully_connected_before
+ @recovered = true
+
+ self.exec_callback_yielding_self(:before_recovery, @settings)
+
+ self.register_connection_callback do
+ self.auto_recover
+ self.exec_callback_yielding_self(:after_recovery, @settings)
+ end
+ end
+
+ # now we can set it. MK.
+ @had_successfully_connected_before = true
+ @reconnecting = false
+
self.reset
self.handshake
end
# @api private
def reset
@chunk_buffer = ""
@frames = Array.new
end
- end # CoolioClient
+ end # CoolioClient
end # Async
end # Client
end # AMQ