diff options
| author | Alan Conway <aconway@apache.org> | 2011-02-01 21:26:00 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2011-02-01 21:26:00 +0000 |
| commit | 8cc4082337bd6ea1be0c9f96d3383314f7fc228b (patch) | |
| tree | 30762327f33233deea60aa48260e84de332465fd /cpp/src/qpid/broker/LinkRegistry.cpp | |
| parent | 14842b8d1b62c3c70fb135287b9daa66b08c5b63 (diff) | |
| download | qpid-python-8cc4082337bd6ea1be0c9f96d3383314f7fc228b.tar.gz | |
QPID-3007: Unique management identifier for connections.
Management was using remote socket address (host:port) to identify
connections, but this is not a unique identifier. Both the local and
remote addresses are needed to uniquely identify a connection - see
http://www.faqs.org/rfcs/rfc793.html.
This was causing management errors (multiple objects using same
identifier) and cluster failures (invalid-arg exception) due to
inconsistencies caused by the incorrect management map.
This commit uses "localhost:localport-remotehost:remoteport" as a unique identifier.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1066220 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/LinkRegistry.cpp')
| -rw-r--r-- | cpp/src/qpid/broker/LinkRegistry.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/cpp/src/qpid/broker/LinkRegistry.cpp b/cpp/src/qpid/broker/LinkRegistry.cpp index 82f1f0ea24..7b1c75db74 100644 --- a/cpp/src/qpid/broker/LinkRegistry.cpp +++ b/cpp/src/qpid/broker/LinkRegistry.cpp @@ -255,8 +255,17 @@ MessageStore* LinkRegistry::getStore() const { return store; } -Link::shared_ptr LinkRegistry::findLink(const std::string& key) +Link::shared_ptr LinkRegistry::findLink(const std::string& keyOrMgmtId) { + // Convert keyOrMgmtId to a host:port key. + // + // TODO aconway 2011-02-01: centralize code that constructs/parses + // connection management IDs. Currently sys:: protocol factories + // and IO plugins construct the IDs and LinkRegistry parses them. + size_t separator = keyOrMgmtId.find('-'); + if (separator == std::string::npos) separator = 0; + std::string key = keyOrMgmtId.substr(separator+1, std::string::npos); + Mutex::ScopedLock locker(lock); LinkMap::iterator l = links.find(key); if (l != links.end()) return l->second; |
