summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/Connection.cpp
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2002-07-02 14:38:23 +0000
committerMarc Laukien <marc@zeroc.com>2002-07-02 14:38:23 +0000
commit6faa657bf74b2e522fa1a0fc61ad4d0932873816 (patch)
tree53d85fffb1752d50d852b1ffe12325b36f71d011 /cpp/src/Ice/Connection.cpp
parentAdded a test case for escaped keyword identifier. (diff)
downloadice-6faa657bf74b2e522fa1a0fc61ad4d0932873816.tar.bz2
ice-6faa657bf74b2e522fa1a0fc61ad4d0932873816.tar.xz
ice-6faa657bf74b2e522fa1a0fc61ad4d0932873816.zip
fixed connection verification bug
Diffstat (limited to 'cpp/src/Ice/Connection.cpp')
-rw-r--r--cpp/src/Ice/Connection.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/cpp/src/Ice/Connection.cpp b/cpp/src/Ice/Connection.cpp
index 5b39e960feb..b06e7fa178e 100644
--- a/cpp/src/Ice/Connection.cpp
+++ b/cpp/src/Ice/Connection.cpp
@@ -425,10 +425,7 @@ IceInternal::Connection::message(BasicStream& stream, const ThreadPoolPtr& threa
// here. The connection gets implicitly validated by
// any kind of message. However, it's still a protocol
// error like any other if no explicit connection
- // validation message was sent first. Also, if I
- // wouldn't set _connecitonValidated to true here,
- // then the ConnectionValidatedException would be
- // translated int a CloseConnectionException.
+ // validation message was sent first.
//
_connectionValidated = true;
throw ConnectionNotValidatedException(__FILE__, __LINE__);
@@ -901,13 +898,27 @@ IceInternal::Connection::setState(State state, const LocalException& ex)
if(!_exception.get())
{
- if(_connectionValidated)
+ if(!_connectionValidated && dynamic_cast<const ConnectionLostException*>(&ex))
{
- _exception = auto_ptr<LocalException>(dynamic_cast<LocalException*>(ex.ice_clone()));
+ //
+ // If the connection has not been validated yet, we treat
+ // a connection loss just as if we would have received a
+ // close connection messsage. This way, Ice will retry a
+ // request if the peer just accepts and closes a
+ // connection. This can happen, for example, if a
+ // connection is in the server's backlog, but not yet
+ // accepted by the server. In such case, the connection
+ // has been established from the client point of view, but
+ // not yet from the server point of view. If the server
+ // then closes the acceptor socket, the client will get a
+ // connection loss without receiving an explicit close
+ // connection message first.
+ //
+ _exception = auto_ptr<LocalException>(new CloseConnectionException(__FILE__, __LINE__));
}
else
{
- _exception = auto_ptr<LocalException>(new CloseConnectionException(__FILE__, __LINE__));
+ _exception = auto_ptr<LocalException>(dynamic_cast<LocalException*>(ex.ice_clone()));
}
if(_warn)