log-courier 2.7.3 → 2.10.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
  SHA256:
3
- metadata.gz: 3aa4bc695758102c35a9bc74cb856ec456b92715cb6f133592bfdeaa0a8a6a30
4
- data.tar.gz: c5f67b639fca236f884f01f3054dc6e4b3292826051f1696cff324f80e6878ec
3
+ metadata.gz: 834c4c36961276190be8487bf5b1886a26929a7edc66d5e7bec33ebed66423bf
4
+ data.tar.gz: 4252b6972eb41c1f3dc1fc4a5e3d3d801bb14022bf624f5b0ff6a221a8b05fcc
5
5
  SHA512:
6
- metadata.gz: e0826718c6e075b731d04f7f8c825aa0fd59b9d0045b58183009f42516e1f1a7b8465cd72af7d04603d8946e3240acba91101fe41cdb6bcc609856a8b50d171d
7
- data.tar.gz: 372bbefcfd75d6de6139fc6b0d1901a77cb77609c104fe897d156b29c83edca6994abb9bf8a44a718d963e0b20a3127fe8d91615f0ae4aaff05cea1de31bbbf8
6
+ metadata.gz: ff6bb4da32cc74999598c04a2da316e3441bdf001977312bb51ee3396a0ed28fe1b4f675819eb488a594cdd27a7be6a810d2337424477874c8024c6aa7241986
7
+ data.tar.gz: a807517a2d0eab92b00a27372ce4c86b3d5362b4a8ac3682a213a5bcff08a5aa81f993309a264c5aae176cd1e079f4a8264a6f4564765420d2b20eda60ea2881
@@ -142,6 +142,7 @@ module LogCourier
142
142
  def clear
143
143
  @mutex.synchronize do
144
144
  @que.clear
145
+ @enque_cond.signal if @que.length < @max
145
146
  end
146
147
  self
147
148
  end
@@ -13,6 +13,7 @@
13
13
  # limitations under the License.
14
14
 
15
15
  require 'cabin'
16
+ require 'fileutils'
16
17
  require 'log-courier/client'
17
18
  require 'log-courier/server'
18
19
 
@@ -51,53 +51,46 @@ module LogCourier
51
51
 
52
52
  # Grab the port back and update the logger context
53
53
  @port = @server.port
54
- end
55
54
 
56
- def run(&block)
57
55
  # TODO: Make queue size configurable
58
56
  @event_queue = EventQueue.new 1
59
- server_thread = nil
60
-
61
- begin
62
- server_thread = Thread.new do
63
- # Receive messages and process them
64
- @server.run do |signature, message, comm|
65
- case signature
66
- when 'PING'
67
- process_ping message, comm
68
- when 'JDAT'
69
- process_jdat message, comm, @event_queue
57
+
58
+ @server_thread = Thread.new do
59
+ # Receive messages and process them
60
+ @server.run do |signature, message, comm|
61
+ case signature
62
+ when 'PING'
63
+ process_ping message, comm
64
+ when 'JDAT'
65
+ process_jdat message, comm, @event_queue
66
+ else
67
+ if comm.peer.nil?
68
+ @logger&.warn 'Unknown message received', from: 'unknown'
70
69
  else
71
- if comm.peer.nil?
72
- @logger&.warn 'Unknown message received', from: 'unknown'
73
- else
74
- @logger&.warn 'Unknown message received', from: comm.peer
75
- end
76
- # Don't kill a client that sends a bad message
77
- # Just reject it and let it send it again, potentially to another server
78
- comm.send '????', ''
70
+ @logger&.warn 'Unknown message received', from: comm.peer
79
71
  end
72
+ # Don't kill a client that sends a bad message
73
+ # Just reject it and let it send it again, potentially to another server
74
+ comm.send '????', ''
80
75
  end
81
76
  end
77
+ end
78
+ end
82
79
 
83
- loop do
84
- event = @event_queue.pop
85
- break if event.nil?
80
+ def run(&block)
81
+ loop do
82
+ event = @event_queue.pop
83
+ break if event.nil?
86
84
 
87
- block.call event
88
- end
89
- ensure
90
- # Signal the server thread to stop
91
- unless server_thread.nil?
92
- server_thread.raise ShutdownSignal
93
- server_thread.join
94
- end
85
+ block.call event
95
86
  end
96
87
  nil
97
88
  end
98
89
 
99
90
  def stop
91
+ @server_thread.raise ShutdownSignal
100
92
  @event_queue << nil
93
+ @server_thread.join
101
94
  nil
102
95
  end
103
96
 
@@ -283,10 +283,10 @@ module LogCourier
283
283
  # Connection abort request due to a protocol error
284
284
  @logger&.warn 'Protocol error, connection aborted', error: e.message, peer: @peer
285
285
  nil
286
- rescue ShutdownSignal
286
+ rescue ShutdownSignal => e
287
287
  # Shutting down
288
288
  @logger&.info 'Server shutting down, closing connection', peer: @peer
289
- nil
289
+ raise e
290
290
  rescue StandardError => e
291
291
  # Some other unknown problem
292
292
  @logger&.warn e.message, hint: 'Unknown error, connection aborted', peer: @peer
@@ -0,0 +1,7 @@
1
+ # Version of LogCourier
2
+ module LogCourier
3
+ MAJOR_VERSION = 2
4
+ MINOR_VERSION = 10
5
+ PATCH_VERSION = 0
6
+ VERSION = '2.10.0'.freeze
7
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: log-courier
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.3
4
+ version: 2.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Woods
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-26 00:00:00.000000000 Z
11
+ date: 2023-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +52,7 @@ files:
52
52
  - lib/log-courier/rspec/spec_helper.rb
53
53
  - lib/log-courier/server.rb
54
54
  - lib/log-courier/server_tcp.rb
55
+ - lib/log-courier/version.rb
55
56
  homepage: https://github.com/driskell/log-courier
56
57
  licenses:
57
58
  - Apache-2.0
@@ -71,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
72
  - !ruby/object:Gem::Version
72
73
  version: '0'
73
74
  requirements: []
74
- rubygems_version: 3.0.6
75
+ rubygems_version: 3.2.29
75
76
  signing_key:
76
77
  specification_version: 4
77
78
  summary: Ruby implementation of the Courier protocol