sparoid 1.0.19 → 1.0.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa860bf3df506199abf0f4abb417458de5758c1f87d2c7226688ed57f8f7a089
4
- data.tar.gz: 46d9e5756c5eaaf85cd5cd51ebcf67aadc48929cb161d11a15236b24ddf02086
3
+ metadata.gz: cd5b6193a911ddfbe06a7a01a2ad1abe3b2c4f60c090aaac4b6b2b6c6ac3dd3e
4
+ data.tar.gz: 622b9465e33bc1b69072450cf619ac2dcf7bf6ac3b1a70276a5f56c4c0d36907
5
5
  SHA512:
6
- metadata.gz: 6601f26feedc978e69aee6c10b573fb7a0cf0304da6a083f7236ccfaa4b12ea0586b263845a65bcb7bde7ba217bae299f3c941eaa8592e16291851a3395b82f8
7
- data.tar.gz: 6e71a0ee6ab5627e589808f753aed3d6dc39c6c04ada839fccbc85138d6bf46c391b7cb0565a738179d143b9e17a9cde8c37b6fbe28d525b734346690ba09434
6
+ metadata.gz: 8e773ffe52658eecff5b673f0b886a7bd40118654d24602b5c7bd50dbd1dd9a37561b28d51e9dcc2d93557212081f282a6b855f026a22ef646e013ea4c827755
7
+ data.tar.gz: bff75047af985b79ee7a1fc53c40abb3f6d15f5cad4cff86f94430cb599c246ce0a240e20e6c8fd1c4c53a8f79c447b142c69669093409979d10265ce6aa34f9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [1.0.20] - 2022-10-11
2
+
3
+ - Ignore EISCONN errors (already connected) error as BSD raises on second connect_nonblock
4
+ - Don't read from public ip disk cache in Sparoid::Instance
5
+
6
+ ## [1.0.19] - 2022-10-11
7
+
8
+ - Fix nil error on timeout
9
+
1
10
  ## [1.0.18] - 2022-10-10
2
11
 
3
12
  - Only resolv the IP(s) once
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sparoid
4
- VERSION = "1.0.19"
4
+ VERSION = "1.0.20"
5
5
  end
data/lib/sparoid.rb CHANGED
@@ -47,19 +47,22 @@ module Sparoid # rubocop:disable Metrics/ModuleLength
47
47
  end
48
48
  # wait for any socket to be connected
49
49
  until sockets.empty?
50
- _, writeable, = IO.select(nil, sockets, nil, connect_timeout)
51
- break if writeable.nil? # All sockets timedout
52
-
50
+ _, writeable, errors = IO.select(nil, sockets, nil, connect_timeout) || break
51
+ errors.each { |s| sockets.delete(s) }
53
52
  writeable.each do |s|
54
53
  idx = sockets.index(s)
55
54
  sockets.delete_at(idx) # don't retry this socket again
56
55
  ip = ips.delete_at(idx) # find the IP for the socket
57
- s.connect_nonblock(Socket.sockaddr_in(port, ip)) # check for errors
56
+ begin
57
+ s.connect_nonblock(Socket.sockaddr_in(port, ip)) # check for errors
58
+ rescue Errno::EISCONN
59
+ # already connected, continue
60
+ rescue SystemCallError
61
+ next # skip connection errors, hopefully at least one succeeds
62
+ end
58
63
  # pass the connected FD to the parent process over STDOUT
59
64
  Socket.for_fd(1).sendmsg "\0", 0, nil, Socket::AncillaryData.unix_rights(s)
60
65
  exit 0 # exit as fast as possible so that other sockets don't connect
61
- rescue SystemCallError
62
- next # ignore connection errors, hopefully at least one succeeds
63
66
  end
64
67
  end
65
68
  exit 1 # all connections failed
@@ -165,5 +168,9 @@ module Sparoid # rubocop:disable Metrics/ModuleLength
165
168
  def public_ip
166
169
  @public_ip ||= super
167
170
  end
171
+
172
+ def cached_public_ip
173
+ @public_ip
174
+ end
168
175
  end
169
176
  end
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sparoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.19
4
+ version: 1.0.20
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
11
  date: 2022-10-11 00:00:00.000000000 Z
@@ -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: []