logjam_agent 0.23.1 → 0.24.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: 3151059f16592e18c8550de624b88c46b1414b96
4
- data.tar.gz: 62c4c3080034425cc3913e33b0fc0c6f4e864351
3
+ metadata.gz: c6c253f6df759f9f8a7b79293322ccfb0882879b
4
+ data.tar.gz: 24fbe446d05453f171525b86512df8024cd90630
5
5
  SHA512:
6
- metadata.gz: d15974461ebc2001e75e04fba03d5efebbbe275dfd8f0f5722e6bf99d8c7b4193646132dfc69972f9bd6cbb424ef858f552cfafb0f6284948e334b411a97085f
7
- data.tar.gz: 246250717c49e5d8c30afaca33e6db3fb254376d9642c96a6274e61183a05a720d98327ae289478b777c2e124d8690f081e220d65e3fe20fc2396504d8904246
6
+ metadata.gz: 83a13509eeac07120169e3f3ce3a54c69d19dd25db89c4575abe6dfc61ecde4e5c313b12020ca8381cdfb4489ced54aabed12ef9cdf1c74f9c325e830312a363
7
+ data.tar.gz: e97adc17d96c2069230c1ef54b922a74d1c50f980555cb240ff721dfbb2459d3185f81abede1fa6fe6595df17ce5e8368a05334d3057aa7fa1b0c37129e21435
@@ -42,8 +42,8 @@ module LogjamAgent
42
42
  (i+=1) > FIXNUM_MAX ? 1 : i
43
43
  end
44
44
 
45
- def pack_info(n)
46
- info = [META_INFO_TAG, LogjamAgent.compression_method, META_INFO_VERSION, META_INFO_DEVICE_NUMBER].pack("nCCN")
45
+ def pack_info(n, compression_method = LogjamAgent.compression_method)
46
+ info = [META_INFO_TAG, compression_method, META_INFO_VERSION, META_INFO_DEVICE_NUMBER].pack("nCCN")
47
47
  info << pack_uint64_big_endian(zclock_time)
48
48
  info << pack_uint64_big_endian(n)
49
49
  end
@@ -1,3 +1,3 @@
1
1
  module LogjamAgent
2
- VERSION = "0.23.1"
2
+ VERSION = "0.24.0"
3
3
  end
@@ -51,7 +51,7 @@ module LogjamAgent
51
51
  def socket
52
52
  return @socket if @socket
53
53
  @socket = self.class.context.socket(ZMQ::DEALER)
54
- at_exit { reset }
54
+ at_exit { ping; reset }
55
55
  @socket.setsockopt(ZMQ::LINGER, @config[:linger])
56
56
  @socket.setsockopt(ZMQ::SNDHWM, @config[:snd_hwm])
57
57
  @socket.setsockopt(ZMQ::RCVHWM, @config[:rcv_hwm])
@@ -103,23 +103,30 @@ module LogjamAgent
103
103
 
104
104
  VALID_RESPONSE_CODES = [200,202]
105
105
 
106
- def send_receive(app_env, key, data)
107
- info = pack_info(@sequence = next_fixnum(@sequence))
106
+ def send_receive(app_env, key, data, compression_method = LogjamAgent.compression_method)
107
+ info = pack_info(@sequence = next_fixnum(@sequence), compression_method)
108
108
  request_parts = ["", app_env, key, data, info]
109
109
  answer_parts = []
110
110
  if socket.send_strings(request_parts) < 0
111
111
  log_warning "ZMQ error on sending: #{ZMQ::Util.error_string}"
112
112
  reset
113
- return
113
+ return nil
114
114
  end
115
115
  if socket.recv_strings(answer_parts) < 0
116
116
  log_warning "ZMQ error on receiving: #{ZMQ::Util.error_string}"
117
117
  reset
118
- return
118
+ return nil
119
119
  end
120
120
  if answer_parts.first != "" || !VALID_RESPONSE_CODES.include?(answer_parts.second.to_s.to_i)
121
121
  log_warning "unexpected answer from logjam broker: #{answer_parts.inspect}"
122
122
  end
123
+ answer_parts.second
124
+ end
125
+
126
+ def ping
127
+ unless send_receive("ping", "", "{}", NO_COMPRESSION)
128
+ log_warning "failed to receive pong"
129
+ end
123
130
  end
124
131
 
125
132
  if defined?(Mocha)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logjam_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.1
4
+ version: 0.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Kaes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-02 00:00:00.000000000 Z
11
+ date: 2016-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake