diff options
author | Marc Laukien <marc@zeroc.com> | 2003-02-06 20:39:02 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2003-02-06 20:39:02 +0000 |
commit | 8c47a19fe0a38c6c9a6e97b7859df7f9b5a8b6fb (patch) | |
tree | 8fd580420dad30c88fc38c5e8940b9e68ffed297 /cpp | |
parent | do not use Ice version in service shared library name (diff) | |
download | ice-8c47a19fe0a38c6c9a6e97b7859df7f9b5a8b6fb.tar.bz2 ice-8c47a19fe0a38c6c9a6e97b7859df7f9b5a8b6fb.tar.xz ice-8c47a19fe0a38c6c9a6e97b7859df7f9b5a8b6fb.zip |
encaps fixes
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/include/Ice/BasicStream.h | 1 | ||||
-rw-r--r-- | cpp/include/Ice/Incoming.h | 2 | ||||
-rw-r--r-- | cpp/src/Ice/BasicStream.cpp | 15 | ||||
-rw-r--r-- | cpp/src/Ice/Incoming.cpp | 25 | ||||
-rw-r--r-- | cpp/src/Ice/IncomingAsync.cpp | 8 | ||||
-rw-r--r-- | cpp/src/Ice/Outgoing.cpp | 23 | ||||
-rw-r--r-- | cpp/src/Ice/OutgoingAsync.cpp | 3 | ||||
-rw-r--r-- | cpp/test/Ice/exceptions/AllTests.cpp | 3 |
8 files changed, 42 insertions, 38 deletions
diff --git a/cpp/include/Ice/BasicStream.h b/cpp/include/Ice/BasicStream.h index 26d294e8d95..32f5a3b9e6b 100644 --- a/cpp/include/Ice/BasicStream.h +++ b/cpp/include/Ice/BasicStream.h @@ -52,6 +52,7 @@ public: void endWriteEncaps(); void startReadEncaps(); void endReadEncaps(); + void skipReadEncaps(); void checkReadEncaps(); Ice::Int getReadEncapsSize(); void skipEncaps(); diff --git a/cpp/include/Ice/Incoming.h b/cpp/include/Ice/Incoming.h index 19b19c6f5ab..31e465d9cb7 100644 --- a/cpp/include/Ice/Incoming.h +++ b/cpp/include/Ice/Incoming.h @@ -32,7 +32,7 @@ protected: IncomingBase(Instance*, Connection*, const Ice::ObjectAdapterPtr&, bool); IncomingBase(IncomingBase& in); // Adopts the argument. It must not be used afterwards. - void __finishInvoke(); + void __finishInvoke(bool); void __warning(const Ice::Exception&) const; void __warning(const std::string&) const; diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp index 305a43d33a5..d564ab96994 100644 --- a/cpp/src/Ice/BasicStream.cpp +++ b/cpp/src/Ice/BasicStream.cpp @@ -141,6 +141,21 @@ IceInternal::BasicStream::startReadEncaps() void IceInternal::BasicStream::endReadEncaps() { + checkReadEncaps(); + _readEncapsStack.pop_back(); + if(_readEncapsStack.empty()) + { + _currentReadEncaps = 0; + } + else + { + _currentReadEncaps = &_readEncapsStack.back(); + } +} + +void +IceInternal::BasicStream::skipReadEncaps() +{ assert(_currentReadEncaps); int start = _currentReadEncaps->start; _readEncapsStack.pop_back(); diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp index 575901c0a94..37f23a5a9a7 100644 --- a/cpp/src/Ice/Incoming.cpp +++ b/cpp/src/Ice/Incoming.cpp @@ -56,14 +56,21 @@ IceInternal::IncomingBase::IncomingBase(IncomingBase& in) : } void -IceInternal::IncomingBase::__finishInvoke() +IceInternal::IncomingBase::__finishInvoke(bool success) { if(_locator && _servant) { _locator->finished(_current, _servant, _cookie); } - _is.endReadEncaps(); + if(success) + { + _is.endReadEncaps(); + } + else + { + _is.skipReadEncaps(); + } // // Send a response if necessary. If we don't need to send a @@ -265,7 +272,7 @@ IceInternal::Incoming::invoke(const ServantManagerPtr& servantManager) _os.write(ex.operation); } - __finishInvoke(); + __finishInvoke(false); return; } catch(const LocalException& ex) @@ -282,7 +289,7 @@ IceInternal::Incoming::invoke(const ServantManagerPtr& servantManager) _os.write(str.str()); } - __finishInvoke(); + __finishInvoke(false); return; } catch(const UserException& ex) @@ -299,7 +306,7 @@ IceInternal::Incoming::invoke(const ServantManagerPtr& servantManager) _os.write(str.str()); } - __finishInvoke(); + __finishInvoke(false); return; } catch(const Exception& ex) @@ -316,7 +323,7 @@ IceInternal::Incoming::invoke(const ServantManagerPtr& servantManager) _os.write(str.str()); } - __finishInvoke(); + __finishInvoke(false); return; } catch(const std::exception& ex) @@ -333,7 +340,7 @@ IceInternal::Incoming::invoke(const ServantManagerPtr& servantManager) _os.write(str.str()); } - __finishInvoke(); + __finishInvoke(false); return; } catch(...) @@ -349,7 +356,7 @@ IceInternal::Incoming::invoke(const ServantManagerPtr& servantManager) _os.write(reason); } - __finishInvoke(); + __finishInvoke(false); return; } @@ -382,5 +389,5 @@ IceInternal::Incoming::invoke(const ServantManagerPtr& servantManager) } } - __finishInvoke(); + __finishInvoke(status == DispatchOK || status == DispatchUserException); } diff --git a/cpp/src/Ice/IncomingAsync.cpp b/cpp/src/Ice/IncomingAsync.cpp index c0499e93fe0..b9d34f7aa1e 100644 --- a/cpp/src/Ice/IncomingAsync.cpp +++ b/cpp/src/Ice/IncomingAsync.cpp @@ -53,7 +53,7 @@ IceInternal::IncomingAsync::__response(bool ok) } } - __finishInvoke(); + __finishInvoke(true); } void @@ -150,7 +150,7 @@ IceInternal::IncomingAsync::__exception(const Exception& exc) } } - __finishInvoke(); + __finishInvoke(false); } void @@ -166,7 +166,7 @@ IceInternal::IncomingAsync::__exception(const std::exception& ex) _os.write(str.str()); } - __finishInvoke(); + __finishInvoke(false); } void @@ -181,7 +181,7 @@ IceInternal::IncomingAsync::__exception() _os.write(reason); } - __finishInvoke(); + __finishInvoke(false); } IceAsync::Ice::AMD_Object_ice_invoke::AMD_Object_ice_invoke(Incoming& in) : diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp index 6b6dde0fc4d..e886bc28627 100644 --- a/cpp/src/Ice/Outgoing.cpp +++ b/cpp/src/Ice/Outgoing.cpp @@ -200,29 +200,6 @@ IceInternal::Outgoing::invoke() return true; } -/* -void -IceInternal::Outgoing::invokeAsync(const IceAMI::Ice::ObjectPtr& asyncCB) -{ - _asyncCB = asyncCB; - _os.endWriteEncaps(); - - // - // We cannot set _state to StateInProgress after sendRequest(), - // because there would be a race with finished(). - // - _state = StateInProgress; - - // - // For asynchronous invocations, we always use twoway, regardless - // of what the reference says. There is no point in asynchronous - // oneways or datagrams, because there is no reply from the - // server. - // - _connection->sendRequest(this, false, _reference->compress); -} -*/ - void IceInternal::Outgoing::finished(BasicStream& is) { diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp index 33d6a544b98..bb81b58f445 100644 --- a/cpp/src/Ice/OutgoingAsync.cpp +++ b/cpp/src/Ice/OutgoingAsync.cpp @@ -79,7 +79,10 @@ IceInternal::OutgoingAsync::__setup(const ConnectionPtr& connection, const Refer void IceInternal::OutgoingAsync::__invoke() { + _os->endWriteEncaps(); + _connection->sendAsyncRequest(this); + if(_connection->timeout() >= 0) { _absoluteTimeout = IceUtil::Time::now() + IceUtil::Time::milliSeconds(_connection->timeout()); diff --git a/cpp/test/Ice/exceptions/AllTests.cpp b/cpp/test/Ice/exceptions/AllTests.cpp index b98d65f95dd..e954f900e66 100644 --- a/cpp/test/Ice/exceptions/AllTests.cpp +++ b/cpp/test/Ice/exceptions/AllTests.cpp @@ -1125,7 +1125,8 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated) try { ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower->ice_newIdentity(id)); - thrower2->ice_ping(); + thrower2->throwAasA(1); +// thrower2->ice_ping(); test(false); } catch(const Ice::ObjectNotExistException& ex) |