diff --git a/lib/dalli/socket.rb b/lib/dalli/socket.rb index 7d1ef752..efb94475 100644 --- a/lib/dalli/socket.rb +++ b/lib/dalli/socket.rb @@ -88,6 +88,12 @@ class TCP < TCPSocket # options - supports enhanced logging in the case of a timeout attr_accessor :options + # Check that TCPSocket#initialize was not overwritten by resolv-replace gem + # (part of ruby standard library since 3.0.0, should be removed in 3.4.0), + # as it does not handle keyword arguments correctly. + # To check this we are using the fact that resolv-replace + # aliases TCPSocket#initialize method to #original_resolv_initialize. + # https://github.com/ruby/resolv-replace/blob/v0.1.1/lib/resolv-replace.rb#L8 if RUBY_VERSION >= '3.0' && !::TCPSocket.private_instance_methods.include?(:original_resolv_initialize) def self.open(host, port, options = {})