lib/bunny/session.rb in bunny-1.2.0 vs lib/bunny/session.rb in bunny-1.2.1
- old
+ new
@@ -973,10 +973,14 @@
negotiate_value(@client_heartbeat, connection_tune.heartbeat)
end
@logger.debug "Heartbeat interval negotiation: client = #{@client_heartbeat}, server = #{connection_tune.heartbeat}, result = #{@heartbeat}"
@logger.info "Heartbeat interval used (in seconds): #{@heartbeat}"
- @channel_id_allocator = ChannelIdAllocator.new(@channel_max)
+ # if there are existing channels we've just recovered from
+ # a network failure and need to fix the allocated set. See issue 205. MK.
+ if @channels.empty?
+ @channel_id_allocator = ChannelIdAllocator.new(@channel_max)
+ end
@transport.send_frame(AMQ::Protocol::Connection::TuneOk.encode(@channel_max, @frame_max, @heartbeat))
@logger.debug "Sent connection.tune-ok with heartbeat interval = #{@heartbeat}, frame_max = #{@frame_max}, channel_max = #{@channel_max}"
@transport.send_frame(AMQ::Protocol::Connection::Open.encode(self.vhost))
@logger.debug "Sent connection.open with vhost = #{self.vhost}"