lib/bunny/session.rb in bunny-0.9.0 vs lib/bunny/session.rb in bunny-0.9.1

- old
+ new

@@ -144,10 +144,13 @@ @mechanism = opts.fetch(:auth_mechanism, "PLAIN") @credentials_encoder = credentials_encoder_for(@mechanism) @locale = @opts.fetch(:locale, DEFAULT_LOCALE) # mutex for the channel id => channel hash @channel_mutex = Mutex.new + # transport operations/continuations mutex. A workaround for + # the non-reentrant Ruby mutexes. MK. + @transport_mutex = Mutex.new @channels = Hash.new self.reset_continuations self.initialize_transport @@ -334,10 +337,10 @@ # @private def open_channel(ch) n = ch.number self.register_channel(ch) - @channel_mutex.synchronize do + @transport_mutex.synchronize do @transport.send_frame(AMQ::Protocol::Channel::Open.encode(n, AMQ::Protocol::EMPTY_STRING)) end @last_channel_open_ok = wait_on_continuations raise_if_continuation_resulted_in_a_connection_error!