summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/Connection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Ice/Connection.cpp')
-rw-r--r--cpp/src/Ice/Connection.cpp44
1 files changed, 28 insertions, 16 deletions
diff --git a/cpp/src/Ice/Connection.cpp b/cpp/src/Ice/Connection.cpp
index cfb84752654..f80cdc8ac67 100644
--- a/cpp/src/Ice/Connection.cpp
+++ b/cpp/src/Ice/Connection.cpp
@@ -102,17 +102,23 @@ IceInternal::Connection::validate()
is.read(pMinor);
//
- // We only check the major version number here. The minor version
- // number is irrelevant -- no matter what minor version number is offered
- // by the server, we can be certain that the server supports at least minor version 0.
- // As the client, we are obliged to never produce a message with a minor
- // version number that is larger than what the server can understand, but we don't
- // care if the server understands more than we do.
+ // We only check the major version number here. The
+ // minor version number is irrelevant -- no matter
+ // what minor version number is offered by the server,
+ // we can be certain that the server supports at least
+ // minor version 0. As the client, we are obliged to
+ // never produce a message with a minor version number
+ // that is larger than what the server can understand,
+ // but we don't care if the server understands more
+ // than we do.
//
- // Note: Once we add minor versions, we need to modify the client side to never produce
- // a message with a minor number that is greater than what the server can handle. Similarly,
- // the server side will have to be modified so it never replies with a minor version that is
- // greater than what the client can handle.
+ // Note: Once we add minor versions, we need to modify
+ // the client side to never produce a message with a
+ // minor number that is greater than what the server
+ // can handle. Similarly, the server side will have to
+ // be modified so it never replies with a minor
+ // version that is greater than what the client can
+ // handle.
//
if(pMajor != protocolMajor)
{
@@ -130,8 +136,8 @@ IceInternal::Connection::validate()
is.read(eMinor);
//
- // The same applies here as above -- only the major version number
- // of the encoding is relevant.
+ // The same applies here as above -- only the major
+ // version number of the encoding is relevant.
//
if(eMajor != encodingMajor)
{
@@ -582,7 +588,8 @@ IceInternal::Connection::sendAsyncRequest(const OutgoingAsyncPtr& out)
//
// Only add to the request map if there was no exception.
//
- _asyncRequestsHint = _asyncRequests.insert(_asyncRequests.end(), pair<const Int, OutgoingAsyncPtr>(requestId, out));
+ _asyncRequestsHint = _asyncRequests.insert(_asyncRequests.end(),
+ pair<const Int, OutgoingAsyncPtr>(requestId, out));
if(_acmTimeout > 0)
{
@@ -1452,7 +1459,14 @@ IceInternal::Connection::setState(State state, const LocalException& ex)
}
}
}
-
+
+ //
+ // We must set the new state before we notify requests of any
+ // exceptions. Otherwise new requests may retry on a connection
+ // that is not yet marked as closed or closing.
+ //
+ setState(state);
+
for(map<Int, Outgoing*>::iterator p = _requests.begin(); p != _requests.end(); ++p)
{
p->second->finished(*_exception.get());
@@ -1466,8 +1480,6 @@ IceInternal::Connection::setState(State state, const LocalException& ex)
}
_asyncRequests.clear();
_asyncRequestsHint = _asyncRequests.end();
-
- setState(state);
}
void