summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2005-02-18 14:09:13 +0000
committerMarc Laukien <marc@zeroc.com>2005-02-18 14:09:13 +0000
commit4b23a68e40999265b756ec6a58c5584a2ab6c039 (patch)
tree7c2a5009bd53c764c4028a73c8c94808b899958d /cpp/src
parentglacier fix (diff)
downloadice-4b23a68e40999265b756ec6a58c5584a2ab6c039.tar.bz2
ice-4b23a68e40999265b756ec6a58c5584a2ab6c039.tar.xz
ice-4b23a68e40999265b756ec6a58c5584a2ab6c039.zip
isDestroyed fix
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/ConnectionI.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp
index 63d5c26e46a..6a7aa084043 100644
--- a/cpp/src/Ice/ConnectionI.cpp
+++ b/cpp/src/Ice/ConnectionI.cpp
@@ -234,6 +234,7 @@ void
Ice::ConnectionI::close(bool force)
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
if(force)
{
setState(StateClosed, ForcedCloseConnectionException(__FILE__, __LINE__));
@@ -247,12 +248,12 @@ Ice::ConnectionI::close(bool force)
bool
Ice::ConnectionI::isDestroyed() const
{
- IceUtil::Monitor<IceUtil::Mutex>::TryLock sync(*this);
-
- if(!sync.acquired())
- {
- return false;
- }
+ //
+ // We can not use trylock here, otherwise the outgoing connection
+ // factory might return destroyed (closing or closed) connections,
+ // resulting in connection retry exhaustion.
+ //
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
return _state >= StateClosing;
}
@@ -263,6 +264,11 @@ Ice::ConnectionI::isFinished() const
IceUtil::ThreadPtr threadPerConnection;
{
+ //
+ // We can use trylock here, because as long as there are still
+ // threads operating in this connection object, connection
+ // destruction is considered as not yet finished.
+ //
IceUtil::Monitor<IceUtil::Mutex>::TryLock sync(*this);
if(!sync.acquired())