summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/ConnectRequestHandler.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2014-11-13 17:03:17 +0100
committerBenoit Foucher <benoit@zeroc.com>2014-11-13 17:03:17 +0100
commit51b17058e914f1f05ae52cfb8e7c8114b9cbfd11 (patch)
tree5b61a01e1bd70a0ee1952f41b47915b3b15eb23c /cpp/src/Ice/ConnectRequestHandler.cpp
parentSome fixes to java demo builds and expect scripts (diff)
downloadice-51b17058e914f1f05ae52cfb8e7c8114b9cbfd11.tar.bz2
ice-51b17058e914f1f05ae52cfb8e7c8114b9cbfd11.tar.xz
ice-51b17058e914f1f05ae52cfb8e7c8114b9cbfd11.zip
Fixed ICE-5888: bug with datagram limit exception causing some datagrams to be lost
Diffstat (limited to 'cpp/src/Ice/ConnectRequestHandler.cpp')
-rw-r--r--cpp/src/Ice/ConnectRequestHandler.cpp72
1 files changed, 44 insertions, 28 deletions
diff --git a/cpp/src/Ice/ConnectRequestHandler.cpp b/cpp/src/Ice/ConnectRequestHandler.cpp
index 73da7bbae43..8c3b37d0cb5 100644
--- a/cpp/src/Ice/ConnectRequestHandler.cpp
+++ b/cpp/src/Ice/ConnectRequestHandler.cpp
@@ -336,21 +336,6 @@ ConnectRequestHandler::setException(const Ice::LocalException& ex)
_proxies.clear();
_proxy = 0; // Break cyclic reference count.
- //
- // NOTE: remove the request handler *before* notifying the
- // requests that the connection failed. It's important to ensure
- // that future invocations will obtain a new connect request
- // handler once invocations are notified.
- //
- try
- {
- _reference->getInstance()->requestHandlerFactory()->removeRequestHandler(_reference, this);
- }
- catch(const Ice::CommunicatorDestroyedException&)
- {
- // Ignore
- }
-
flushRequestsWithException();
notifyAll();
}
@@ -421,13 +406,30 @@ ConnectRequestHandler::flushRequests()
Request& req = _requests.front();
if(req.out)
{
- req.out->send(_connection, _compress, _response);
+ try
+ {
+ req.out->send(_connection, _compress, _response);
+ }
+ catch(const Ice::DatagramLimitException& ex)
+ {
+ req.out->completed(ex);
+ }
}
else if(req.outAsync)
{
- if(req.outAsync->send(_connection, _compress, _response) & AsyncStatusInvokeSentCallback)
+ try
{
- req.outAsync->invokeSentAsync();
+ if(req.outAsync->send(_connection, _compress, _response) & AsyncStatusInvokeSentCallback)
+ {
+ req.outAsync->invokeSentAsync();
+ }
+ }
+ catch(const Ice::DatagramLimitException& ex)
+ {
+ if(req.outAsync->completed(ex))
+ {
+ req.outAsync->invokeCompletedAsync();
+ }
}
}
else
@@ -446,6 +448,7 @@ ConnectRequestHandler::flushRequests()
_connection->abortBatchRequest();
throw;
}
+
_connection->finishBatchRequest(&os, _compress);
delete req.os;
}
@@ -496,17 +499,15 @@ ConnectRequestHandler::flushRequests()
{
_initialized = true;
_flushing = false;
+ try
+ {
+ _reference->getInstance()->requestHandlerFactory()->removeRequestHandler(_reference, this);
+ }
+ catch(const Ice::CommunicatorDestroyedException&)
+ {
+ // Ignore
+ }
}
-
- try
- {
- _reference->getInstance()->requestHandlerFactory()->removeRequestHandler(_reference, this);
- }
- catch(const Ice::CommunicatorDestroyedException&)
- {
- // Ignore
- }
-
_proxies.clear();
_proxy = 0; // Break cyclic reference count.
notifyAll();
@@ -518,6 +519,21 @@ ConnectRequestHandler::flushRequestsWithException()
{
assert(_exception.get());
+ //
+ // NOTE: remove the request handler *before* notifying the
+ // requests that the connection failed. It's important to ensure
+ // that future invocations will obtain a new connect request
+ // handler once invocations are notified.
+ //
+ try
+ {
+ _reference->getInstance()->requestHandlerFactory()->removeRequestHandler(_reference, this);
+ }
+ catch(const Ice::CommunicatorDestroyedException&)
+ {
+ // Ignore
+ }
+
for(deque<Request>::const_iterator p = _requests.begin(); p != _requests.end(); ++p)
{
if(p->out)