summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/Connection.cpp28
-rw-r--r--cpp/src/Ice/Connection.h9
2 files changed, 33 insertions, 4 deletions
diff --git a/cpp/src/Ice/Connection.cpp b/cpp/src/Ice/Connection.cpp
index 39963b7b912..d83b9ddc343 100644
--- a/cpp/src/Ice/Connection.cpp
+++ b/cpp/src/Ice/Connection.cpp
@@ -54,6 +54,27 @@ IceInternal::Connection::~Connection()
assert(_state == StateClosed);
}
+void
+IceInternal::Connection::destroy(DestructionReason reason)
+{
+ JTCSyncT<JTCRecursiveMutex> sync(*this);
+
+ switch (reason)
+ {
+ case ObjectAdapterDeactivated:
+ {
+ setState(StateClosing, ObjectAdapterDeactivatedException(__FILE__, __LINE__));
+ break;
+ }
+
+ case CommunicatorDestroyed:
+ {
+ setState(StateClosing, CommunicatorDestroyedException(__FILE__, __LINE__));
+ break;
+ }
+ }
+}
+
bool
IceInternal::Connection::destroyed() const
{
@@ -416,7 +437,7 @@ IceInternal::Connection::message(BasicStream& stream)
{
in.invoke();
}
- catch (const LocalException& ex)
+ catch (const Exception& ex)
{
JTCSyncT<JTCRecursiveMutex> sync(*this);
warning(ex);
@@ -535,7 +556,8 @@ IceInternal::Connection::setState(State state, const LocalException& ex)
//
if (!dynamic_cast<const CloseConnectionException*>(&ex) &&
!dynamic_cast<const CommunicatorDestroyedException*>(&ex) &&
- !dynamic_cast<const ObjectAdapterDeactivatedException*>(&ex))
+ !dynamic_cast<const ObjectAdapterDeactivatedException*>(&ex) &&
+ !(dynamic_cast<const ConnectionLostException*>(&ex) && _state == StateClosing));
{
warning(ex);
}
@@ -642,7 +664,7 @@ IceInternal::Connection::closeConnection()
}
void
-IceInternal::Connection::warning(const LocalException& ex) const
+IceInternal::Connection::warning(const Exception& ex) const
{
if (_warn)
{
diff --git a/cpp/src/Ice/Connection.h b/cpp/src/Ice/Connection.h
index aa498f70b6b..c03f824f136 100644
--- a/cpp/src/Ice/Connection.h
+++ b/cpp/src/Ice/Connection.h
@@ -40,6 +40,13 @@ public:
Connection(const InstancePtr&, const TransceiverPtr&, const EndpointPtr&, const ::Ice::ObjectAdapterPtr&);
virtual ~Connection();
+ enum DestructionReason
+ {
+ ObjectAdapterDeactivated,
+ CommunicatorDestroyed
+ };
+
+ void destroy(DestructionReason);
bool destroyed() const;
void hold();
void activate();
@@ -75,7 +82,7 @@ private:
void setState(State, const ::Ice::LocalException&);
void setState(State);
void closeConnection();
- void warning(const ::Ice::LocalException&) const;
+ void warning(const ::Ice::Exception&) const;
TransceiverPtr _transceiver;
EndpointPtr _endpoint;