From fc34191920a7fe8691d391c20ca8cdba848d6918 Mon Sep 17 00:00:00 2001 From: Benoit Foucher Date: Mon, 6 Aug 2007 11:39:57 +0200 Subject: Fixed bug 2355 --- cpp/src/IceGrid/ServerAdapterI.cpp | 17 ++++++++++++++--- cpp/src/IceGrid/ServerAdapterI.h | 1 + 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'cpp/src') diff --git a/cpp/src/IceGrid/ServerAdapterI.cpp b/cpp/src/IceGrid/ServerAdapterI.cpp index 85023b27a3d..b6835e6d90f 100644 --- a/cpp/src/IceGrid/ServerAdapterI.cpp +++ b/cpp/src/IceGrid/ServerAdapterI.cpp @@ -70,6 +70,7 @@ ServerAdapterI::activate_async(const AMD_Adapter_activatePtr& cb, const Ice::Cur { return; } + _activateAfterDeactivating = _server->getState() >= Deactivating; } // @@ -141,11 +142,20 @@ ServerAdapterI::setDirectProxy(const Ice::ObjectPrx& prx, const Ice::Current&) bool updated = _proxy != prx; _proxy = prx; - for(vector::const_iterator p = _activateCB.begin(); p != _activateCB.end(); ++p) + // + // If the server is being deactivated and the activation callback + // was added during the deactivation, we don't send the response + // now. The server is going to be activated again and the adapter + // activated. + // + if(_server->getState() < Deactivating || !_activateAfterDeactivating) { - (*p)->ice_response(_proxy); + for(vector::const_iterator p = _activateCB.begin(); p != _activateCB.end(); ++p) + { + (*p)->ice_response(_proxy); + } + _activateCB.clear(); } - _activateCB.clear(); if(updated) { @@ -186,6 +196,7 @@ ServerAdapterI::clear() { Lock sync(*this); _proxy = 0; + _activateAfterDeactivating = false; } void diff --git a/cpp/src/IceGrid/ServerAdapterI.h b/cpp/src/IceGrid/ServerAdapterI.h index 50bbedd6854..c8cd68e5d0f 100644 --- a/cpp/src/IceGrid/ServerAdapterI.h +++ b/cpp/src/IceGrid/ServerAdapterI.h @@ -48,6 +48,7 @@ private: Ice::ObjectPrx _proxy; std::vector _activateCB; + bool _activateAfterDeactivating; }; typedef IceUtil::Handle ServerAdapterIPtr; -- cgit v1.2.3