File: protocol.rb

package info (click to toggle)
ruby-dalli 5.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 992 kB
  • sloc: ruby: 9,447; sh: 19; makefile: 4
file content (29 lines) | stat: -rw-r--r-- 786 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

require 'timeout'

module Dalli
  module Protocol
    # Preserved for backwards compatibility.  Should be removed in 4.0
    NOT_FOUND = ::Dalli::NOT_FOUND

    # Ruby 3.2 raises IO::TimeoutError on blocking reads/writes, but
    # it is not defined in earlier Ruby versions.
    TIMEOUT_ERRORS =
      if defined?(IO::TimeoutError)
        [Timeout::Error, IO::TimeoutError]
      else
        [Timeout::Error]
      end

    # SSL errors that occur during read/write operations (not during initial
    # handshake) should trigger reconnection. These indicate transient network
    # issues, not configuration problems.
    SSL_ERRORS =
      if defined?(OpenSSL::SSL::SSLError)
        [OpenSSL::SSL::SSLError]
      else
        []
      end
  end
end