diff options
author | Marc Laukien <marc@zeroc.com> | 2004-01-23 17:07:18 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2004-01-23 17:07:18 +0000 |
commit | 19f638094baa01b7a776cad39345aef167ff7f3e (patch) | |
tree | 818afb5e0101c0b1dd10c693d5fe20081f5118f1 /cpp/src/Ice/Outgoing.cpp | |
parent | for Matthew (diff) | |
download | ice-19f638094baa01b7a776cad39345aef167ff7f3e.tar.bz2 ice-19f638094baa01b7a776cad39345aef167ff7f3e.tar.xz ice-19f638094baa01b7a776cad39345aef167ff7f3e.zip |
added sendMutex
Diffstat (limited to 'cpp/src/Ice/Outgoing.cpp')
-rw-r--r-- | cpp/src/Ice/Outgoing.cpp | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp index 32b58a3165d..a173671e6f9 100644 --- a/cpp/src/Ice/Outgoing.cpp +++ b/cpp/src/Ice/Outgoing.cpp @@ -103,13 +103,33 @@ IceInternal::Outgoing::invoke() { case Reference::ModeTwoway: { + try + { + _connection->sendRequest(this, false); + } + catch(const LocalException&) + { + // + // Twoway requests report exceptions using finished(). + // + assert(false); + } + auto_ptr<LocalException> exception; { IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); - - _connection->sendRequest(this, false); - _state = StateInProgress; + + // + // It's possible that the request has already + // completed, due to a regular response, or because of + // an exception. So we only change the state to "in + // progress" if it is still "unsent". + // + if(_state == StateUnsent) + { + _state = StateInProgress; + } Int timeout = _connection->timeout(); while(_state == StateInProgress) @@ -227,11 +247,13 @@ IceInternal::Outgoing::finished(BasicStream& is) { IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); + assert(_reference->mode == Reference::ModeTwoway); // Can only be called for twoways. + // // The state might be StateLocalException if there was a timeout // in invoke(). // - if(_state == StateInProgress) + if(_state <= StateInProgress) { _is.swap(is); Byte status; @@ -376,11 +398,13 @@ IceInternal::Outgoing::finished(const LocalException& ex) { IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); + assert(_reference->mode == Reference::ModeTwoway); // Can only be called for twoways. + // // The state might be StateLocalException if there was a timeout // in invoke(). // - if(_state == StateInProgress) + if(_state <= StateInProgress) { _state = StateLocalException; _exception = auto_ptr<LocalException>(dynamic_cast<LocalException*>(ex.ice_clone())); |