lib/connection/utils.rb in stomp-1.4.3 vs lib/connection/utils.rb in stomp-1.4.4

- old
+ new

@@ -9,11 +9,11 @@ class Connection private - # Support multi-homed servers. + # Support multi-homed servers. def _expand_hosts(hash) new_hash = hash.clone new_hash[:hosts_cloned] = hash[:hosts].clone new_hash[:hosts] = [] # @@ -135,12 +135,20 @@ $stderr.print "connect to #{@host} failed: #{$!} will retry(##{@connection_attempts}) in #{@reconnect_delay}\n" end rescue Exception => aex raise if aex.is_a?(Stomp::Error::LoggerConnectionError) end - - raise Stomp::Error::MaxReconnectAttempts if max_reconnect_attempts? + if max_reconnect_attempts? + $stderr.print "In socket() Reached MaxReconnectAttempts" + ### _dump_threads() + mt = @parameters[:client_main] + if !mt.nil? + mt.raise Stomp::Error::MaxReconnectAttempts + Thread::exit + end + raise Stomp::Error::MaxReconnectAttempts + end sleep(@reconnect_delay) @connection_attempts += 1 if @parameters change_host() @@ -234,15 +242,18 @@ end # __old_receive receives a frame, blocks until the frame is received. def __old_receive() # The receive may fail so we may need to retry. - while TRUE + while true begin used_socket = socket() return _receive(used_socket) rescue Stomp::Error::MaxReconnectAttempts + unless slog(:on_miscerr, log_params, "Reached MaxReconnectAttempts") + $stderr.print "Reached MaxReconnectAttempts\n" + end raise rescue @failure = $! raise unless @reliable errstr = "receive failed: #{$!}" @@ -272,6 +283,5 @@ end end # class Connection end # module Stomp -