amq-client 0.9.8 → 0.9.9
Sign up to get free protection for your applications and to get access to all the features.
@@ -274,13 +274,13 @@ module AMQ
|
|
274
274
|
# @return [Fixnum] Heartbeat interval this client uses, in seconds.
|
275
275
|
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.6)
|
276
276
|
def heartbeat_interval
|
277
|
-
@
|
277
|
+
@heartbeat_interval
|
278
278
|
end # heartbeat_interval
|
279
279
|
|
280
280
|
# Returns true if heartbeats are enabled (heartbeat interval is greater than 0)
|
281
281
|
# @return [Boolean]
|
282
282
|
def heartbeats_enabled?
|
283
|
-
|
283
|
+
@heartbeat_interval && (@heartbeat_interval > 0)
|
284
284
|
end
|
285
285
|
|
286
286
|
|
@@ -608,10 +608,13 @@ module AMQ
|
|
608
608
|
#
|
609
609
|
# @api plugin
|
610
610
|
# @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.4.2.6)
|
611
|
-
def handle_tune(
|
612
|
-
@channel_max =
|
613
|
-
@frame_max =
|
614
|
-
|
611
|
+
def handle_tune(connection_tune)
|
612
|
+
@channel_max = connection_tune.channel_max.freeze
|
613
|
+
@frame_max = connection_tune.frame_max.freeze
|
614
|
+
|
615
|
+
client_heartbeat = @settings[:heartbeat] || @settings[:heartbeat_interval] || 0
|
616
|
+
|
617
|
+
@heartbeat_interval = negotiate_heartbeat_value(client_heartbeat, connection_tune.heartbeat)
|
615
618
|
|
616
619
|
self.send_frame(Protocol::Connection::TuneOk.encode(@channel_max, [settings[:frame_max], @frame_max].min, @heartbeat_interval))
|
617
620
|
end # handle_tune(method)
|
@@ -652,6 +655,14 @@ module AMQ
|
|
652
655
|
|
653
656
|
protected
|
654
657
|
|
658
|
+
def negotiate_heartbeat_value(client_value, server_value)
|
659
|
+
if client_value == 0 || server_value == 0
|
660
|
+
[client_value, server_value].max
|
661
|
+
else
|
662
|
+
[client_value, server_value].min
|
663
|
+
end
|
664
|
+
end
|
665
|
+
|
655
666
|
# Returns next frame from buffer whenever possible
|
656
667
|
#
|
657
668
|
# @api private
|
data/lib/amq/client/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amq-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2012-11-
|
15
|
+
date: 2012-11-22 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: eventmachine
|