log-courier 1.8.3 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/log-courier/client.rb +3 -3
- data/lib/log-courier/server.rb +9 -9
- metadata +19 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3e10b3c73a7cbd81fabd9f1612454986e83c7aa
|
4
|
+
data.tar.gz: 7758b1c088db76e8fc2646a8c45e8784ce61e545
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f794c4963b883e806775abad5cc22134c8a8fa39c1755fb173404e587a5bfe5e6a829b3fa22fa71bbc9ea93ac76dba7a066807d34c372c8ea2c4ead727fc13a
|
7
|
+
data.tar.gz: 87d81f345df217fed56666c4b883e9eca494d1c0a74f645b70f1b44ab0bf34396f9ac3cb058188d8ea4d9fb42259a6d4ad56cea58933284004d20cfca68895f5
|
data/lib/log-courier/client.rb
CHANGED
@@ -72,7 +72,7 @@ module LogCourier
|
|
72
72
|
events.each do |event|
|
73
73
|
json_data = self.class.get_json_adapter.dump(event)
|
74
74
|
# Add length and then the data
|
75
|
-
buffer << [json_data.
|
75
|
+
buffer << [json_data.bytesize].pack('N') << json_data
|
76
76
|
end
|
77
77
|
|
78
78
|
# Generate and store the payload
|
@@ -435,7 +435,7 @@ module LogCourier
|
|
435
435
|
|
436
436
|
def process_pong(message)
|
437
437
|
# Sanity
|
438
|
-
fail ProtocolError, "Unexpected data attached to pong message (#{message.
|
438
|
+
fail ProtocolError, "Unexpected data attached to pong message (#{message.bytesize})" if message.bytesize != 0
|
439
439
|
|
440
440
|
@logger.debug 'PONG message received' unless @logger.nil? || !@logger.debug?
|
441
441
|
|
@@ -446,7 +446,7 @@ module LogCourier
|
|
446
446
|
|
447
447
|
def process_ackn(message)
|
448
448
|
# Sanity
|
449
|
-
fail ProtocolError, "ACKN message size invalid (#{message.
|
449
|
+
fail ProtocolError, "ACKN message size invalid (#{message.bytesize})" if message.bytesize != 20
|
450
450
|
|
451
451
|
# Grab nonce
|
452
452
|
nonce, sequence = message.unpack('a16N')
|
data/lib/log-courier/server.rb
CHANGED
@@ -125,8 +125,8 @@ module LogCourier
|
|
125
125
|
|
126
126
|
def process_ping(message, comm)
|
127
127
|
# Size of message should be 0
|
128
|
-
if message.
|
129
|
-
fail ProtocolError, "unexpected data attached to ping message (#{message.
|
128
|
+
if message.bytesize != 0
|
129
|
+
fail ProtocolError, "unexpected data attached to ping message (#{message.bytesize})"
|
130
130
|
end
|
131
131
|
|
132
132
|
# PONG!
|
@@ -142,8 +142,8 @@ module LogCourier
|
|
142
142
|
# OK - first is a nonce - we send this back with sequence acks
|
143
143
|
# This allows the client to know what is being acknowledged
|
144
144
|
# Nonce is 16 so check we have enough
|
145
|
-
if message.
|
146
|
-
fail ProtocolError, "JDAT message too small (#{message.
|
145
|
+
if message.bytesize < 17
|
146
|
+
fail ProtocolError, "JDAT message too small (#{message.bytesize})"
|
147
147
|
end
|
148
148
|
|
149
149
|
nonce = message[0...16]
|
@@ -155,7 +155,7 @@ module LogCourier
|
|
155
155
|
end
|
156
156
|
|
157
157
|
# The remainder of the message is the compressed data block
|
158
|
-
message = StringIO.new Zlib::Inflate.inflate(message
|
158
|
+
message = StringIO.new Zlib::Inflate.inflate(message.byteslice(16, message.bytesize))
|
159
159
|
|
160
160
|
# Message now contains JSON encoded events
|
161
161
|
# They are aligned as [length][event]... so on
|
@@ -170,17 +170,17 @@ module LogCourier
|
|
170
170
|
if ret.nil?
|
171
171
|
# Finished!
|
172
172
|
break
|
173
|
-
elsif length_buf.
|
174
|
-
fail ProtocolError, "JDAT length extraction failed (#{ret} #{length_buf.
|
173
|
+
elsif length_buf.bytesize < 4
|
174
|
+
fail ProtocolError, "JDAT length extraction failed (#{ret} #{length_buf.bytesize})"
|
175
175
|
end
|
176
176
|
|
177
177
|
length = length_buf.unpack('N').first
|
178
178
|
|
179
179
|
# Extract message
|
180
180
|
ret = message.read length, data_buf
|
181
|
-
if ret.nil? or data_buf.
|
181
|
+
if ret.nil? or data_buf.bytesize < length
|
182
182
|
@logger.warn()
|
183
|
-
fail ProtocolError, "JDAT message extraction failed #{ret} #{data_buf.
|
183
|
+
fail ProtocolError, "JDAT message extraction failed #{ret} #{data_buf.bytesize}"
|
184
184
|
end
|
185
185
|
|
186
186
|
data_buf.force_encoding('utf-8')
|
metadata
CHANGED
@@ -1,57 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: log-courier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Woods
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cabin
|
15
|
-
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0.6'
|
20
|
-
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirement: !ruby/object:Gem::Requirement
|
23
21
|
requirements:
|
24
22
|
- - "~>"
|
25
23
|
- !ruby/object:Gem::Version
|
26
24
|
version: '0.6'
|
25
|
+
prerelease: false
|
26
|
+
type: :runtime
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: ffi-rzmq
|
29
|
-
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '2.0'
|
34
|
-
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
37
35
|
requirements:
|
38
36
|
- - "~>"
|
39
37
|
- !ruby/object:Gem::Version
|
40
38
|
version: '2.0'
|
39
|
+
prerelease: false
|
40
|
+
type: :runtime
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: multi_json
|
43
|
-
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.10'
|
48
|
-
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
51
49
|
requirements:
|
52
50
|
- - "~>"
|
53
51
|
- !ruby/object:Gem::Version
|
54
52
|
version: '1.10'
|
53
|
+
prerelease: false
|
54
|
+
type: :runtime
|
55
55
|
description: Log Courier library
|
56
56
|
email:
|
57
57
|
- devel@jasonwoods.me.uk
|
@@ -70,7 +70,7 @@ homepage: https://github.com/driskell/ruby-log-courier
|
|
70
70
|
licenses:
|
71
71
|
- Apache
|
72
72
|
metadata: {}
|
73
|
-
post_install_message:
|
73
|
+
post_install_message:
|
74
74
|
rdoc_options: []
|
75
75
|
require_paths:
|
76
76
|
- lib
|
@@ -86,8 +86,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
86
|
version: '0'
|
87
87
|
requirements: []
|
88
88
|
rubyforge_project: nowarning
|
89
|
-
rubygems_version: 2.4.
|
90
|
-
signing_key:
|
89
|
+
rubygems_version: 2.4.8
|
90
|
+
signing_key:
|
91
91
|
specification_version: 4
|
92
|
-
summary: Ruby implementation of the
|
92
|
+
summary: Ruby implementation of the Courier protocol
|
93
93
|
test_files: []
|