diff options
Diffstat (limited to 'cpp/src/qpid/client')
| -rw-r--r-- | cpp/src/qpid/client/Connection.cpp | 2 | ||||
| -rw-r--r-- | cpp/src/qpid/client/ConnectionHandler.cpp | 10 | ||||
| -rw-r--r-- | cpp/src/qpid/client/ConnectionImpl.cpp | 4 | ||||
| -rw-r--r-- | cpp/src/qpid/client/LoadPlugins.cpp | 6 | ||||
| -rw-r--r-- | cpp/src/qpid/client/SessionImpl.cpp | 2 | ||||
| -rw-r--r-- | cpp/src/qpid/client/SslConnector.cpp | 4 | ||||
| -rw-r--r-- | cpp/src/qpid/client/TCPConnector.cpp | 8 | ||||
| -rw-r--r-- | cpp/src/qpid/client/amqp0_10/AddressResolution.cpp | 1 | ||||
| -rw-r--r-- | cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp | 3 |
9 files changed, 27 insertions, 13 deletions
diff --git a/cpp/src/qpid/client/Connection.cpp b/cpp/src/qpid/client/Connection.cpp index 2882ef5d42..83a4a35b53 100644 --- a/cpp/src/qpid/client/Connection.cpp +++ b/cpp/src/qpid/client/Connection.cpp @@ -75,7 +75,7 @@ void Connection::open(const Url& url, const ConnectionSettings& settings) { i++; try { ConnectionSettings cs(settings); - cs.protocol = addr.protocol; + if (addr.protocol.size()) cs.protocol = addr.protocol; cs.host = addr.host; cs.port = addr.port; open(cs); diff --git a/cpp/src/qpid/client/ConnectionHandler.cpp b/cpp/src/qpid/client/ConnectionHandler.cpp index ab0d8e0700..94561f8079 100644 --- a/cpp/src/qpid/client/ConnectionHandler.cpp +++ b/cpp/src/qpid/client/ConnectionHandler.cpp @@ -28,10 +28,13 @@ #include "qpid/framing/all_method_bodies.h" #include "qpid/framing/ClientInvoker.h" #include "qpid/framing/reply_exceptions.h" +#include "qpid/framing/FieldValue.h" #include "qpid/log/Helpers.h" #include "qpid/log/Statement.h" #include "qpid/sys/SystemInfo.h" +#include <algorithm> + using namespace qpid::client; using namespace qpid::framing; using namespace qpid::framing::connection; @@ -238,15 +241,16 @@ void ConnectionHandler::start(const FieldTable& /*serverProps*/, const Array& me ); std::vector<std::string> mechlist; + mechlist.reserve(mechanisms.size()); if (mechanism.empty()) { //mechlist is simply what the server offers - mechanisms.collect(mechlist); + std::transform(mechanisms.begin(), mechanisms.end(), std::back_inserter(mechlist), Array::get<std::string, Array::ValuePtr>); } else { //mechlist is the intersection of those indicated by user and //those supported by server, in the order listed by user std::vector<std::string> allowed = split(mechanism, " "); - std::vector<std::string> supported; - mechanisms.collect(supported); + std::vector<std::string> supported(mechanisms.size()); + std::transform(mechanisms.begin(), mechanisms.end(), std::back_inserter(supported), Array::get<std::string, Array::ValuePtr>); intersection(allowed, supported, mechlist); if (mechlist.empty()) { throw Exception(QPID_MSG("Desired mechanism(s) not valid: " << mechanism << " (supported: " << join(supported) << ")")); diff --git a/cpp/src/qpid/client/ConnectionImpl.cpp b/cpp/src/qpid/client/ConnectionImpl.cpp index db97f1e0f4..85b0e8303e 100644 --- a/cpp/src/qpid/client/ConnectionImpl.cpp +++ b/cpp/src/qpid/client/ConnectionImpl.cpp @@ -115,8 +115,10 @@ public: ioThreads(0), connections(0) { + CommonOptions common("", "", QPIDC_CONF_FILE); IOThreadOptions options(c); - options.parse(0, 0, QPIDC_CONF_FILE, true); + common.parse(0, 0, common.clientConfig, true); + options.parse(0, 0, common.clientConfig, true); maxIOThreads = (options.maxIOThreads != -1) ? options.maxIOThreads : 1; } diff --git a/cpp/src/qpid/client/LoadPlugins.cpp b/cpp/src/qpid/client/LoadPlugins.cpp index 246eb60c67..d76e1d458e 100644 --- a/cpp/src/qpid/client/LoadPlugins.cpp +++ b/cpp/src/qpid/client/LoadPlugins.cpp @@ -39,10 +39,12 @@ namespace { struct LoadtimeInitialise { LoadtimeInitialise() { + CommonOptions common("", "", QPIDC_CONF_FILE); qpid::ModuleOptions moduleOptions(QPIDC_MODULE_DIR); string defaultPath (moduleOptions.loadDir); - moduleOptions.parse (0, 0, QPIDC_CONF_FILE, true); - + common.parse(0, 0, common.clientConfig, true); + moduleOptions.parse (0, 0, common.clientConfig, true); + for (vector<string>::iterator iter = moduleOptions.load.begin(); iter != moduleOptions.load.end(); iter++) diff --git a/cpp/src/qpid/client/SessionImpl.cpp b/cpp/src/qpid/client/SessionImpl.cpp index 9ac5323a53..3f3ad617f4 100644 --- a/cpp/src/qpid/client/SessionImpl.cpp +++ b/cpp/src/qpid/client/SessionImpl.cpp @@ -324,7 +324,7 @@ struct MethodContentAdaptor : MethodContent MethodContentAdaptor(const FrameSet& f) : header(*f.getHeaders()), content(f.getContent()) {} - AMQHeaderBody getHeader() const + const AMQHeaderBody& getHeader() const { return header; } diff --git a/cpp/src/qpid/client/SslConnector.cpp b/cpp/src/qpid/client/SslConnector.cpp index 6b6bf884ec..ab0c5c4957 100644 --- a/cpp/src/qpid/client/SslConnector.cpp +++ b/cpp/src/qpid/client/SslConnector.cpp @@ -148,8 +148,10 @@ namespace { struct StaticInit { StaticInit() { try { + CommonOptions common("", "", QPIDC_CONF_FILE); SslOptions options; - options.parse (0, 0, QPIDC_CONF_FILE, true); + common.parse(0, 0, common.clientConfig, true); + options.parse (0, 0, common.clientConfig, true); if (options.certDbPath.empty()) { QPID_LOG(info, "SSL connector not enabled, you must set QPID_SSL_CERT_DB to enable it."); } else { diff --git a/cpp/src/qpid/client/TCPConnector.cpp b/cpp/src/qpid/client/TCPConnector.cpp index 51eacf77e8..4660a41c07 100644 --- a/cpp/src/qpid/client/TCPConnector.cpp +++ b/cpp/src/qpid/client/TCPConnector.cpp @@ -97,7 +97,7 @@ void TCPConnector::connect(const std::string& host, const std::string& port) { boost::bind(&TCPConnector::connected, this, _1), boost::bind(&TCPConnector::connectFailed, this, _3)); closed = false; - identifier = str(format("[%1%]") % socket.getFullAddress()); + connector->start(poller); } @@ -120,6 +120,8 @@ void TCPConnector::start(sys::AsynchIO* aio_) { for (int i = 0; i < 4; i++) { aio->queueReadBuffer(new Buff(maxFrameSize)); } + + identifier = str(format("[%1%]") % socket.getFullAddress()); } void TCPConnector::initAmqp() { @@ -129,7 +131,7 @@ void TCPConnector::initAmqp() { void TCPConnector::connectFailed(const std::string& msg) { connector = 0; - QPID_LOG(warning, "Connect failed: " << msg << " " << identifier); + QPID_LOG(warning, "Connect failed: " << msg); socket.close(); if (!closed) closed = true; @@ -183,7 +185,7 @@ sys::ShutdownHandler* TCPConnector::getShutdownHandler() const { return shutdownHandler; } -const std::string& TCPConnector::getIdentifier() const { +const std::string& TCPConnector::getIdentifier() const { return identifier; } diff --git a/cpp/src/qpid/client/amqp0_10/AddressResolution.cpp b/cpp/src/qpid/client/amqp0_10/AddressResolution.cpp index 5924e30dd8..a8f4fb5237 100644 --- a/cpp/src/qpid/client/amqp0_10/AddressResolution.cpp +++ b/cpp/src/qpid/client/amqp0_10/AddressResolution.cpp @@ -32,6 +32,7 @@ #include "qpid/framing/ExchangeBoundResult.h" #include "qpid/framing/ExchangeQueryResult.h" #include "qpid/framing/FieldTable.h" +#include "qpid/framing/FieldValue.h" #include "qpid/framing/QueueQueryResult.h" #include "qpid/framing/ReplyTo.h" #include "qpid/framing/reply_exceptions.h" diff --git a/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp b/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp index 3cfd2e37f2..2ea4dc0c61 100644 --- a/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp +++ b/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp @@ -41,6 +41,7 @@ using qpid::framing::Uuid; namespace { +const std::string TCP("tcp"); double FOREVER(std::numeric_limits<double>::max()); // Time values in seconds can be specified as integer or floating point values. @@ -290,7 +291,7 @@ bool ConnectionImpl::tryConnect() for (std::vector<std::string>::const_iterator i = urls.begin(); i != urls.end(); ++i) { try { QPID_LOG(info, "Trying to connect to " << *i << "..."); - Url url(*i); + Url url(*i, settings.protocol.size() ? settings.protocol : TCP); if (url.getUser().size()) settings.username = url.getUser(); if (url.getPass().size()) settings.password = url.getPass(); connection.open(url, settings); |
