From 7154e46361c1cacc1ce4c09b3db9eb07828f8e3a Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Wed, 20 May 2009 21:15:32 +0000 Subject: Numerous fixes in the qmf console for Ruby Added proper connection close if the SASL security context expires. Added :timeout and :async features to qmf console. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@776856 13f79535-47bb-0310-9956-ffa450edef68 --- ruby/lib/qpid/connection.rb | 3 ++- ruby/lib/qpid/delegates.rb | 2 ++ ruby/lib/qpid/framer.rb | 2 ++ ruby/lib/qpid/qmf.rb | 63 +++++++++++++++++++++++++++------------------ ruby/lib/qpid/session.rb | 4 +-- 5 files changed, 46 insertions(+), 28 deletions(-) (limited to 'ruby/lib') diff --git a/ruby/lib/qpid/connection.rb b/ruby/lib/qpid/connection.rb index 59d88196a3..d2efbfb263 100644 --- a/ruby/lib/qpid/connection.rb +++ b/ruby/lib/qpid/connection.rb @@ -36,7 +36,7 @@ module Qpid include MonitorMixin attr_reader :spec, :attached, :sessions, :thread - attr_accessor :opened, :failed, :close_code + attr_accessor :opened, :failed, :close_code, :user_id def initialize(sock, args={}) super(sock) @@ -58,6 +58,7 @@ module Qpid @thread = nil @channel_max = 65535 + @user_id = nil @delegate = delegate.call(self, args) end diff --git a/ruby/lib/qpid/delegates.rb b/ruby/lib/qpid/delegates.rb index 8d866e895f..6d655067ef 100644 --- a/ruby/lib/qpid/delegates.rb +++ b/ruby/lib/qpid/delegates.rb @@ -202,6 +202,7 @@ module Qpid end begin resp = Sasl.client_start(@saslConn, mech_list) + @connection.user_id = Sasl.user_id(@saslConn) ch.connection_start_ok(:client_properties => PROPERTIES, :mechanism => resp[2], :response => resp[1]) @@ -214,6 +215,7 @@ module Qpid def connection_secure(ch, secure) resp = Sasl.client_step(@saslConn, secure.challenge) + @connection.user_id = Sasl.user_id(@saslConn) ch.connection_secure_ok(:response => resp[1]) end diff --git a/ruby/lib/qpid/framer.rb b/ruby/lib/qpid/framer.rb index abac221f00..d057605383 100644 --- a/ruby/lib/qpid/framer.rb +++ b/ruby/lib/qpid/framer.rb @@ -137,6 +137,8 @@ module Qpid @tx_buf = "" frm.debug("FLUSHED") if frm end + rescue + @sock.close unless @sock.closed? end def _write(buf) diff --git a/ruby/lib/qpid/qmf.rb b/ruby/lib/qpid/qmf.rb index ebca7ee5ab..b7309155c3 100644 --- a/ruby/lib/qpid/qmf.rb +++ b/ruby/lib/qpid/qmf.rb @@ -252,7 +252,7 @@ module Qpid::Qmf args = { :exchange => "qpid.management", :queue => broker.topic_name, :binding_key => "console.obj.*.*.#{package_name}.#" } - broker.amqpSession.exchange_bind(args) + broker.amqp_session.exchange_bind(args) end end @@ -264,7 +264,7 @@ module Qpid::Qmf args = { :exchange => "qpid.management", :queue => broker.topic_name, :binding_key=> "console.obj.*.*.#{package_name}.#{class_name}.#" } - broker.amqpSession.exchange_bind(args) + broker.amqp_session.exchange_bind(args) end end @@ -277,7 +277,7 @@ module Qpid::Qmf args = { :exchange => "qpid.management", :queue => broker.topic_name, :binding_key => "console.obj.*.*.#{pname}.#{cname}.#" } - broker.amqpSession.exchange_bind(args) + broker.amqp_session.exchange_bind(args) end end @@ -319,7 +319,7 @@ module Qpid::Qmf # The default timeout for this synchronous operation is 60 seconds. To change the timeout, # use the following argument: # - # :_timeout =