jls-lumberjack 0.0.19 → 0.0.20

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 257e7277d9d370246671e1a117e9102674386177
4
+ data.tar.gz: be48c31b83ccecc610c152a1c928f8040dd3a1dd
5
+ SHA512:
6
+ metadata.gz: 998a1720267a70608f3061a661624d420875e66bef41eba4193047815319023da6de7365d0b934ee1983f96c4ee8e28e6730af77e687ab5dd5accca2294141f9
7
+ data.tar.gz: 698db79fc9618f656d4767baa2bbbf058268d768744e9d38d75841acca8af4b6fcad9908221c63fff589289516ea77387822b3438346487428d932df70079874
@@ -100,7 +100,7 @@ module Lumberjack
100
100
  public
101
101
  def write_hash(hash)
102
102
  frame = to_frame(hash, inc)
103
- ack if (@sequence - @last_ack) >= @window_size
103
+ ack if (@sequence - (@last_ack + 1)) >= @window_size
104
104
  write frame
105
105
  end
106
106
 
@@ -110,7 +110,7 @@ module Lumberjack
110
110
  type = @socket.read(1)
111
111
  raise "Whoa we shouldn't get this frame: #{type}" if type != "A"
112
112
  @last_ack = @socket.read(4).unpack("N").first
113
- ack if (@sequence - @last_ack) >= @window_size
113
+ ack if (@sequence - (@last_ack + 1)) >= @window_size
114
114
  end
115
115
 
116
116
  private
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jls-lumberjack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19
5
- prerelease:
4
+ version: 0.0.20
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jordan Sissel
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-09 00:00:00.000000000 Z
11
+ date: 2014-03-12 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: lumberjack log transport library
15
14
  email:
@@ -19,31 +18,29 @@ extensions: []
19
18
  extra_rdoc_files: []
20
19
  files:
21
20
  - lib/lumberjack/server.rb
22
- - lib/lumberjack/server2.rb
23
21
  - lib/lumberjack/client.rb
24
22
  homepage: https://github.com/jordansissel/lumberjack
25
- licenses: []
23
+ licenses:
24
+ - Apache 2.0
25
+ metadata: {}
26
26
  post_install_message:
27
27
  rdoc_options: []
28
28
  require_paths:
29
29
  - lib
30
30
  required_ruby_version: !ruby/object:Gem::Requirement
31
- none: false
32
31
  requirements:
33
- - - ! '>='
32
+ - - '>='
34
33
  - !ruby/object:Gem::Version
35
34
  version: '0'
36
35
  required_rubygems_version: !ruby/object:Gem::Requirement
37
- none: false
38
36
  requirements:
39
- - - ! '>='
37
+ - - '>='
40
38
  - !ruby/object:Gem::Version
41
39
  version: '0'
42
40
  requirements: []
43
41
  rubyforge_project:
44
- rubygems_version: 1.8.24
42
+ rubygems_version: 2.1.11
45
43
  signing_key:
46
- specification_version: 3
44
+ specification_version: 4
47
45
  summary: lumberjack log transport library
48
46
  test_files: []
49
- has_rdoc:
@@ -1,82 +0,0 @@
1
- require "ffi-rzmq"
2
- require "zlib"
3
- require "rbnacl"
4
- require "json"
5
-
6
- module Lumberjack
7
- class Server2
8
- # Create a new Lumberjack server.
9
- #
10
- # - options is a hash. Valid options are:
11
- #
12
- # * :port - the port to listen on
13
- # * :address - the host/address to bind to
14
- def initialize(options={})
15
- @options = {
16
- :endpoint => "tcp://0.0.0.0:3333",
17
- :my_secret_key => nil,
18
- :their_public_key => nil,
19
- }.merge(options)
20
-
21
- [:my_secret_key, :their_public_key].each do |k|
22
- if @options[k].nil?
23
- raise "You must specify #{k} in Lumberjack::Server.new(...)"
24
- end
25
- end
26
-
27
- @context = ZMQ::Context.new
28
- @socket = @context.socket(ZMQ::REP)
29
- @socket.bind(@options[:endpoint])
30
-
31
- @cryptobox = Crypto::Box.new(
32
- Crypto::PublicKey.new(@options[:their_public_key]),
33
- Crypto::PrivateKey.new(@options[:my_secret_key]))
34
- end # def initialize
35
-
36
- def run(&block)
37
- ciphertext = ""
38
- ciphertext.force_encoding("BINARY")
39
- nonce = ""
40
- nonce.force_encoding("BINARY")
41
- count = 0
42
- start = Time.now
43
- while true
44
- @socket.recv_string(nonce)
45
- @socket.recv_string(ciphertext)
46
-
47
- # Decrypt
48
- plaintext = @cryptobox.open(nonce, ciphertext)
49
-
50
- # decompress
51
- inflated = Zlib::Inflate.inflate(plaintext)
52
-
53
- # JSON
54
- events = JSON.parse(inflated)
55
- events.each do |event|
56
- yield event
57
- end
58
-
59
- # TODO(sissel): yield each event
60
- count += events.count
61
- @socket.send_string("")
62
- #count += 4096
63
-
64
- if count > 100000
65
- puts :rate => (count / (Time.now - start))
66
- count = 0
67
- start = Time.now
68
- end
69
- end
70
- end # def run
71
- end # class Server2
72
- end # module Lumberjack
73
-
74
- if __FILE__ == $0
75
- a = Lumberjack::Server2.new(
76
- :their_public_key => File.read("../../nacl.public").force_encoding("BINARY"),
77
- :my_secret_key => File.read("../../nacl.secret").force_encoding("BINARY"))
78
-
79
- a.run do |e|
80
- p :event => e
81
- end
82
- end