sparoid 1.0.18 → 1.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d3f9a0d1d95953662422a99f8d0170ce0db8df6ec82042e7f7d6d32e1721853
4
- data.tar.gz: b2f702533aa2d6e1a96aed917a8cc77f8aa8916395944174c74644379392d7b8
3
+ metadata.gz: aa860bf3df506199abf0f4abb417458de5758c1f87d2c7226688ed57f8f7a089
4
+ data.tar.gz: 46d9e5756c5eaaf85cd5cd51ebcf67aadc48929cb161d11a15236b24ddf02086
5
5
  SHA512:
6
- metadata.gz: c1803bdedaca58f7e172516864f502693e2478e43b7d9d5b8a0b5f306bb6284d4d19066e23235e9825c5f87ba0567f71388f19df52148cbce2637a17b8afd6d3
7
- data.tar.gz: beb7813a740aa8d52d2689ee26c65872a45f991a9c2d2b937a46ba9451926471a064ca6635056441609a7bc8dfade4ef97aed2de130615b23d269e4ef308469e
6
+ metadata.gz: 6601f26feedc978e69aee6c10b573fb7a0cf0304da6a083f7236ccfaa4b12ea0586b263845a65bcb7bde7ba217bae299f3c941eaa8592e16291851a3395b82f8
7
+ data.tar.gz: 6e71a0ee6ab5627e589808f753aed3d6dc39c6c04ada839fccbc85138d6bf46c391b7cb0565a738179d143b9e17a9cde8c37b6fbe28d525b734346690ba09434
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sparoid
4
- VERSION = "1.0.18"
4
+ VERSION = "1.0.19"
5
5
  end
data/lib/sparoid.rb CHANGED
@@ -6,7 +6,7 @@ require "openssl"
6
6
  require "resolv"
7
7
 
8
8
  # Single Packet Authorisation client
9
- module Sparoid
9
+ module Sparoid # rubocop:disable Metrics/ModuleLength
10
10
  extend self
11
11
 
12
12
  SPAROID_CACHE_PATH = ENV.fetch("SPAROID_CACHE_PATH", "/tmp/.sparoid_public_ip")
@@ -38,7 +38,7 @@ module Sparoid
38
38
  end
39
39
 
40
40
  # Connect to a TCP server and pass the FD to the parent
41
- def fdpass(ips, port, connect_timeout: 10)
41
+ def fdpass(ips, port, connect_timeout: 10) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
42
42
  # try connect to all IPs
43
43
  sockets = ips.map do |ip|
44
44
  Socket.new(Socket::AF_INET, Socket::SOCK_STREAM).tap do |s|
@@ -48,6 +48,8 @@ module Sparoid
48
48
  # wait for any socket to be connected
49
49
  until sockets.empty?
50
50
  _, writeable, = IO.select(nil, sockets, nil, connect_timeout)
51
+ break if writeable.nil? # All sockets timedout
52
+
51
53
  writeable.each do |s|
52
54
  idx = sockets.index(s)
53
55
  sockets.delete_at(idx) # don't retry this socket again
@@ -129,7 +131,7 @@ module Sparoid
129
131
  Resolv::IPv4.create f.read
130
132
  end
131
133
  rescue ArgumentError => e
132
- return write_cache if e.message =~ /cannot interpret as IPv4 address/
134
+ return write_cache if /cannot interpret as IPv4 address/.match?(e.message)
133
135
 
134
136
  raise e
135
137
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sparoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.18
4
+ version: 1.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carl Hörberg
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-10 00:00:00.000000000 Z
11
+ date: 2022-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -24,7 +24,7 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- description:
27
+ description:
28
28
  email:
29
29
  - carl@84codes.com
30
30
  executables:
@@ -55,7 +55,7 @@ metadata:
55
55
  source_code_uri: https://github.com/84codes/sparoid.rb
56
56
  changelog_uri: https://raw.githubusercontent.com/84codes/sparoid.rb/main/CHANGELOG.md
57
57
  rubygems_mfa_required: 'true'
58
- post_install_message:
58
+ post_install_message:
59
59
  rdoc_options: []
60
60
  require_paths:
61
61
  - lib
@@ -71,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  version: '0'
72
72
  requirements: []
73
73
  rubygems_version: 3.3.7
74
- signing_key:
74
+ signing_key:
75
75
  specification_version: 4
76
76
  summary: Single Packet Authorisation client
77
77
  test_files: []