lib/amqp/client.rb in tmm1-amqp-0.6.0 vs lib/amqp/client.rb in tmm1-amqp-0.6.1
- old
+ new
@@ -63,11 +63,11 @@
extend AMQP.client
@on_disconnect ||= proc{ raise Error, "Could not connect to server #{opts[:host]}:#{opts[:port]}" }
timeout @settings[:timeout] if @settings[:timeout]
- errback{ @on_disconnect.call }
+ errback{ @on_disconnect.call } unless @reconnecting
end
def connection_completed
log 'connected'
# @on_disconnect = proc{ raise Error, 'Disconnected from server' }
@@ -156,18 +156,18 @@
EM.add_timer(1){ reconnect(true) }
return
end
unless @reconnecting
+ @reconnecting = true
+
@deferred_status = nil
initialize(@settings)
mqs = @channels
@channels = {}
mqs.each{ |_,mq| mq.reset } if mqs
-
- @reconnecting = true
end
log 'reconnecting'
EM.reconnect @settings[:host], @settings[:port], self
end
@@ -184,6 +184,6 @@
require 'pp'
pp args
puts
end
end
-end
\ No newline at end of file
+end