diff options
author | Benoit Foucher <benoit@zeroc.com> | 2006-10-24 10:07:47 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2006-10-24 10:07:47 +0000 |
commit | 7b592e7fe94abf0e8e8e493bb5e83d92f0c5415f (patch) | |
tree | 573b60cfabd063723d8d2c4e9f81a4972581a2a6 /cpp/src | |
parent | Removed Properties.sgml and ProxiesEndpoints.sgml. (diff) | |
download | ice-7b592e7fe94abf0e8e8e493bb5e83d92f0c5415f.tar.bz2 ice-7b592e7fe94abf0e8e8e493bb5e83d92f0c5415f.tar.xz ice-7b592e7fe94abf0e8e8e493bb5e83d92f0c5415f.zip |
Fixed bug where node couldn't be interrupted if master isn't available
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/IceGrid/IceGridNode.cpp | 10 | ||||
-rw-r--r-- | cpp/src/IceGrid/NodeSessionManager.cpp | 11 | ||||
-rw-r--r-- | cpp/src/IceGrid/NodeSessionManager.h | 3 | ||||
-rw-r--r-- | cpp/src/IceGrid/SessionManager.h | 8 |
4 files changed, 26 insertions, 6 deletions
diff --git a/cpp/src/IceGrid/IceGridNode.cpp b/cpp/src/IceGrid/IceGridNode.cpp index 242d6f931f0..27426b3c3bc 100644 --- a/cpp/src/IceGrid/IceGridNode.cpp +++ b/cpp/src/IceGrid/IceGridNode.cpp @@ -154,6 +154,7 @@ NodeService::shutdown() { assert(_activator); _activator->shutdown(); + _sessions.terminate(); // Unblock the main thread if it's blocked on waitForCreate() return true; } @@ -485,7 +486,14 @@ NodeService::start(int argc, char* argv[]) if(!bundleName.empty() || !desc.empty()) { enableInterrupt(); - _sessions.waitForCreate(); + if(!_sessions.waitForCreate()) + { + // + // Create was interrupted, return true as if the service was + // correctly initiliazed to make sure it's properly stopped. + // + return true; + } disableInterrupt(); } diff --git a/cpp/src/IceGrid/NodeSessionManager.cpp b/cpp/src/IceGrid/NodeSessionManager.cpp index 7bae899a9bf..71981be12fd 100644 --- a/cpp/src/IceGrid/NodeSessionManager.cpp +++ b/cpp/src/IceGrid/NodeSessionManager.cpp @@ -260,11 +260,18 @@ NodeSessionManager::create(const InternalRegistryPrx& replica) thread->tryCreateSession(); } -void +bool NodeSessionManager::waitForCreate() { assert(_thread); - _thread->waitForCreate(); + return _thread->waitForCreate(); +} + +void +NodeSessionManager::terminate() +{ + assert(_thread); + _thread->terminate(); } void diff --git a/cpp/src/IceGrid/NodeSessionManager.h b/cpp/src/IceGrid/NodeSessionManager.h index abe8f21a7fd..e2a2f4a79e7 100644 --- a/cpp/src/IceGrid/NodeSessionManager.h +++ b/cpp/src/IceGrid/NodeSessionManager.h @@ -52,7 +52,8 @@ public: void create(const NodeIPtr&); void create(const InternalRegistryPrx&); - void waitForCreate(); + bool waitForCreate(); + void terminate(); void destroy(); NodeSessionKeepAliveThreadPtr replicaAdded(const InternalRegistryPrx&); diff --git a/cpp/src/IceGrid/SessionManager.h b/cpp/src/IceGrid/SessionManager.h index 4ac9e488cbc..a1403b0cfba 100644 --- a/cpp/src/IceGrid/SessionManager.h +++ b/cpp/src/IceGrid/SessionManager.h @@ -90,7 +90,6 @@ public: } notifyAll(); - // // Wait if there's nothing to do and if we are // connected or if we've just tried to connect. @@ -99,9 +98,10 @@ public: { if(_state == Connected || (action == Connect || action == KeepAlive)) { + IceUtil::Time wakeTime = IceUtil::Time::now() + timeout; while(_state != Destroyed && _nextAction == None) { - if(!timedWait(timeout)) + if(!timedWait(wakeTime - IceUtil::Time::now())) { break; } @@ -219,6 +219,10 @@ public: terminate(bool destroySession = true) { Lock sync(*this); + if(_state == Destroyed) + { + return; + } assert(_state != Destroyed); _state = Destroyed; _nextAction = destroySession ? Disconnect : None; |