lib/elasticsearch/transport/transport/connections/connection.rb in elasticsearch-transport-1.0.16 vs lib/elasticsearch/transport/transport/connections/connection.rb in elasticsearch-transport-1.0.17
- old
+ new
@@ -116,9 +116,19 @@
@state_mutex.synchronize {
Time.now > @dead_since + ( @options[:resurrect_timeout] * 2 ** (@failures-1) )
}
end
+ # Equality operator based on connection protocol, host and port
+ #
+ # @return [Boolean]
+ #
+ def ==(other)
+ self.host[:protocol] == other.host[:protocol] && \
+ self.host[:host] == other.host[:host] && \
+ self.host[:port].to_i == other.host[:port].to_i
+ end
+
# @return [String]
#
def to_s
"<#{self.class.name} host: #{host} (#{dead? ? 'dead since ' + dead_since.to_s : 'alive'})>"
end