summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2003-03-23 18:29:59 +0000
committerMarc Laukien <marc@zeroc.com>2003-03-23 18:29:59 +0000
commitfe91778f28a3f7680117d8791b9418f7d342fe57 (patch)
tree9e5316498c2125206b02650385335f69f4a2e69f /cpp/src
parentshutdown fix (diff)
downloadice-fe91778f28a3f7680117d8791b9418f7d342fe57.tar.bz2
ice-fe91778f28a3f7680117d8791b9418f7d342fe57.tar.xz
ice-fe91778f28a3f7680117d8791b9418f7d342fe57.zip
close timeout
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/Connection.cpp8
-rw-r--r--cpp/src/Ice/Connection.h2
-rw-r--r--cpp/src/Ice/ConnectionFactory.cpp4
-rw-r--r--cpp/src/Ice/Exception.cpp7
4 files changed, 16 insertions, 5 deletions
diff --git a/cpp/src/Ice/Connection.cpp b/cpp/src/Ice/Connection.cpp
index 1e8d9020fd9..21a74876acd 100644
--- a/cpp/src/Ice/Connection.cpp
+++ b/cpp/src/Ice/Connection.cpp
@@ -99,13 +99,17 @@ IceInternal::Connection::waitUntilHolding() const
}
void
-IceInternal::Connection::waitUntilFinished() const
+IceInternal::Connection::waitUntilFinished()
{
IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
while(_transceiver || _dispatchCount > 0)
{
- wait();
+ if(timedWait(IceUtil::Time::milliSeconds(_endpoint->timeout())))
+ {
+ setState(StateClosed, CloseTimeoutException(__FILE__, __LINE__));
+ // No return here, we must still wait until _transceiver becomes null.
+ }
}
assert(_state == StateClosed);
diff --git a/cpp/src/Ice/Connection.h b/cpp/src/Ice/Connection.h
index 4113e94fde5..7f40ca01410 100644
--- a/cpp/src/Ice/Connection.h
+++ b/cpp/src/Ice/Connection.h
@@ -59,7 +59,7 @@ public:
bool isFinished() const;
void waitUntilHolding() const;
- void waitUntilFinished() const;
+ void waitUntilFinished(); // Not const, as this might close the connection upon timeout.
void monitor();
diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp
index 833fb06bf57..1369246940d 100644
--- a/cpp/src/Ice/ConnectionFactory.cpp
+++ b/cpp/src/Ice/ConnectionFactory.cpp
@@ -83,7 +83,7 @@ IceInternal::OutgoingConnectionFactory::waitUntilFinished()
// finished.
//
for_each(_connections.begin(), _connections.end(),
- Ice::secondConstVoidMemFun<EndpointPtr, Connection>(&Connection::waitUntilFinished));
+ Ice::secondVoidMemFun<EndpointPtr, Connection>(&Connection::waitUntilFinished));
//
// We're done, now we can throw away all connections.
@@ -451,7 +451,7 @@ IceInternal::IncomingConnectionFactory::waitUntilFinished()
// Now we wait until the destruction of each connection has
// finished.
//
- for_each(_connections.begin(), _connections.end(), Ice::constVoidMemFun(&Connection::waitUntilFinished));
+ for_each(_connections.begin(), _connections.end(), Ice::voidMemFun(&Connection::waitUntilFinished));
//
// We're done, now we can throw away all connections.
diff --git a/cpp/src/Ice/Exception.cpp b/cpp/src/Ice/Exception.cpp
index 2495a24137e..b0d81058937 100644
--- a/cpp/src/Ice/Exception.cpp
+++ b/cpp/src/Ice/Exception.cpp
@@ -244,6 +244,13 @@ Ice::ConnectTimeoutException::ice_print(ostream& out) const
}
void
+Ice::CloseTimeoutException::ice_print(ostream& out) const
+{
+ Exception::ice_print(out);
+ out << ":\ntimeout while closing a connection";
+}
+
+void
Ice::ConnectionTimeoutException::ice_print(ostream& out) const
{
Exception::ice_print(out);