lib/amqp/channel.rb in amqp-0.9.2 vs lib/amqp/channel.rb in amqp-0.9.3
- old
+ new
@@ -928,12 +928,11 @@
# Closes AMQP channel.
#
# @api public
def close(reply_code = 200, reply_text = DEFAULT_REPLY_TEXT, class_id = 0, method_id = 0, &block)
r = super(reply_code, reply_text, class_id, method_id, &block)
- self.class.release_channel_id(@id)
-
+
r
end
# @endgroup
@@ -1112,11 +1111,18 @@
def handle_close(method)
super(method)
self.class.error(method.reply_text)
end
-
-
+
+ # Overrides AMQ::Client::Channel version to also release the channel id
+ #
+ # @private
+ # @api private
+ def handle_close_ok(method)
+ super(method)
+ self.class.release_channel_id(@id)
+ end
# Resets channel state (for example, list of registered queue objects and so on).
#
# Most of the time, this method is not
# called by application code.
#