remote_syslog_sender 1.1.4 → 1.2.0

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
  SHA1:
3
- metadata.gz: c16108731d2d7b6e31e5af7c7ece9e4eeee102f8
4
- data.tar.gz: 486189b1bb483e7febc18cc678f7a95c7df589a4
3
+ metadata.gz: 42092d994e9efb80b76a480394d234a4f6323598
4
+ data.tar.gz: c1eba5a22d33471f2eb8ba38b2af20b9a15513b0
5
5
  SHA512:
6
- metadata.gz: 1decdb20cd350dd7bb3c5b25a1b0082479ec065854e1ffa9aa80f35658d766657ea0709d2ce4032f5ce69c2ec185606ada0079e09ecc5c1d4c80a85b3a9c85f6
7
- data.tar.gz: e74dd3847e4ecb0cb63c77238d3fff45aec2798213e679c991c895a95ae21ce7fe28163569e89fc2f3fc331825e768b2c17cd3edc690522860ef5b80a3b0803e
6
+ metadata.gz: c592dc4e54a2d8dc827a5007e5fc7d49416c504b142c311051174498eeaf6c95d6461435721bfb4d9495ce2fc2cce3c7d54306d13ead8762aced09ef49c339c9
7
+ data.tar.gz: a212f43c5e3c6124b1cfd07cdc198977e1637e5f8d551ec828762bec825343a294ec529bc5b7c6dd27a776d7f74a70bcc53e4079026f6ed8b40a40cabfaacaaa
@@ -19,7 +19,9 @@ module RemoteSyslogSender
19
19
  @timeout = options[:timeout] || 600
20
20
  @timeout_exception = !!options[:timeout_exception]
21
21
  @exponential_backoff = !!options[:exponential_backoff]
22
- @connect_mutex = Mutex.new
22
+
23
+ @mutex = Mutex.new
24
+ @tcp_socket = nil
23
25
 
24
26
  if [:SOL_SOCKET, :SO_KEEPALIVE, :IPPROTO_TCP, :TCP_KEEPIDLE].all? {|c| Socket.const_defined? c}
25
27
  @keep_alive = options[:keep_alive]
@@ -47,8 +49,10 @@ module RemoteSyslogSender
47
49
  connect_retry_count = 0
48
50
  connect_retry_limit = 3
49
51
  connect_retry_interval = 1
50
- @connect_mutex.synchronize do
52
+ @mutex.synchronize do
51
53
  begin
54
+ close
55
+
52
56
  @tcp_socket = TCPSocket.new(@remote_hostname, @remote_port)
53
57
 
54
58
  if @keep_alive
@@ -71,7 +75,6 @@ module RemoteSyslogSender
71
75
  @socket = @tcp_socket
72
76
  end
73
77
  rescue
74
- close
75
78
  if connect_retry_count < connect_retry_limit
76
79
  sleep connect_retry_interval
77
80
  connect_retry_count += 1
@@ -101,7 +104,7 @@ module RemoteSyslogSender
101
104
  until payload_size <= 0
102
105
  start = get_time
103
106
  begin
104
- result = @socket.__send__(method, payload)
107
+ result = @mutex.synchronize { @socket.__send__(method, payload) }
105
108
  payload_size -= result
106
109
  payload.slice!(0, result) if payload_size > 0
107
110
  rescue IO::WaitReadable
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'remote_syslog_sender'
3
- s.version = '1.1.4'
3
+ s.version = '1.2.0'
4
4
  s.summary = "Message sender that sends directly to a remote syslog endpoint"
5
5
  s.description = "Message sender that sends directly to a remote syslog endpoint (Support UDP, TCP, TCP+TLS)"
6
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remote_syslog_sender
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomohiro Hashidate
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-10-04 00:00:00.000000000 Z
12
+ date: 2017-10-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: syslog_protocol