You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2018/01/05 16:36:09 UTC
[45/50] [abbrv] qpid-proton git commit: PROTON-1724: Revert
"PROTON-1721 [ruby] resovler errors are not handled correctly"
PROTON-1724: Revert "PROTON-1721 [ruby] resovler errors are not handled correctly"
This reverts commit c4d5fde71d925f3f44b0e29d672de7b039ee709f.
In the context of Ruby it is better to raise these exceptions immediately than to
bury them as events.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/cd06716a
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/cd06716a
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/cd06716a
Branch: refs/heads/go1
Commit: cd06716a08c936f5e7db053355a033b4af45529f
Parents: f3054e3
Author: Alan Conway <ac...@redhat.com>
Authored: Wed Dec 20 11:18:47 2017 -0500
Committer: Alan Conway <ac...@redhat.com>
Committed: Wed Dec 20 11:22:04 2017 -0500
----------------------------------------------------------------------
proton-c/bindings/ruby/lib/core/container.rb | 26 ++-------------------
proton-c/bindings/ruby/tests/test_container.rb | 7 ++----
2 files changed, 4 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cd06716a/proton-c/bindings/ruby/lib/core/container.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/core/container.rb b/proton-c/bindings/ruby/lib/core/container.rb
index e16323b..7a69b58 100644
--- a/proton-c/bindings/ruby/lib/core/container.rb
+++ b/proton-c/bindings/ruby/lib/core/container.rb
@@ -41,18 +41,6 @@ module Qpid::Proton
end
end
- # Used as the @io when a socket cannot be created due to an erro (e.g resolver fails)
- # Saves the error and raises it in on_readable so it can be reported via normal channels.
- class BrokenSocket
- def initialize(msg) @error = IOError.new(msg); end
- [:read_nonblock, :write_nonblock, :accept].each do |m|
- define_method(m) { |*args| raise @error }
- end
- [:close_read, :close_write, :close].each do |m|
- define_method(m) {}
- end
- end
-
class ListenTask < Listener
def initialize(io, handler, container)
@@ -190,12 +178,7 @@ module Qpid::Proton
opts[:password] ||= url.password
end
opts[:ssl_domain] ||= SSLDomain.new(SSLDomain::MODE_CLIENT) if url.scheme == "amqps"
- socket = begin
- TCPSocket.new(url.host, url.port)
- rescue => e
- BrokenSocket.new("connect(#{url}): #{e}")
- end
- connect_io(socket, opts)
+ connect_io(TCPSocket.new(url.host, url.port), opts)
end
# Open an AMQP protocol connection on an existing {IO} object
@@ -220,12 +203,7 @@ module Qpid::Proton
not_stopped
url = Qpid::Proton::uri url
# TODO aconway 2017-11-01: amqps, SSL
- server = begin
- TCPServer.new(url.host, url.port)
- rescue => e
- BrokenSocket.new("listen(#{url}): #{e}")
- end
- listen_io(server, handler)
+ listen_io(TCPServer.new(url.host, url.port), handler)
end
# Listen for incoming AMQP connections on an existing server socket.
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/cd06716a/proton-c/bindings/ruby/tests/test_container.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/tests/test_container.rb b/proton-c/bindings/ruby/tests/test_container.rb
index f2ad1f1..71a9f3a 100644
--- a/proton-c/bindings/ruby/tests/test_container.rb
+++ b/proton-c/bindings/ruby/tests/test_container.rb
@@ -152,11 +152,8 @@ class ContainerTest < Minitest::Test
def test_bad_host
cont = Container.new(__method__)
- l = cont.listen("badlisten.example.com:999")
- c = cont.connect("badconnect.example.com:999")
- cont.run
- assert_match(/badlisten.example.com:999/, l.condition.description)
- assert_match(/badconnect.example.com:999/, c.transport.condition.description)
+ assert_raises (SocketError) { cont.listen("badlisten.example.com:999") }
+ assert_raises (SocketError) { c = cont.connect("badconnect.example.com:999") }
end
# Verify that connection options are sent to the peer and available as Connection methods
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org