summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/OutgoingAsync.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2014-10-15 17:26:45 +0200
committerBenoit Foucher <benoit@zeroc.com>2014-10-15 17:26:45 +0200
commitf94eb5f938d33dc2ce9b09b03b5dc6ccf7bd46c2 (patch)
tree6b12ef2c59421702743048393f4757c0d1e0c504 /cpp/src/Ice/OutgoingAsync.cpp
parentICE-5732 missing tracing in throughput demo (diff)
downloadice-f94eb5f938d33dc2ce9b09b03b5dc6ccf7bd46c2.tar.bz2
ice-f94eb5f938d33dc2ce9b09b03b5dc6ccf7bd46c2.tar.xz
ice-f94eb5f938d33dc2ce9b09b03b5dc6ccf7bd46c2.zip
Fixed ICE-5666: setting the invocation timeout to -2 provides the previous connection timeouts
Diffstat (limited to 'cpp/src/Ice/OutgoingAsync.cpp')
-rw-r--r--cpp/src/Ice/OutgoingAsync.cpp36
1 files changed, 28 insertions, 8 deletions
diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp
index c2c443f2184..fca1013252e 100644
--- a/cpp/src/Ice/OutgoingAsync.cpp
+++ b/cpp/src/Ice/OutgoingAsync.cpp
@@ -86,6 +86,12 @@ ProxyOutgoingAsyncBase::completed(const Exception& exc)
_childObserver.detach();
}
+ _cachedConnection = 0;
+ if(_proxy->__reference()->getInvocationTimeout() == -2)
+ {
+ _instance->timer()->cancel(this);
+ }
+
//
// NOTE: at this point, synchronization isn't needed, no other threads should be
// calling on the callback.
@@ -101,6 +107,21 @@ ProxyOutgoingAsyncBase::completed(const Exception& exc)
}
}
+
+void
+ProxyOutgoingAsyncBase::cancelable(const CancellationHandlerPtr& handler)
+{
+ if(_proxy->__reference()->getInvocationTimeout() == -2 && _cachedConnection)
+ {
+ const int timeout = _cachedConnection->timeout();
+ if(timeout > 0)
+ {
+ _instance->timer()->schedule(this, IceUtil::Time::milliSeconds(timeout));
+ }
+ }
+ AsyncResult::cancelable(handler);
+}
+
void
ProxyOutgoingAsyncBase::retry()
{
@@ -154,7 +175,6 @@ ProxyOutgoingAsyncBase::invokeImpl(bool userThread)
}
else
{
- checkCanceled(); // Cancellation exception aren't retriable
_observer.retried();
}
@@ -204,7 +224,6 @@ ProxyOutgoingAsyncBase::invokeImpl(bool userThread)
}
else
{
- checkCanceled(); // Cancellation exception aren't retriable
_observer.retried();
}
}
@@ -233,7 +252,7 @@ ProxyOutgoingAsyncBase::sent(bool done)
_sent = true;
if(done)
{
- if(_proxy->__reference()->getInvocationTimeout() > 0)
+ if(_proxy->__reference()->getInvocationTimeout() != -1)
{
_instance->timer()->cancel(this);
}
@@ -244,7 +263,7 @@ ProxyOutgoingAsyncBase::sent(bool done)
bool
ProxyOutgoingAsyncBase::finished(const Exception& ex)
{
- if(_proxy->__reference()->getInvocationTimeout() > 0)
+ if(_proxy->__reference()->getInvocationTimeout() != -1)
{
_instance->timer()->cancel(this);
}
@@ -254,7 +273,7 @@ ProxyOutgoingAsyncBase::finished(const Exception& ex)
bool
ProxyOutgoingAsyncBase::finished(bool ok)
{
- if(_proxy->__reference()->getInvocationTimeout() > 0)
+ if(_proxy->__reference()->getInvocationTimeout() != -1)
{
_instance->timer()->cancel(this);
}
@@ -276,12 +295,13 @@ ProxyOutgoingAsyncBase::handleException(const Exception& exc)
void
ProxyOutgoingAsyncBase::runTimerTask()
{
- try
+ if(_proxy->__reference()->getInvocationTimeout() == -2)
{
- cancel(InvocationTimeoutException(__FILE__, __LINE__));
+ cancel(ConnectionTimeoutException(__FILE__, __LINE__));
}
- catch(const CommunicatorDestroyedException&)
+ else
{
+ cancel(InvocationTimeoutException(__FILE__, __LINE__));
}
}