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

- old
+ new

@@ -149,12 +149,13 @@ # transport operations/continuations mutex. A workaround for # the non-reentrant Ruby mutexes. MK. @transport_mutex = Mutex.new @channels = Hash.new - self.reset_continuations + @origin_thread = Thread.current + self.reset_continuations self.initialize_transport end # @return [String] RabbitMQ hostname (or IP address) used def hostname; self.host; end @@ -483,11 +484,12 @@ # @private def recover_from_network_failure begin sleep @network_recovery_interval @logger.debug "About to start connection recovery..." - start + self.initialize_transport + self.start if open? @recovering_from_network_failure = false recover_channels @@ -794,10 +796,10 @@ @heartbeat_sender.stop if @heartbeat_sender end # @private def initialize_transport - @transport = Transport.new(self, @host, @port, @opts.merge(:session_thread => Thread.current)) + @transport = Transport.new(self, @host, @port, @opts.merge(:session_thread => @origin_thread)) end # @private def maybe_close_transport @transport.close if @transport