fluent-plugin-syslog-gobi-tls 2.1.2 → 2.1.4

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: '00795bf5901d0f408fef9bb0f83719b69bf6ed35caa7404480bc80e37a673ea6'
4
- data.tar.gz: 90e250623d326e405fc89d08a7e50fa63eddea51e708278f7da3db505133b0c6
3
+ metadata.gz: 5ce630881b7eec5768670ea60b861b14bd4c434aab48ab369001e48542d46ea3
4
+ data.tar.gz: 4958d79dad16536b4e4bfd42a29bac7b88cb668dfeb01d24ddd12b5ee1f13669
5
5
  SHA512:
6
- metadata.gz: 01fa201ac15dd4aa7f0c10f4e0c95e53ad0a88776d63034866f4e4385a96a7262ef01145aef3e1c5cd284e562455e08fb459539a4aa4e51a14b46f292265eab7
7
- data.tar.gz: 88581578d6eda87732511b1ac8532594691084c0b117fcc042ca20fcb3f031208aa5e85a482fbb1dc224f62fa5d3535298d13c693ab46941ad05010325aef4d9
6
+ metadata.gz: 1e9e3c29a23cd9c198427522105258945195f187018c0f625afa33c420c7bdd0be55d4f746408bf9403372b78df062e22cc2d745bf1ad5b05031ec2fde1f7e98
7
+ data.tar.gz: a63f9d6b293c66bafeda9fa58aa8ce260ee73cf00cbf665071f11968d2400ddb1d418e33484bd1b67f2bbcfa5a52cfb749575c9620301b19bc10e6dc48793f30
@@ -19,7 +19,7 @@ require 'syslog_tls/version'
19
19
 
20
20
  Gem::Specification.new do |s|
21
21
  s.name = 'fluent-plugin-syslog-gobi-tls'
22
- s.version = '2.1.2'
22
+ s.version = '2.1.4'
23
23
  s.summary = %q{Fluent Syslog TLS output plugin}
24
24
  s.authors = ['thomas morgan']
25
25
  s.email = ['tm@iprog.com']
@@ -22,7 +22,8 @@ module SyslogTls
22
22
  CONNECT_TIMEOUT = 10
23
23
  # READ_TIMEOUT = 5
24
24
  WRITE_TIMEOUT = 5
25
-
25
+ MAX_BACKOFF_RETRIES = 5
26
+ INITIAL_BACKOFF_DELAY = 1
26
27
  attr_accessor :socket
27
28
 
28
29
  attr_reader :host, :port, :idle_timeout, :ca_cert, :client_cert, :client_key, :verify_cert_name, :ssl_version
@@ -42,22 +43,49 @@ module SyslogTls
42
43
  connect
43
44
  end
44
45
 
45
- def connect
46
- @socket = get_ssl_connection
47
- begin
46
+ def connect_with_backoff
47
+ retries = 0
48
+ backoff_delay = INITIAL_BACKOFF_DELAY
49
+
50
+ loop do
48
51
  begin
52
+ @socket = get_ssl_connection
49
53
  @socket.connect_nonblock
54
+ break
50
55
  rescue Errno::EAGAIN, Errno::EWOULDBLOCK, IO::WaitReadable
51
56
  select_with_timeout(@socket, :connect_read) && retry
52
57
  rescue IO::WaitWritable
53
58
  select_with_timeout(@socket, :connect_write) && retry
59
+ rescue Errno::ETIMEDOUT
60
+ raise 'Socket timeout during connect' if retries >= MAX_BACKOFF_RETRIES
61
+
62
+ # Exponential backoff
63
+ retries += 1
64
+ sleep(backoff_delay)
65
+ backoff_delay *= 2
54
66
  end
55
- rescue Errno::ETIMEDOUT
56
- raise 'Socket timeout during connect'
57
67
  end
68
+
58
69
  @last_write = Time.now if idle_timeout
59
70
  end
60
71
 
72
+ def connect
73
+ connect_with_backoff
74
+ #@socket = get_ssl_connection
75
+ #begin
76
+ # begin
77
+ # @socket.connect_nonblock
78
+ #rescue Errno::EAGAIN, Errno::EWOULDBLOCK, IO::WaitReadable
79
+ # select_with_timeout(@socket, :connect_read) && retry
80
+ #rescue IO::WaitWritable
81
+ # select_with_timeout(@socket, :connect_write) && retry
82
+ #end
83
+ #rescue Errno::ETIMEDOUT
84
+ # raise 'Socket timeout during connect'
85
+ #end
86
+ #@last_write = Time.now if idle_timeout
87
+ end
88
+
61
89
  def get_tcp_connection
62
90
  tcp = nil
63
91
 
@@ -170,7 +198,7 @@ module SyslogTls
170
198
  when :connect_read
171
199
  args = [[tcp], nil, nil, CONNECT_TIMEOUT]
172
200
  when :connect_write
173
- args = [nil, [tcp], nil, 0]
201
+ args = [nil, [tcp], nil, 1]
174
202
  # when :read
175
203
  # args = [[tcp], nil, nil, READ_TIMEOUT]
176
204
  when :write
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-syslog-gobi-tls
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - thomas morgan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-26 00:00:00.000000000 Z
11
+ date: 2024-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd