diff options
Diffstat (limited to 'qpid/cpp/src/qmf/Agent.cpp')
-rw-r--r-- | qpid/cpp/src/qmf/Agent.cpp | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/qpid/cpp/src/qmf/Agent.cpp b/qpid/cpp/src/qmf/Agent.cpp index 684f8e4fba..915f2a1c88 100644 --- a/qpid/cpp/src/qmf/Agent.cpp +++ b/qpid/cpp/src/qmf/Agent.cpp @@ -72,7 +72,7 @@ Schema Agent::getSchema(const SchemaId& s, Duration t) { return impl->getSchema( AgentImpl::AgentImpl(const std::string& n, uint32_t e, ConsoleSessionImpl& s) : name(n), directSubject(n), epoch(e), session(s), touched(true), untouchedCount(0), capability(0), - sender(session.directSender), schemaCache(s.schemaCache) + sender(session.directSender), nextCorrelator(1), schemaCache(s.schemaCache) { } @@ -102,11 +102,12 @@ const Variant& AgentImpl::getAttribute(const string& k) const ConsoleEvent AgentImpl::query(const Query& query, Duration timeout) { boost::shared_ptr<SyncContext> context(new SyncContext()); - uint32_t correlator(session.correlator()); + uint32_t correlator; ConsoleEvent result; { qpid::sys::Mutex::ScopedLock l(lock); + correlator = nextCorrelator++; contextMap[correlator] = context; } try { @@ -150,7 +151,12 @@ ConsoleEvent AgentImpl::query(const string& text, Duration timeout) uint32_t AgentImpl::queryAsync(const Query& query) { - uint32_t correlator(session.correlator()); + uint32_t correlator; + + { + qpid::sys::Mutex::ScopedLock l(lock); + correlator = nextCorrelator++; + } sendQuery(query, correlator); return correlator; @@ -166,11 +172,12 @@ uint32_t AgentImpl::queryAsync(const string& text) ConsoleEvent AgentImpl::callMethod(const string& method, const Variant::Map& args, const DataAddr& addr, Duration timeout) { boost::shared_ptr<SyncContext> context(new SyncContext()); - uint32_t correlator(session.correlator()); + uint32_t correlator; ConsoleEvent result; { qpid::sys::Mutex::ScopedLock l(lock); + correlator = nextCorrelator++; contextMap[correlator] = context; } try { @@ -206,7 +213,12 @@ ConsoleEvent AgentImpl::callMethod(const string& method, const Variant::Map& arg uint32_t AgentImpl::callMethodAsync(const string& method, const Variant::Map& args, const DataAddr& addr) { - uint32_t correlator(session.correlator()); + uint32_t correlator; + + { + qpid::sys::Mutex::ScopedLock l(lock); + correlator = nextCorrelator++; + } sendMethod(method, args, addr, correlator); return correlator; @@ -584,7 +596,12 @@ void AgentImpl::sendMethod(const string& method, const Variant::Map& args, const void AgentImpl::sendSchemaRequest(const SchemaId& id) { - uint32_t correlator(session.correlator()); + uint32_t correlator; + + { + qpid::sys::Mutex::ScopedLock l(lock); + correlator = nextCorrelator++; + } if (capability >= AGENT_CAPABILITY_V2_SCHEMA) { Query query(QUERY_SCHEMA, id); |