summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/OutgoingAsync.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Ice/OutgoingAsync.cpp')
-rw-r--r--cpp/src/Ice/OutgoingAsync.cpp37
1 files changed, 30 insertions, 7 deletions
diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp
index e019e9e4949..6f96ed33a8e 100644
--- a/cpp/src/Ice/OutgoingAsync.cpp
+++ b/cpp/src/Ice/OutgoingAsync.cpp
@@ -286,6 +286,8 @@ Ice::AsyncResult::__exception(const Ice::Exception& ex)
__warning();
}
}
+
+ _observer.detach();
}
void
@@ -326,6 +328,8 @@ Ice::AsyncResult::__response()
__warning();
}
}
+
+ _observer.detach();
}
void
@@ -425,6 +429,8 @@ IceInternal::OutgoingAsync::__prepare(const std::string& operation, OperationMod
_mode = mode;
_sentSynchronously = false;
+ _observer.attach(_proxy.get(), operation, context);
+
//
// Can't call async via a batch proxy.
//
@@ -498,6 +504,10 @@ IceInternal::OutgoingAsync::__sent(Ice::ConnectionI* connection)
{
if(!_proxy->ice_isTwoway())
{
+ if(!_callback || !_callback->__hasSentCallback())
+ {
+ _observer.detach();
+ }
_state |= Done | OK;
}
else if(connection->timeout() > 0)
@@ -516,6 +526,10 @@ void
IceInternal::OutgoingAsync::__sent()
{
::Ice::AsyncResult::__sent();
+ if(!_proxy->ice_isTwoway())
+ {
+ _observer.detach();
+ }
}
void
@@ -783,11 +797,11 @@ IceInternal::OutgoingAsync::handleException(const LocalExceptionWrapper& ex)
{
if(_mode == Nonmutating || _mode == Idempotent)
{
- return _proxy->__handleExceptionWrapperRelaxed(_delegate, ex, false, _cnt);
+ return _proxy->__handleExceptionWrapperRelaxed(_delegate, ex, false, _cnt, _observer);
}
else
{
- return _proxy->__handleExceptionWrapper(_delegate, ex);
+ return _proxy->__handleExceptionWrapper(_delegate, ex, _observer);
}
}
@@ -824,16 +838,16 @@ IceInternal::OutgoingAsync::handleException(const Ice::LocalException& exc, bool
{
if(_mode == Nonmutating || _mode == Idempotent)
{
- return _proxy->__handleExceptionWrapperRelaxed(_delegate, ex, false, _cnt);
+ return _proxy->__handleExceptionWrapperRelaxed(_delegate, ex, false, _cnt, _observer);
}
else
{
- return _proxy->__handleExceptionWrapper(_delegate, ex);
+ return _proxy->__handleExceptionWrapper(_delegate, ex, _observer);
}
}
catch(const Ice::LocalException& ex)
{
- return _proxy->__handleException(_delegate, ex, false, _cnt);
+ return _proxy->__handleException(_delegate, ex, false, _cnt, _observer);
}
return 0; // Keep the compiler happy.
}
@@ -870,7 +884,15 @@ IceInternal::BatchOutgoingAsync::__sent(Ice::ConnectionI* connection)
assert(!_exception.get());
_state |= Done | OK | Sent;
_monitor.notifyAll();
- return _callback && _callback->__hasSentCallback();
+ if(_callback && _callback->__hasSentCallback())
+ {
+ return true;
+ }
+ else
+ {
+ _observer.detach();
+ return false;
+ }
}
void
@@ -892,6 +914,7 @@ IceInternal::ProxyBatchOutgoingAsync::ProxyBatchOutgoingAsync(const Ice::ObjectP
BatchOutgoingAsync(proxy->ice_getCommunicator(), proxy->__reference()->getInstance(), operation, delegate, cookie),
_proxy(proxy)
{
+ _observer.attach(proxy.get(), operation, 0);
}
void
@@ -918,7 +941,7 @@ IceInternal::ProxyBatchOutgoingAsync::__send()
}
catch(const ::Ice::LocalException& ex)
{
- _proxy->__handleException(delegate, ex, 0, cnt);
+ _proxy->__handleException(delegate, ex, 0, cnt, _observer);
}
}