amqp-client 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/amqp/client/connection.rb +16 -5
- data/lib/amqp/client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 191cd8053858a46d350a6c89db378058c9c602bde3eadc95ee4ae79b149fb0cf
|
4
|
+
data.tar.gz: c322ca75508f8a9566170fa473b562dfe4b4989dc6b1e2baa68408612fe47692
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c47bba0271dbd49b603127ac8749bfd85468ea7b0faa97d857eca585cde012094ace144b339a71d24fc4c90dace83f5e562669ae040ddb1eedd54b24eb6a876
|
7
|
+
data.tar.gz: 3ecb4641c83020063186fa1ac4413e6e42ae33ecb013eae3d2dcadfa1c30a3943ddf6320561ccb63917376ac23ac908c87f2d7e64abd7508c69c9f1030460e8e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [1.1.3] - 2021-11-04
|
4
|
+
|
5
|
+
- Fixed: Reraise SystemcallError in connect so that reconnect works
|
6
|
+
- Fixed: Keepalive support in OS X
|
7
|
+
- Added: Make keepalive settings configurable (eg. amqp://?keepalive=60:10:3)
|
8
|
+
|
3
9
|
## [1.1.2] - 2021-10-15
|
4
10
|
|
5
11
|
- Added: Support for JRuby and TruffleRuby
|
@@ -24,6 +24,7 @@ module AMQP
|
|
24
24
|
# the smallest of the client's and the broker's values will be used
|
25
25
|
# @option options [Integer] channel_max (2048) Maxium number of channels the client will be allowed to have open.
|
26
26
|
# Maxium allowed is 65_536. The smallest of the client's and the broker's value will be used.
|
27
|
+
# @option options [String] keepalive (60:10:3) TCP keepalive setting, 60s idle, 10s interval between probes, 3 probes
|
27
28
|
# @return [Connection]
|
28
29
|
def initialize(uri = "", read_loop_thread: true, **options)
|
29
30
|
uri = URI.parse(uri)
|
@@ -383,7 +384,8 @@ module AMQP
|
|
383
384
|
def open_socket(host, port, tls, options)
|
384
385
|
connect_timeout = options.fetch(:connect_timeout, 30).to_i
|
385
386
|
socket = Socket.tcp host, port, connect_timeout: connect_timeout
|
386
|
-
|
387
|
+
keepalive = options.fetch(:keepalive, "").split(":", 3).map!(&:to_i)
|
388
|
+
enable_tcp_keepalive(socket, *keepalive)
|
387
389
|
if tls
|
388
390
|
cert_store = OpenSSL::X509::Store.new
|
389
391
|
cert_store.set_default_paths
|
@@ -398,6 +400,8 @@ module AMQP
|
|
398
400
|
socket.post_connection_check(host) || raise(Error, "TLS certificate hostname doesn't match requested")
|
399
401
|
end
|
400
402
|
socket
|
403
|
+
rescue SystemCallError, OpenSSL::OpenSSLError => e
|
404
|
+
raise Error, "Could not open a socket: #{e.message}"
|
401
405
|
end
|
402
406
|
|
403
407
|
# Negotiate a connection
|
@@ -462,11 +466,18 @@ module AMQP
|
|
462
466
|
|
463
467
|
# Enable TCP keepalive, which is prefered to heartbeats
|
464
468
|
# @return [void]
|
465
|
-
def enable_tcp_keepalive(socket)
|
469
|
+
def enable_tcp_keepalive(socket, idle = 60, interval = 10, count = 3)
|
466
470
|
socket.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, true)
|
467
|
-
|
468
|
-
|
469
|
-
|
471
|
+
if Socket.const_defined?(:TCP_KEEPIDLE) # linux/bsd
|
472
|
+
socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_KEEPIDLE, idle)
|
473
|
+
elsif RUBY_PLATFORM.include? "darwin" # os x
|
474
|
+
# https://www.quickhack.net/nom/blog/2018-01-19-enable-tcp-keepalive-of-macos-and-linux-in-ruby.html
|
475
|
+
socket.setsockopt(Socket::IPPROTO_TCP, 0x10, idle)
|
476
|
+
else # windows
|
477
|
+
return
|
478
|
+
end
|
479
|
+
socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_KEEPINTVL, interval)
|
480
|
+
socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_KEEPCNT, count)
|
470
481
|
rescue StandardError => e
|
471
482
|
warn "AMQP-Client could not enable TCP keepalive on socket. #{e.inspect}"
|
472
483
|
end
|
data/lib/amqp/client/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amqp-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carl Hörberg
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Work in progress
|
14
14
|
email:
|