qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject svn commit: r1737094 - /qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp
Date Wed, 30 Mar 2016 10:33:35 GMT
Author: gsim
Date: Wed Mar 30 10:33:35 2016
New Revision: 1737094

URL: http://svn.apache.org/viewvc?rev=1737094&view=rev
Log:
QPID-7171: allow disable-auto-decode to be set via env var or conf file

Modified:
    qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp?rev=1737094&r1=1737093&r2=1737094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp Wed Mar 30 10:33:35 2016
@@ -25,9 +25,11 @@
 #include "qpid/messaging/PrivateImplRef.h"
 #include "qpid/framing/Uuid.h"
 #include "qpid/log/Statement.h"
+#include "qpid/Options.h"
 #include "qpid/Url.h"
 #include "qpid/amqp_0_10/Codecs.h"
 #include <boost/intrusive_ptr.hpp>
+#include "config.h"
 #include <vector>
 #include <sstream>
 #include <limits>
@@ -41,6 +43,32 @@ using qpid::types::VAR_LIST;
 using qpid::framing::Uuid;
 
 namespace {
+struct DefaultConnectionOptions : qpid::Options
+{
+    bool disableAutoDecode;
+
+    DefaultConnectionOptions() : qpid::Options("Connection Option Defaults")
+    {
+        addOptions()
+            ("disable-auto-decode", optValue(disableAutoDecode, "TRUE|FALSE"), "Whether to
decode amqp 0-10 maps and lists automatically by default");
+
+        CommonOptions common("", "", QPIDC_CONF_FILE);
+        try {
+            common.parse(0, 0, common.clientConfig, true);
+            this->parse(0, 0, common.clientConfig, true);
+        } catch (const std::exception& e) {
+            throw qpid::types::Exception(QPID_MSG("Failed to parse default connection options:
" << e.what()));
+        }
+    }
+};
+
+const DefaultConnectionOptions& getDefaultOptions()
+{
+    static DefaultConnectionOptions defaultOptions;
+    return defaultOptions;
+}
+
+
 
 const std::string TCP("tcp");
 const std::string COLON(":");
@@ -89,7 +117,7 @@ bool expired(const sys::AbsTime& start,
 ConnectionImpl::ConnectionImpl(const std::string& url, const Variant::Map& options)
:
     replaceUrls(false), autoReconnect(false), timeout(FOREVER), limit(-1),
     minReconnectInterval(0.001), maxReconnectInterval(2),
-    retries(0), reconnectOnLimitExceeded(true), disableAutoDecode(false)
+    retries(0), reconnectOnLimitExceeded(true), disableAutoDecode(getDefaultOptions().disableAutoDecode)
 {
     setOptions(options);
     urls.insert(urls.begin(), url);



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message