summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/Outgoing.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/Outgoing.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/Outgoing.cpp')
-rw-r--r--cpp/src/Ice/Outgoing.cpp32
1 files changed, 28 insertions, 4 deletions
diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp
index 4815b9796fb..8e13a64dc45 100644
--- a/cpp/src/Ice/Outgoing.cpp
+++ b/cpp/src/Ice/Outgoing.cpp
@@ -208,12 +208,13 @@ Outgoing::invoke()
return true;
}
+ const int invocationTimeout = _proxy->__reference()->getInvocationTimeout();
int cnt = 0;
while(true)
{
try
{
- if(_invocationTimeoutDeadline != IceUtil::Time() && _invocationTimeoutDeadline <= IceUtil::Time::now())
+ if(invocationTimeout > 0 && _invocationTimeoutDeadline <= IceUtil::Time::now())
{
throw Ice::InvocationTimeoutException(__FILE__, __LINE__);
}
@@ -228,11 +229,27 @@ Outgoing::invoke()
{
return true;
}
+
+ if(invocationTimeout == -2) // Use the connection timeout
+ {
+ try
+ {
+ _invocationTimeoutDeadline = IceUtil::Time(); // Reset any previously set value
+
+ int timeout = _handler->waitForConnection()->timeout();
+ if(timeout > 0)
+ {
+ _invocationTimeoutDeadline = IceUtil::Time::now() + IceUtil::Time::milliSeconds(timeout);
+ }
+ }
+ catch(const Ice::LocalException&)
+ {
+ }
+ }
bool timedOut = false;
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor);
-
//
// If the handler says it's not finished, we wait until we're done.
//
@@ -262,7 +279,14 @@ Outgoing::invoke()
if(timedOut)
{
- _handler->requestCanceled(this, InvocationTimeoutException(__FILE__, __LINE__));
+ if(invocationTimeout == -2)
+ {
+ _handler->requestCanceled(this, ConnectionTimeoutException(__FILE__, __LINE__));
+ }
+ else
+ {
+ _handler->requestCanceled(this, InvocationTimeoutException(__FILE__, __LINE__));
+ }
//
// Wait for the exception to propagate. It's possible the request handler ignores
@@ -298,7 +322,7 @@ Outgoing::invoke()
interval = IceUtil::Time::milliSeconds(_proxy->__handleException(ex, _handler, _mode, _sent, cnt));
if(interval > IceUtil::Time())
{
- if(_invocationTimeoutDeadline != IceUtil::Time())
+ if(invocationTimeout > 0)
{
IceUtil::Time deadline = _invocationTimeoutDeadline - IceUtil::Time::now();
if(deadline < interval)