lib/bunny/session.rb in bunny-2.7.2 vs lib/bunny/session.rb in bunny-2.7.3

- old
+ new

@@ -189,11 +189,11 @@ @channel_max = @client_channel_max @client_heartbeat = self.heartbeat_from(opts) client_props = opts[:properties] || opts[:client_properties] || {} @client_properties = DEFAULT_CLIENT_PROPERTIES.merge(client_props) - @mechanism = opts.fetch(:auth_mechanism, "PLAIN") + @mechanism = normalize_auth_mechanism(opts.fetch(:auth_mechanism, "PLAIN")) @credentials_encoder = credentials_encoder_for(@mechanism) @locale = @opts.fetch(:locale, DEFAULT_LOCALE) @mutex_impl = @opts.fetch(:mutex_impl, Monitor) @@ -1381,16 +1381,28 @@ ch.maybe_kill_consumer_work_pool! end end def normalize_client_channel_max(n) + return CHANNEL_MAX_LIMIT if n.nil? return CHANNEL_MAX_LIMIT if n > CHANNEL_MAX_LIMIT case n when 0 then CHANNEL_MAX_LIMIT else n + end + end + + def normalize_auth_mechanism(value) + case value + when [] then + "PLAIN" + when nil then + "PLAIN" + else + value end end def ignoring_io_errors(&block) begin