Skip to content

Commit

Permalink
Comment additional check in TCP.open method definition
Browse files Browse the repository at this point in the history
  • Loading branch information
y9v committed Feb 4, 2024
1 parent 7e52fce commit 3c5a71b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/dalli/socket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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#L2
if RUBY_VERSION >= '3.0' &&
!::TCPSocket.private_instance_methods.include?(:original_resolv_initialize)
def self.open(host, port, options = {})
Expand Down

0 comments on commit 3c5a71b

Please sign in to comment.