lib/bunny/session.rb in bunny-2.4.0 vs lib/bunny/session.rb in bunny-2.5.0
- old
+ new
@@ -106,10 +106,11 @@
# @option connection_string_or_opts [Boolean] :tls (false) Should TLS/SSL be used?
# @option connection_string_or_opts [String] :tls_cert (nil) Path to client TLS/SSL certificate file (.pem)
# @option connection_string_or_opts [String] :tls_key (nil) Path to client TLS/SSL private key file (.pem)
# @option connection_string_or_opts [Array<String>] :tls_ca_certificates Array of paths to TLS/SSL CA files (.pem), by default detected from OpenSSL configuration
# @option connection_string_or_opts [String] :verify_peer (true) Whether TLS peer verification should be performed
+ # @option connection_string_or_opts [Keyword] :tls_version (negotiated) What TLS version should be used (:TLSv1, :TLSv1_1, or :TLSv1_2)
# @option connection_string_or_opts [Integer] :continuation_timeout (15000) Timeout for client operations that expect a response (e.g. {Bunny::Queue#get}), in milliseconds.
# @option connection_string_or_opts [Integer] :connection_timeout (5) Timeout in seconds for connecting to the server.
# @option connection_string_or_opts [Proc] :hosts_shuffle_strategy A Proc that reorders a list of host strings, defaults to Array#shuffle
# @option connection_string_or_opts [Logger] :logger The logger. If missing, one is created using :log_file and :log_level.
# @option connection_string_or_opts [IO, String] :log_file The file or path to use when creating a logger. Defaults to STDOUT.
@@ -666,33 +667,31 @@
@recovering_from_network_failure
end
# @private
def recover_from_network_failure
- begin
- sleep @network_recovery_interval
- @logger.debug "About to start connection recovery..."
+ sleep @network_recovery_interval
+ @logger.debug "About to start connection recovery..."
- self.initialize_transport
+ self.initialize_transport
- @logger.warn "Retrying connection on next host in line: #{@transport.host}:#{@transport.port}"
- self.start
+ @logger.warn "Retrying connection on next host in line: #{@transport.host}:#{@transport.port}"
+ self.start
- if open?
- @recovering_from_network_failure = false
+ if open?
+ @recovering_from_network_failure = false
- recover_channels
- end
- rescue HostListDepleted
- reset_address_index
- retry
- rescue TCPConnectionFailedForAllHosts, TCPConnectionFailed, AMQ::Protocol::EmptyResponseError => e
- @logger.warn "TCP connection failed, reconnecting in #{@network_recovery_interval} seconds"
- sleep @network_recovery_interval
- if should_retry_recovery?
- @recovery_attempts -= 1 if @recovery_attempts
- retry if recoverable_network_failure?(e)
- end
+ recover_channels
+ end
+ rescue HostListDepleted
+ reset_address_index
+ retry
+ rescue TCPConnectionFailedForAllHosts, TCPConnectionFailed, AMQ::Protocol::EmptyResponseError => e
+ @logger.warn "TCP connection failed, reconnecting in #{@network_recovery_interval} seconds"
+ sleep @network_recovery_interval
+ if should_retry_recovery?
+ @recovery_attempts -= 1 if @recovery_attempts
+ retry if recoverable_network_failure?(e)
end
end
# @private
def should_retry_recovery?