diff options
author | Brett Stottlemyer <bstottle@ford.com> | 2015-03-07 15:26:14 -0500 |
---|---|---|
committer | Brett Stottlemyer <bstottle@ford.com> | 2015-03-10 12:50:11 +0000 |
commit | 2f579c53f41985f4bdb52011b9c51c82f12a24bb (patch) | |
tree | f3f331b1cfabb5842ea0d9232d163752a7fe437e /src/remoteobjects/qremoteobjectregistrysource.cpp | |
parent | a543216863645e360c85ba1a799291c075fa9632 (diff) |
Enhance Registry
This adds support for creating the Registry Host whenever, it no longer
needs to be created before Registry Replicas are used. It also provides
warnings if a Source is enabled that is already in the Registry.
To support consistency, connections are only made when the Registry is
valid. This prevents the edge case of a locally hosted source getting
connected to and then having a duplicate in the Registry when it connects.
Change-Id: Iffc21a41a72edf5e3c3b4e80d6de23d0b85c4d49
Reviewed-by: BjΓΆrn Breitmeyer <bjoern.breitmeyer@kdab.com>
Diffstat (limited to 'src/remoteobjects/qremoteobjectregistrysource.cpp')
-rw-r--r-- | src/remoteobjects/qremoteobjectregistrysource.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/remoteobjects/qremoteobjectregistrysource.cpp b/src/remoteobjects/qremoteobjectregistrysource.cpp index 082e0b7..ab499e4 100644 --- a/src/remoteobjects/qremoteobjectregistrysource.cpp +++ b/src/remoteobjects/qremoteobjectregistrysource.cpp @@ -75,10 +75,18 @@ void QRegistrySource::removeServer(const QUrl &url) void QRegistrySource::addSource(const QRemoteObjectSourceLocation &entry) { qCDebug(QT_REMOTEOBJECT) << "An entry was added to the RegistrySource" << entry; - if (!m_sourceLocations.contains(entry.first)) { - m_sourceLocations[entry.first] = entry.second; - emit remoteObjectAdded(entry); + if (m_sourceLocations.contains(entry.first)) { + if (m_sourceLocations[entry.first] == entry.second) + qCWarning(QT_REMOTEOBJECT) << "Node warning: Ignoring Source" << entry.first + << "as this Node already has a Source by that name."; + else + qCWarning(QT_REMOTEOBJECT) << "Node warning: Ignoring Source" << entry.first + << "as another source (" << m_sourceLocations[entry.first] + << ") has already registered that name."; + return; } + m_sourceLocations[entry.first] = entry.second; + emit remoteObjectAdded(entry); } void QRegistrySource::removeSource(const QRemoteObjectSourceLocation &entry) |