summaryrefslogtreecommitdiff
path: root/cpp/src/IceGrid/Topics.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2005-10-20 13:24:19 +0000
committerBenoit Foucher <benoit@zeroc.com>2005-10-20 13:24:19 +0000
commit280c0231d0a4630a3327dca70d467613e6e97aea (patch)
treee408728be00bcac1b06a6582e437602f8526c5af /cpp/src/IceGrid/Topics.cpp
parent- Update required version of Mono to 1.1.8 in INSTALL.MONO file (diff)
downloadice-280c0231d0a4630a3327dca70d467613e6e97aea.tar.bz2
ice-280c0231d0a4630a3327dca70d467613e6e97aea.tar.xz
ice-280c0231d0a4630a3327dca70d467613e6e97aea.zip
Observer bug fixes.
Diffstat (limited to 'cpp/src/IceGrid/Topics.cpp')
-rw-r--r--cpp/src/IceGrid/Topics.cpp30
1 files changed, 22 insertions, 8 deletions
diff --git a/cpp/src/IceGrid/Topics.cpp b/cpp/src/IceGrid/Topics.cpp
index fed78928fdb..a601ca311ee 100644
--- a/cpp/src/IceGrid/Topics.cpp
+++ b/cpp/src/IceGrid/Topics.cpp
@@ -181,14 +181,22 @@ NodeObserverTopic::subscribe(const NodeObserverPrx& observer, int serial)
{
if(serial == -1)
{
- Lock sync(*this);
NodeDynamicInfoSeq nodes;
- nodes.reserve(_nodes.size());
- for(map<string, NodeDynamicInfo>::const_iterator p = _nodes.begin(); p != _nodes.end(); ++p)
+ int serial;
{
- nodes.push_back(p->second);
+ Lock sync(*this);
+ nodes.reserve(_nodes.size());
+ for(map<string, NodeDynamicInfo>::const_iterator p = _nodes.begin(); p != _nodes.end(); ++p)
+ {
+ nodes.push_back(p->second);
+ }
+ serial = _serial;
}
- observer->init_async(new NodeInitCB(this, observer, _serial), nodes);
+ //
+ // TODO: Race conditions are possible here, we should
+ // check the serial and eventually retry if it changed.
+ //
+ observer->init_async(new NodeInitCB(this, observer, serial), nodes);
return;
}
@@ -309,9 +317,15 @@ RegistryObserverTopic::subscribe(const RegistryObserverPrx& observer, int serial
{
if(serial == -1)
{
- Lock sync(*this);
- assert(_serial != -1);
- observer->init_async(new RegistryInitCB(this, observer, _serial), _serial, _applications);
+ ApplicationDescriptorSeq applications;
+ int serial;
+ {
+ Lock sync(*this);
+ assert(_serial != -1);
+ serial = _serial;
+ applications = _applications;
+ }
+ observer->init_async(new RegistryInitCB(this, observer, serial), serial, applications);
return;
}