bunny 1.0.5 → 1.0.6

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: c8837b72e1a3b2ce162fc168eb298bcc9089f1d1
4
- data.tar.gz: 22a780ffdeff22a180470071ab8c90da2ef0ed81
3
+ metadata.gz: f5ad0826b1b08b783d21d44c8314e0e8e48d37ed
4
+ data.tar.gz: e8f88ee2ec853d851ddd2df9724e8eaa85c9f175
5
5
  SHA512:
6
- metadata.gz: 35bb0e4f3cc1dbd35d1fe9e135059b695f2fde65f188265a685d35c11ecad0460409215235ff3b108474e0a6304cca1f00a43d477ca129f4c1f3ea0d50615e33
7
- data.tar.gz: aa3ee730eb9f096e0f9268e3187741752f80877a5bea078039133ae830a83e177c435120f369953b122bb8c6bdb7250cf81a167675f1b6d8e22b1e74c9e0b466
6
+ metadata.gz: ea456c7e95e6aa2ecd8ed507c899414e4b5db536a10a9626aab01750749684cb6d2572b477943b9eb621d8b5dc42af8c5543e78525b248949e50c986df1ab87c
7
+ data.tar.gz: c0c8d03011b55a020549dc35ecdc44ec9a5595603f79f912359169c5bcecfdf0949f01958e65a67cdd00565e8268ed681d2ee6218ed5990fdac342b325aff9f0
@@ -1,3 +1,32 @@
1
+ ## Changes between Bunny 1.0.5 and 1.0.6
2
+
3
+ ### Better Exception Handling in Consumers
4
+
5
+ Consumer work pools will now correctly catch all exceptions
6
+ when dispatching submitted operations, not just `Bunny::Exception`
7
+ subclasses.
8
+
9
+ ### TLS Without Peer Verification
10
+
11
+ Bunny now successfully performs TLS upgrade when peer verification
12
+ is disabled.
13
+
14
+ Contribute by Jordan Curzon.
15
+
16
+ ### Bunny::Session#with_channel Ensures the Channel is Closed
17
+
18
+ `Bunny::Session#with_channel` now makes sure the channel is closed
19
+ even if provided block raises an exception
20
+
21
+ Contributed by Carl Hoerberg.
22
+
23
+
24
+ ### Channel Number = 0 is Rejected
25
+
26
+ `Bunny::Session#create_channel` will now reject channel number 0.
27
+
28
+
29
+
1
30
  ## Changes between Bunny 1.0.4 and 1.0.5
2
31
 
3
32
  ### Single Threaded Mode Fixes
@@ -82,10 +82,10 @@ module Bunny
82
82
 
83
83
  begin
84
84
  callable.call
85
- rescue Exception => e
86
- # TODO
87
- puts e.class.name
88
- puts e.message
85
+ rescue ::Exception => e
86
+ # TODO: use connection logger
87
+ $stderr.puts e.class.name
88
+ $stderr.puts e.message
89
89
  end
90
90
  end
91
91
  end
@@ -272,6 +272,8 @@ module Bunny
272
272
  #
273
273
  # @return [Bunny::Channel] Newly opened channel
274
274
  def create_channel(n = nil, consumer_pool_size = 1)
275
+ raise ArgumentError, "channel number 0 is reserved in the protocol and cannot be used" if 0 == n
276
+
275
277
  if n && (ch = @channels[n])
276
278
  ch
277
279
  else
@@ -305,8 +307,11 @@ module Bunny
305
307
  # @return [Bunny::Session] self
306
308
  def with_channel(n = nil)
307
309
  ch = create_channel(n)
308
- yield ch
309
- ch.close if ch.open?
310
+ begin
311
+ yield ch
312
+ ensure
313
+ ch.close if ch.open?
314
+ end
310
315
 
311
316
  self
312
317
  end
@@ -368,7 +368,14 @@ module Bunny
368
368
  # setting TLS/SSL version only works correctly when done
369
369
  # vis set_params. MK.
370
370
  ctx.set_params(:ssl_version => @opts.fetch(:tls_protocol, DEFAULT_TLS_PROTOCOL))
371
- ctx.set_params(:verify_mode => OpenSSL::SSL::VERIFY_PEER|OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT) if @verify_peer
371
+
372
+ verify_mode = if @verify_peer
373
+ OpenSSL::SSL::VERIFY_PEER|OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
374
+ else
375
+ OpenSSL::SSL::VERIFY_NONE
376
+ end
377
+
378
+ ctx.set_params(:verify_mode => verify_mode)
372
379
 
373
380
  ctx
374
381
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Bunny
4
4
  # @return [String] Version of the library
5
- VERSION = "1.0.5"
5
+ VERSION = "1.0.6"
6
6
  end
@@ -21,6 +21,15 @@ describe Bunny::Channel, "when opened" do
21
21
  end
22
22
  end
23
23
 
24
+ context "with an explicitly provided id = 0" do
25
+ it "raises ArgumentError" do
26
+ connection.should be_connected
27
+ expect {
28
+ connection.create_channel(0)
29
+ }.to raise_error(ArgumentError)
30
+ end
31
+ end
32
+
24
33
 
25
34
  context "with explicitly provided id" do
26
35
  it "uses that id and is successfully opened" do
@@ -0,0 +1,25 @@
1
+ require "spec_helper"
2
+
3
+ describe Bunny::Channel, "#with_channel" do
4
+ let(:connection) do
5
+ c = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed")
6
+ c.start
7
+ c
8
+ end
9
+
10
+ after :each do
11
+ connection.close if connection.open?
12
+ end
13
+
14
+ it "closes if the block throws an exception" do
15
+ ch = nil
16
+ begin
17
+ connection.with_channel do |wch|
18
+ ch = wch
19
+ raise Exception.new
20
+ end
21
+ rescue Exception
22
+ end
23
+ ch.should be_closed
24
+ end
25
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bunny
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Duncan
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2013-11-26 00:00:00.000000000 Z
15
+ date: 2013-12-11 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: amq-protocol
@@ -177,6 +177,7 @@ files:
177
177
  - spec/higher_level_api/integration/tls_connection_spec.rb
178
178
  - spec/higher_level_api/integration/tx_commit_spec.rb
179
179
  - spec/higher_level_api/integration/tx_rollback_spec.rb
180
+ - spec/higher_level_api/integration/with_channel_spec.rb
180
181
  - spec/issues/issue100_spec.rb
181
182
  - spec/issues/issue141_spec.rb
182
183
  - spec/issues/issue78_spec.rb
@@ -272,6 +273,7 @@ test_files:
272
273
  - spec/higher_level_api/integration/tls_connection_spec.rb
273
274
  - spec/higher_level_api/integration/tx_commit_spec.rb
274
275
  - spec/higher_level_api/integration/tx_rollback_spec.rb
276
+ - spec/higher_level_api/integration/with_channel_spec.rb
275
277
  - spec/issues/issue100_spec.rb
276
278
  - spec/issues/issue141_spec.rb
277
279
  - spec/issues/issue78_spec.rb