lib/amq/client/adapter.rb in amq-client-0.7.0.alpha17 vs lib/amq/client/adapter.rb in amq-client-0.7.0.alpha18
- old
+ new
@@ -215,10 +215,16 @@
def disconnect(reply_code = 200, reply_text = "Goodbye", &block)
@intentionally_closing_connection = true
self.on_disconnection(&block)
closing!
- self.connection.close(reply_code, reply_text)
+
+ # ruby-amqp/amqp#66, MK.
+ if self.connection
+ self.connection.close(reply_code, reply_text)
+ else
+ self.disconnection_successful
+ end
end
alias close disconnect
# Sends AMQ protocol header (also known as preamble).
#