Skip to content

Commit

Permalink
Remove buffered io usage
Browse files Browse the repository at this point in the history
  • Loading branch information
grcooper committed Jan 16, 2025
1 parent 553b983 commit 882c714
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 263 deletions.
1 change: 0 additions & 1 deletion lib/dalli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ def self.logger=(logger)
require_relative 'dalli/ring'
require_relative 'dalli/protocol'
require_relative 'dalli/protocol/base'
require_relative 'dalli/protocol/buffered_io'
require_relative 'dalli/protocol/connection_manager'
require_relative 'dalli/protocol/meta'
require_relative 'dalli/protocol/response_buffer'
Expand Down
117 changes: 0 additions & 117 deletions lib/dalli/protocol/buffered_io.rb

This file was deleted.

9 changes: 1 addition & 8 deletions lib/dalli/protocol/connection_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ module Protocol
# Manages the socket connection to the server, including ensuring liveness
# and retries.
##
# rubocop:disable Metrics/ClassLength
class ConnectionManager
DEFAULTS = {
# seconds between trying to contact a remote server
Expand All @@ -24,9 +23,7 @@ class ConnectionManager
# amount of time to sleep between retries when a failure occurs
socket_failure_delay: 0.1,
# Set keepalive
keepalive: true,
# chunk size for buffered io
chunk_size: 1024 * 4
keepalive: true
}.freeze

attr_accessor :hostname, :port, :socket_type, :options
Expand All @@ -40,7 +37,6 @@ def initialize(hostname, port, socket_type, client_options)
@request_in_progress = false
@sock = nil
@pid = nil
@buffered_io = nil

reset_down_info
end
Expand All @@ -57,7 +53,6 @@ def establish_connection
Dalli.logger.debug { "Dalli::Server#connect #{name}" }

@sock = memcached_socket
@buffered_io = BufferedIO.new(@sock, options[:chunk_size], options[:socket_timeout])
@pid = PIDCache.pid
@request_in_progress = false
rescue SystemCallError, *TIMEOUT_ERRORS, EOFError, SocketError => e
Expand Down Expand Up @@ -123,7 +118,6 @@ def close
nil
end
@sock = nil
@buffered_io = nil
@pid = nil
abort_request!
end
Expand Down Expand Up @@ -276,5 +270,4 @@ def log_up_detected
end
end
end
# rubocop:enable Metrics/ClassLength
end
8 changes: 0 additions & 8 deletions test/integration/test_network.rb
Original file line number Diff line number Diff line change
Expand Up @@ -335,12 +335,4 @@
dc.close
end
end

it 'handles reading data from a socket that is larger than the buffer chunk size' do
memcached_persistent do |dc|
dc.set('foo', 'b' * (Dalli::Protocol::BufferedIO::DEFAULT_CHUNK_SIZE + 100))

assert_equal 'b' * (Dalli::Protocol::BufferedIO::DEFAULT_CHUNK_SIZE + 100), dc.get('foo')
end
end
end
129 changes: 0 additions & 129 deletions test/protocol/test_buffered_io.rb

This file was deleted.

0 comments on commit 882c714

Please sign in to comment.