diff options
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/qmf/ConnectionSettingsImpl.cpp | 6 | ||||
-rw-r--r-- | cpp/src/qmf/ConnectionSettingsImpl.h | 2 | ||||
-rw-r--r-- | cpp/src/qmf/ResilientConnection.cpp | 15 | ||||
-rw-r--r-- | cpp/src/qmf/ValueImpl.cpp | 4 |
4 files changed, 20 insertions, 7 deletions
diff --git a/cpp/src/qmf/ConnectionSettingsImpl.cpp b/cpp/src/qmf/ConnectionSettingsImpl.cpp index fa0257aeba..63ce53b751 100644 --- a/cpp/src/qmf/ConnectionSettingsImpl.cpp +++ b/cpp/src/qmf/ConnectionSettingsImpl.cpp @@ -43,14 +43,15 @@ const string attrMaxSsf("maxSsf"); const string attrRetryDelayMin("retryDelayMin"); const string attrRetryDelayMax("retryDelayMax"); const string attrRetryDelayFactor("retryDelayFactor"); +const string attrSendUserId("sendUserId"); ConnectionSettingsImpl::ConnectionSettingsImpl() : - retryDelayMin(1), retryDelayMax(64), retryDelayFactor(2) + retryDelayMin(1), retryDelayMax(64), retryDelayFactor(2), sendUserId(true) { } ConnectionSettingsImpl::ConnectionSettingsImpl(const string& /*url*/) : - retryDelayMin(1), retryDelayMax(64), retryDelayFactor(2) + retryDelayMin(1), retryDelayMax(64), retryDelayFactor(2), sendUserId(true) { // TODO: Parse the URL } @@ -77,6 +78,7 @@ void ConnectionSettingsImpl::setAttr(const string& key, const Value& value) else if (key == attrRetryDelayMin) retryDelayMin = value.asUint(); else if (key == attrRetryDelayMax) retryDelayMax = value.asUint(); else if (key == attrRetryDelayFactor) retryDelayFactor = value.asUint(); + else if (key == attrSendUserId) sendUserId = value.asBool(); } Value ConnectionSettingsImpl::getAttr(const string& key) const diff --git a/cpp/src/qmf/ConnectionSettingsImpl.h b/cpp/src/qmf/ConnectionSettingsImpl.h index 4e34cfe870..e73715460a 100644 --- a/cpp/src/qmf/ConnectionSettingsImpl.h +++ b/cpp/src/qmf/ConnectionSettingsImpl.h @@ -34,6 +34,7 @@ namespace qmf { int retryDelayMin; int retryDelayMax; int retryDelayFactor; + bool sendUserId; public: ConnectionSettingsImpl(); @@ -52,6 +53,7 @@ namespace qmf { const qpid::client::ConnectionSettings& getClientSettings() const; void getRetrySettings(int* delayMin, int* delayMax, int* delayFactor) const; + bool getSendUserId() const { return sendUserId; } }; } diff --git a/cpp/src/qmf/ResilientConnection.cpp b/cpp/src/qmf/ResilientConnection.cpp index be7837b829..b3735657af 100644 --- a/cpp/src/qmf/ResilientConnection.cpp +++ b/cpp/src/qmf/ResilientConnection.cpp @@ -65,13 +65,12 @@ namespace qmf { client::Connection& connection; client::Session session; client::SubscriptionManager* subscriptions; + string userId; void* userContext; vector<string> dests; qpid::sys::Thread thread; - RCSession(ResilientConnectionImpl& ci, const string& n, client::Connection& c, void* uc) : - connImpl(ci), name(n), connection(c), session(connection.newSession(name)), - subscriptions(new client::SubscriptionManager(session)), userContext(uc), thread(*this) {} + RCSession(ResilientConnectionImpl& ci, const string& n, client::Connection& c, void* uc); ~RCSession(); void received(client::Message& msg); void run(); @@ -135,6 +134,14 @@ ResilientConnectionEvent ResilientConnectionEventImpl::copy() return item; } +RCSession::RCSession(ResilientConnectionImpl& ci, const string& n, client::Connection& c, void* uc) : + connImpl(ci), name(n), connection(c), session(connection.newSession(name)), + subscriptions(new client::SubscriptionManager(session)), userContext(uc), thread(*this) +{ + const qpid::client::ConnectionSettings& operSettings = connection.getNegotiatedSettings(); + userId = operSettings.username; +} + RCSession::~RCSession() { subscriptions->stop(); @@ -254,6 +261,8 @@ void ResilientConnectionImpl::sendMessage(SessionHandle handle, qmf::Message& me string data(message.body, message.length); msg.getDeliveryProperties().setRoutingKey(message.routingKey); msg.getMessageProperties().setReplyTo(qpid::framing::ReplyTo(message.replyExchange, message.replyKey)); + if (settings.impl->getSendUserId()) + msg.getMessageProperties().setUserId(sess->userId); msg.setData(data); try { diff --git a/cpp/src/qmf/ValueImpl.cpp b/cpp/src/qmf/ValueImpl.cpp index 652b99cae9..f13e1a231e 100644 --- a/cpp/src/qmf/ValueImpl.cpp +++ b/cpp/src/qmf/ValueImpl.cpp @@ -42,8 +42,8 @@ ValueImpl::ValueImpl(Typecode t, Buffer& buf) : typecode(t) case TYPE_BOOL : value.boolVal = (buf.getOctet() != 0); break; case TYPE_FLOAT : value.floatVal = buf.getFloat(); break; case TYPE_DOUBLE : value.doubleVal = buf.getDouble(); break; - case TYPE_INT8 : value.s32 = (int32_t) buf.getOctet(); break; - case TYPE_INT16 : value.s32 = (int32_t) buf.getShort(); break; + case TYPE_INT8 : value.s32 = (int32_t) ((int8_t) buf.getOctet()); break; + case TYPE_INT16 : value.s32 = (int32_t) ((int16_t) buf.getShort()); break; case TYPE_INT32 : value.s32 = (int32_t) buf.getLong(); break; case TYPE_INT64 : value.s64 = buf.getLongLong(); break; case TYPE_UUID : buf.getBin128(value.uuidVal); break; |