lib/bunny/session.rb in bunny-1.5.0.pre1 vs lib/bunny/session.rb in bunny-1.5.0.pre2

- old
+ new

@@ -283,11 +283,11 @@ @logger.warn e.message @logger.warn "Retrying connection on next host in line: #{@transport.host}:#{@transport.port}" return self.start - rescue Exception + rescue @status_mutex.synchronize { @status = :not_connected } raise end rescue HostListDepleted @@ -959,17 +959,15 @@ fr = @transport.read_next_frame end fr # frame timeout means the broker has closed the TCP connection, which it # does per 0.9.1 spec. - rescue Errno::ECONNRESET, ClientTimeout, AMQ::Protocol::EmptyResponseError, EOFError, IOError => e + rescue nil end if frame.nil? - @state = :closed - @logger.error "RabbitMQ closed TCP connection before AMQP 0.9.1 connection was finalized. Most likely this means authentication failure." - raise Bunny::PossibleAuthenticationFailureError.new(self.user, self.vhost, self.password.size) + raise TCPConnectionFailed.new('An empty frame was received while opening the connection. In RabbitMQ <= 3.1 this could mean an authentication issue.') end response = frame.decode_payload if response.is_a?(AMQ::Protocol::Connection::Close) @state = :closed @@ -1009,16 +1007,14 @@ fr = @transport.read_next_frame end fr # frame timeout means the broker has closed the TCP connection, which it # does per 0.9.1 spec. - rescue Errno::ECONNRESET, ClientTimeout, AMQ::Protocol::EmptyResponseError, EOFError => e + rescue nil end if frame2.nil? - @state = :closed - @logger.warn "RabbitMQ closed TCP connection before AMQP 0.9.1 connection was finalized. Most likely this means authentication failure." - raise Bunny::PossibleAuthenticationFailureError.new(self.user, self.vhost, self.password.size) + raise TCPConnectionFailed.new('An empty frame was received while opening the connection. In RabbitMQ <= 3.1 this could mean an authentication issue.') end connection_open_ok = frame2.decode_payload @status_mutex.synchronize { @status = :open } if @heartbeat && @heartbeat > 0