diff options
author | Benoit Foucher <benoit@zeroc.com> | 2008-10-23 12:17:56 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2008-10-23 12:17:56 +0200 |
commit | 11360063cc0113ba785de8d2587a6904e94c3bf4 (patch) | |
tree | 30a8d66d152ff61eb023ff9a37828f6c6e6b3d34 /cpp/src/IceGrid/NodeI.cpp | |
parent | Squashed commit of the following: (diff) | |
download | ice-11360063cc0113ba785de8d2587a6904e94c3bf4.tar.bz2 ice-11360063cc0113ba785de8d2587a6904e94c3bf4.tar.xz ice-11360063cc0113ba785de8d2587a6904e94c3bf4.zip |
Minor IceGrid node observer fix
Diffstat (limited to 'cpp/src/IceGrid/NodeI.cpp')
-rw-r--r-- | cpp/src/IceGrid/NodeI.cpp | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/cpp/src/IceGrid/NodeI.cpp b/cpp/src/IceGrid/NodeI.cpp index b721c553271..067a61f548d 100644 --- a/cpp/src/IceGrid/NodeI.cpp +++ b/cpp/src/IceGrid/NodeI.cpp @@ -197,7 +197,7 @@ public: { } - virtual void + virtual bool send() { try @@ -206,8 +206,9 @@ public: } catch(const Ice::LocalException&) { - finished(false); + return false; } + return true; } virtual void @@ -236,7 +237,7 @@ public: { } - virtual void + virtual bool send() { try @@ -245,8 +246,9 @@ public: } catch(const Ice::LocalException&) { - finished(false); + return false; } + return true; } virtual void @@ -275,7 +277,7 @@ public: { } - virtual void + virtual bool send() { try @@ -284,8 +286,9 @@ public: } catch(const Ice::LocalException&) { - finished(false); + return false; } + return true; } virtual void @@ -1074,11 +1077,17 @@ void NodeI::queueUpdate(const NodeObserverPrx& proxy, const UpdatePtr& update) { //Lock sync(*this); Called within the synchronization - deque<UpdatePtr>& queue = _observerUpdates[proxy]; - queue.push_back(update); - if(queue.size() == 1) + map<NodeObserverPrx, deque<UpdatePtr> >::iterator p = _observerUpdates.find(proxy); + if(p == _observerUpdates.end()) { - queue.front()->send(); + if(update->send()) + { + _observerUpdates[proxy].push_back(update); + } + } + else + { + p->second.push_back(update); } } @@ -1092,21 +1101,14 @@ NodeI::dequeueUpdate(const NodeObserverPrx& proxy, const UpdatePtr& update, bool return; } - deque<UpdatePtr>& queue = p->second; - if(all) - { - queue.clear(); - } - else - { - queue.pop_front(); - } + p->second.pop_front(); - if(!queue.empty()) + if(all || (!p->second.empty() && !p->second.front()->send())) { - queue.front()->send(); + p->second.clear(); } - else + + if(p->second.empty()) { _observerUpdates.erase(p); } |