diff options
Diffstat (limited to 'cpp/src/Ice')
-rw-r--r-- | cpp/src/Ice/BatchRequestQueue.h | 4 | ||||
-rw-r--r-- | cpp/src/Ice/ConnectRequestHandler.cpp | 13 | ||||
-rw-r--r-- | cpp/src/Ice/ConnectRequestHandler.h | 4 | ||||
-rw-r--r-- | cpp/src/Ice/ConnectionI.cpp | 20 | ||||
-rw-r--r-- | cpp/src/Ice/ConnectionI.h | 4 | ||||
-rw-r--r-- | cpp/src/Ice/Exception.cpp | 26 | ||||
-rw-r--r-- | cpp/src/Ice/LocatorInfo.cpp | 22 | ||||
-rw-r--r-- | cpp/src/Ice/LocatorInfo.h | 4 | ||||
-rw-r--r-- | cpp/src/Ice/Outgoing.cpp | 11 | ||||
-rw-r--r-- | cpp/src/Ice/OutgoingAsync.cpp | 14 | ||||
-rw-r--r-- | cpp/src/Ice/Reference.cpp | 4 | ||||
-rw-r--r-- | cpp/src/Ice/RequestHandler.cpp | 25 | ||||
-rw-r--r-- | cpp/src/Ice/RequestHandler.h | 16 | ||||
-rw-r--r-- | cpp/src/Ice/RouterInfo.h | 2 | ||||
-rw-r--r-- | cpp/src/Ice/TcpTransceiver.cpp | 4 | ||||
-rw-r--r-- | cpp/src/Ice/TcpTransceiver.h | 5 | ||||
-rw-r--r-- | cpp/src/Ice/Transceiver.h | 5 | ||||
-rwxr-xr-x | cpp/src/Ice/UdpTransceiver.cpp | 4 | ||||
-rw-r--r-- | cpp/src/Ice/UdpTransceiver.h | 4 | ||||
-rw-r--r-- | cpp/src/Ice/WSTransceiver.cpp | 38 | ||||
-rw-r--r-- | cpp/src/Ice/WSTransceiver.h | 4 | ||||
-rw-r--r-- | cpp/src/Ice/ios/StreamTransceiver.cpp | 4 | ||||
-rw-r--r-- | cpp/src/Ice/ios/StreamTransceiver.h | 4 |
23 files changed, 37 insertions, 204 deletions
diff --git a/cpp/src/Ice/BatchRequestQueue.h b/cpp/src/Ice/BatchRequestQueue.h index c7e30c6bd65..c8cb3090e7a 100644 --- a/cpp/src/Ice/BatchRequestQueue.h +++ b/cpp/src/Ice/BatchRequestQueue.h @@ -54,11 +54,7 @@ private: bool _batchStreamCanFlush; int _batchRequestNum; size_t _batchMarker; -#ifdef ICE_CPP11_MAPPING - std::exception_ptr _exception; -#else IceUtil::UniquePtr<Ice::LocalException> _exception; -#endif size_t _maxSize; }; diff --git a/cpp/src/Ice/ConnectRequestHandler.cpp b/cpp/src/Ice/ConnectRequestHandler.cpp index ee1ed2376a6..dcfd582fde3 100644 --- a/cpp/src/Ice/ConnectRequestHandler.cpp +++ b/cpp/src/Ice/ConnectRequestHandler.cpp @@ -166,11 +166,7 @@ ConnectRequestHandler::waitForConnection() Lock sync(*this); if(ICE_EXCEPTION_ISSET(_exception)) { -#ifdef ICE_CPP11_MAPPING - throw RetryException(_exception); -#else throw RetryException(*_exception.get()); -#endif } // // Wait for the connection establishment to complete or fail. @@ -332,7 +328,7 @@ ConnectRequestHandler::flushRequests() } #ifdef ICE_CPP11_MAPPING - std::exception_ptr exception; + std::unique_ptr<Ice::LocalException> exception; #else IceUtil::UniquePtr<Ice::LocalException> exception; #endif @@ -352,11 +348,8 @@ ConnectRequestHandler::flushRequests() } catch(const RetryException& ex) { -#ifdef ICE_CPP11_MAPPING - exception = ex.get(); -#else - exception.reset(ex.get()->ice_clone()); -#endif + ICE_RESET_EXCEPTION(exception, ex.get()->ice_clone()); + try { ICE_RETHROW_EXCEPTION(exception); diff --git a/cpp/src/Ice/ConnectRequestHandler.h b/cpp/src/Ice/ConnectRequestHandler.h index 771d682ac7a..222021469f1 100644 --- a/cpp/src/Ice/ConnectRequestHandler.h +++ b/cpp/src/Ice/ConnectRequestHandler.h @@ -75,11 +75,7 @@ private: Ice::ConnectionIPtr _connection; bool _compress; -#ifdef ICE_CPP11_MAPPING - std::exception_ptr _exception; -#else IceUtil::UniquePtr<Ice::LocalException> _exception; -#endif bool _initialized; bool _flushing; diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp index d75a0dd2222..82e1b48d6aa 100644 --- a/cpp/src/Ice/ConnectionI.cpp +++ b/cpp/src/Ice/ConnectionI.cpp @@ -624,11 +624,7 @@ Ice::ConnectionI::sendRequest(OutgoingBase* out, bool compress, bool response, i // if(ICE_EXCEPTION_ISSET(_exception)) { -#ifdef ICE_CPP11_MAPPING - throw RetryException(_exception); -#else throw RetryException(*_exception.get()); -#endif } assert(_state > StateNotValidated); @@ -716,11 +712,7 @@ Ice::ConnectionI::sendAsyncRequest(const OutgoingAsyncBasePtr& out, bool compres // if(ICE_EXCEPTION_ISSET(_exception)) { -#ifdef ICE_CPP11_MAPPING - throw RetryException(_exception); -#else throw RetryException(*_exception.get()); -#endif } assert(_state > StateNotValidated); assert(_state < StateClosing); @@ -2579,11 +2571,7 @@ Ice::ConnectionI::initiateShutdown() // // Notify the the transceiver of the graceful connection closure. // -#ifdef ICE_CPP11_MAPPING - SocketOperation op = _transceiver->closing(true, _exception); -#else SocketOperation op = _transceiver->closing(true, *_exception.get()); -#endif if(op) { scheduleTimeout(op); @@ -2929,11 +2917,7 @@ Ice::ConnectionI::sendNextMessage(vector<OutgoingMessage>& callbacks) if(_state == StateClosing && _shutdownInitiated) { setState(StateClosingPending); -#ifdef ICE_CPP11_MAPPING - SocketOperation op = _transceiver->closing(true, _exception); -#else SocketOperation op = _transceiver->closing(true, *_exception.get()); -#endif if(op) { return op; @@ -3314,11 +3298,7 @@ Ice::ConnectionI::parseMessage(InputStream& stream, Int& invokeNum, Int& request // // Notify the the transceiver of the graceful connection closure. // -#ifdef ICE_CPP11_MAPPING - SocketOperation op = _transceiver->closing(false, _exception); -#else SocketOperation op = _transceiver->closing(false, *_exception.get()); -#endif if(op) { return op; diff --git a/cpp/src/Ice/ConnectionI.h b/cpp/src/Ice/ConnectionI.h index 023ac044e5b..a0a6cae89a1 100644 --- a/cpp/src/Ice/ConnectionI.h +++ b/cpp/src/Ice/ConnectionI.h @@ -368,11 +368,7 @@ private: std::map<Int, IceInternal::OutgoingAsyncBasePtr> _asyncRequests; std::map<Int, IceInternal::OutgoingAsyncBasePtr>::iterator _asyncRequestsHint; -#ifdef ICE_CPP11_MAPPING - std::exception_ptr _exception; -#else IceUtil::UniquePtr<LocalException> _exception; -#endif const size_t _messageSizeMax; IceInternal::BatchRequestQueuePtr _batchRequestQueue; diff --git a/cpp/src/Ice/Exception.cpp b/cpp/src/Ice/Exception.cpp index d9d1f929fc1..848d7260502 100644 --- a/cpp/src/Ice/Exception.cpp +++ b/cpp/src/Ice/Exception.cpp @@ -116,7 +116,15 @@ const std::string& Ice::UserException::ice_staticId() { return __Ice__UserException_ids[0]; -}; +} + +#ifdef ICE_CPP11_MAPPING +unique_ptr<Ice::UserException> +Ice::UserException::ice_clone() const +{ + return unique_ptr<UserException>(static_cast<UserException*>(ice_cloneImpl())); +} +#endif void Ice::UserException::__write(::Ice::OutputStream* os) const @@ -153,6 +161,14 @@ Ice::LocalException::~LocalException() // Out of line to avoid weak vtable } +#ifdef ICE_CPP11_MAPPING +unique_ptr<Ice::LocalException> +Ice::LocalException::ice_clone() const +{ + return unique_ptr<LocalException>(static_cast<LocalException*>(ice_cloneImpl())); +} +#endif + namespace { @@ -181,6 +197,14 @@ Ice::SystemException::~SystemException() { } +#ifdef ICE_CPP11_MAPPING +unique_ptr<Ice::SystemException> +Ice::SystemException::ice_clone() const +{ + return unique_ptr<SystemException>(static_cast<SystemException*>(ice_cloneImpl())); +} +#endif + namespace { diff --git a/cpp/src/Ice/LocatorInfo.cpp b/cpp/src/Ice/LocatorInfo.cpp index e768b442330..c570cd3702a 100644 --- a/cpp/src/Ice/LocatorInfo.cpp +++ b/cpp/src/Ice/LocatorInfo.cpp @@ -442,18 +442,7 @@ IceInternal::LocatorInfo::Request::addCallback(const ReferencePtr& ref, else { assert(ICE_EXCEPTION_ISSET(_exception)); -#ifdef ICE_CPP11_MAPPING - try - { - rethrow_exception(_exception); - } - catch(const Ice::Exception& ex) - { - callback->exception(_locatorInfo, ex); - } -#else callback->exception(_locatorInfo, *_exception.get()); -#endif } } @@ -486,18 +475,7 @@ IceInternal::LocatorInfo::Request::getEndpoints(const ReferencePtr& ref, if(ICE_EXCEPTION_ISSET(_exception)) { -#ifdef ICE_CPP11_MAPPING - try - { - rethrow_exception(_exception); - } - catch(const Ice::Exception& ex) - { - _locatorInfo->getEndpointsException(ref, ex); // This throws. - } -#else _locatorInfo->getEndpointsException(ref, *_exception.get()); // This throws. -#endif } assert(_response); diff --git a/cpp/src/Ice/LocatorInfo.h b/cpp/src/Ice/LocatorInfo.h index b3f445b3f22..25b116913c3 100644 --- a/cpp/src/Ice/LocatorInfo.h +++ b/cpp/src/Ice/LocatorInfo.h @@ -132,11 +132,7 @@ public: bool _sent; bool _response; Ice::ObjectPrxPtr _proxy; -#ifdef ICE_CPP11_MAPPING - std::exception_ptr _exception; -#else IceUtil::UniquePtr<Ice::Exception> _exception; -#endif }; typedef IceUtil::Handle<Request> RequestPtr; diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp index 3c1ad6bfd14..66965b23332 100644 --- a/cpp/src/Ice/Outgoing.cpp +++ b/cpp/src/Ice/Outgoing.cpp @@ -561,18 +561,7 @@ Outgoing::completed(InputStream& is) default: { -#ifdef ICE_CPP11_MAPPING - try - { - throw UnknownReplyStatusException(__FILE__, __LINE__); - } - catch(...) - { - _exception = current_exception(); - } -#else _exception.reset(new UnknownReplyStatusException(__FILE__, __LINE__)); -#endif _state = StateLocalException; break; } diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp index 24691b9f755..507311ce3f8 100644 --- a/cpp/src/Ice/OutgoingAsync.cpp +++ b/cpp/src/Ice/OutgoingAsync.cpp @@ -1282,24 +1282,10 @@ ConnectionFlushBatchAsync::invoke(const string& operation) } catch(const RetryException& ex) { -#ifdef ICE_CPP11_MAPPING - try - { - rethrow_exception(ex.get()); - } - catch(const Ice::LocalException& ee) - { - if(exception(ee)) - { - invokeExceptionAsync(); - } - } -#else if(exception(*ex.get())) { invokeExceptionAsync(); } -#endif } catch(const Exception& ex) { diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp index 772af952742..4e28f98dac7 100644 --- a/cpp/src/Ice/Reference.cpp +++ b/cpp/src/Ice/Reference.cpp @@ -1818,11 +1818,7 @@ IceInternal::RoutableReference::createConnection(const vector<EndpointIPtr>& all const vector<EndpointIPtr> _endpoints; const GetConnectionCallbackPtr _callback; size_t _i; -#ifdef ICE_CPP11_MAPPING - std::exception_ptr _exception; -#else IceUtil::UniquePtr<Ice::LocalException> _exception; -#endif }; // diff --git a/cpp/src/Ice/RequestHandler.cpp b/cpp/src/Ice/RequestHandler.cpp index bca8cbb84eb..35e67a41864 100644 --- a/cpp/src/Ice/RequestHandler.cpp +++ b/cpp/src/Ice/RequestHandler.cpp @@ -13,34 +13,20 @@ using namespace std; using namespace IceInternal; -#ifdef ICE_CPP11_MAPPING -RetryException::RetryException(std::exception_ptr ex) : _ex(ex) -{ -} - -RetryException::RetryException(const RetryException& ex) : _ex(ex.get()) -{ -} - -exception_ptr -RetryException::get() const -{ - assert(_ex); - return _ex; -} - -#else +#ifndef ICE_CPP11_MAPPING IceUtil::Shared* IceInternal::upCast(RequestHandler* p) { return p; } IceUtil::Shared* IceInternal::upCast(CancellationHandler* p) { return p; } +#endif + RetryException::RetryException(const Ice::LocalException& ex) { - _ex.reset(ex.ice_clone()); + ICE_RESET_EXCEPTION(_ex, ex.ice_clone()); } RetryException::RetryException(const RetryException& ex) { - _ex.reset(ex.get()->ice_clone()); + ICE_RESET_EXCEPTION(_ex, ex.get()->ice_clone()); } const Ice::LocalException* @@ -49,7 +35,6 @@ RetryException::get() const assert(_ex.get()); return _ex.get(); } -#endif RequestHandler::RequestHandler(const ReferencePtr& reference) : _reference(reference), diff --git a/cpp/src/Ice/RequestHandler.h b/cpp/src/Ice/RequestHandler.h index dcad80c2c35..c1ce9446f0e 100644 --- a/cpp/src/Ice/RequestHandler.h +++ b/cpp/src/Ice/RequestHandler.h @@ -36,21 +36,6 @@ class ProxyOutgoingBase; // An exception wrapper, which is used to notify that the request // handler should be cleared and the invocation retried. // -#ifdef ICE_CPP11_MAPPING -class RetryException -{ -public: - - RetryException(std::exception_ptr); - RetryException(const RetryException&); - - std::exception_ptr get() const; - -private: - - std::exception_ptr _ex; -}; -#else class RetryException { public: @@ -64,7 +49,6 @@ private: IceUtil::UniquePtr<Ice::LocalException> _ex; }; -#endif class CancellationHandler diff --git a/cpp/src/Ice/RouterInfo.h b/cpp/src/Ice/RouterInfo.h index b7f7821d13d..acd24af3476 100644 --- a/cpp/src/Ice/RouterInfo.h +++ b/cpp/src/Ice/RouterInfo.h @@ -45,7 +45,7 @@ private: #ifdef ICE_CPP11_MAPPING using RouterTableMap = std::map<std::shared_ptr<Ice::RouterPrx>, - RouterInfoPtr, + RouterInfoPtr, Ice::TargetLess<std::shared_ptr<::Ice::RouterPrx>>>; #else typedef std::map<Ice::RouterPrxPtr, RouterInfoPtr> RouterTableMap; diff --git a/cpp/src/Ice/TcpTransceiver.cpp b/cpp/src/Ice/TcpTransceiver.cpp index be280be0476..808ac140443 100644 --- a/cpp/src/Ice/TcpTransceiver.cpp +++ b/cpp/src/Ice/TcpTransceiver.cpp @@ -31,11 +31,7 @@ IceInternal::TcpTransceiver::initialize(Buffer& readBuffer, Buffer& writeBuffer) } SocketOperation -#ifdef ICE_CPP11_MAPPING -IceInternal::TcpTransceiver::closing(bool initiator, exception_ptr) -#else IceInternal::TcpTransceiver::closing(bool initiator, const Ice::LocalException&) -#endif { // If we are initiating the connection closure, wait for the peer // to close the TCP/IP connection. Otherwise, close immediately. diff --git a/cpp/src/Ice/TcpTransceiver.h b/cpp/src/Ice/TcpTransceiver.h index 198b4aeab77..dc3d279d6dc 100644 --- a/cpp/src/Ice/TcpTransceiver.h +++ b/cpp/src/Ice/TcpTransceiver.h @@ -28,11 +28,8 @@ public: virtual NativeInfoPtr getNativeInfo(); virtual SocketOperation initialize(Buffer&, Buffer&); -#ifdef ICE_CPP11_MAPPING - virtual SocketOperation closing(bool, std::exception_ptr); -#else virtual SocketOperation closing(bool, const Ice::LocalException&); -#endif + virtual void close(); virtual SocketOperation write(Buffer&); virtual SocketOperation read(Buffer&); diff --git a/cpp/src/Ice/Transceiver.h b/cpp/src/Ice/Transceiver.h index a0f14ce7ad7..f21e3a27aaf 100644 --- a/cpp/src/Ice/Transceiver.h +++ b/cpp/src/Ice/Transceiver.h @@ -28,11 +28,8 @@ public: virtual NativeInfoPtr getNativeInfo() = 0; virtual SocketOperation initialize(Buffer&, Buffer&) = 0; -#ifdef ICE_CPP11_MAPPING - virtual SocketOperation closing(bool, std::exception_ptr) = 0; -#else virtual SocketOperation closing(bool, const Ice::LocalException&) = 0; -#endif + virtual void close() = 0; virtual EndpointIPtr bind(); virtual SocketOperation write(Buffer&) = 0; diff --git a/cpp/src/Ice/UdpTransceiver.cpp b/cpp/src/Ice/UdpTransceiver.cpp index 3ec0db137e2..c6a6b6352f7 100755 --- a/cpp/src/Ice/UdpTransceiver.cpp +++ b/cpp/src/Ice/UdpTransceiver.cpp @@ -97,11 +97,7 @@ IceInternal::UdpTransceiver::initialize(Buffer& /*readBuffer*/, Buffer& /*writeB } SocketOperation -#ifdef ICE_CPP11_MAPPING -IceInternal::UdpTransceiver::closing(bool, exception_ptr) -#else IceInternal::UdpTransceiver::closing(bool, const Ice::LocalException&) -#endif { // Nothing to do. return SocketOperationNone; diff --git a/cpp/src/Ice/UdpTransceiver.h b/cpp/src/Ice/UdpTransceiver.h index 84b600d68c2..fa81553eb3c 100644 --- a/cpp/src/Ice/UdpTransceiver.h +++ b/cpp/src/Ice/UdpTransceiver.h @@ -43,11 +43,7 @@ public: #endif virtual SocketOperation initialize(Buffer&, Buffer&); -#ifdef ICE_CPP11_MAPPING - virtual SocketOperation closing(bool, std::exception_ptr); -#else virtual SocketOperation closing(bool, const Ice::LocalException&); -#endif virtual void close(); virtual EndpointIPtr bind(); virtual SocketOperation write(Buffer&); diff --git a/cpp/src/Ice/WSTransceiver.cpp b/cpp/src/Ice/WSTransceiver.cpp index 24d97b89920..0c33cfe8d8f 100644 --- a/cpp/src/Ice/WSTransceiver.cpp +++ b/cpp/src/Ice/WSTransceiver.cpp @@ -410,11 +410,7 @@ IceInternal::WSTransceiver::initialize(Buffer& readBuffer, Buffer& writeBuffer) } SocketOperation -#ifdef ICE_CPP11_MAPPING -IceInternal::WSTransceiver::closing(bool initiator, exception_ptr reason) -#else IceInternal::WSTransceiver::closing(bool initiator, const Ice::LocalException& reason) -#endif { if(_instance->traceLevel() >= 1) { @@ -444,38 +440,7 @@ IceInternal::WSTransceiver::closing(bool initiator, const Ice::LocalException& r } _closingInitiator = initiator; -#ifdef ICE_CPP11_MAPPING - if(reason) - { - try - { - rethrow_exception(reason); - } - catch(const Ice::CloseConnectionException&) - { - _closingReason = CLOSURE_NORMAL; - } - catch(const Ice::ObjectAdapterDeactivatedException&) - { - _closingReason = CLOSURE_SHUTDOWN; - } - catch(Ice::CommunicatorDestroyedException&) - { - _closingReason = CLOSURE_SHUTDOWN; - } - catch(const Ice::MemoryLimitException&) - { - _closingReason = CLOSURE_TOO_BIG; - } - catch(const Ice::ProtocolException&) - { - _closingReason = CLOSURE_PROTOCOL_ERROR; - } - catch(...) - { - } - } -#else + if(dynamic_cast<const Ice::CloseConnectionException*>(&reason)) { _closingReason = CLOSURE_NORMAL; @@ -493,7 +458,6 @@ IceInternal::WSTransceiver::closing(bool initiator, const Ice::LocalException& r { _closingReason = CLOSURE_TOO_BIG; } -#endif if(_state == StateOpened) { diff --git a/cpp/src/Ice/WSTransceiver.h b/cpp/src/Ice/WSTransceiver.h index 7b6a7ffe5e6..c34a8438c7e 100644 --- a/cpp/src/Ice/WSTransceiver.h +++ b/cpp/src/Ice/WSTransceiver.h @@ -34,11 +34,7 @@ public: #endif virtual SocketOperation initialize(Buffer&, Buffer&); -#ifdef ICE_CPP11_MAPPING - virtual SocketOperation closing(bool, std::exception_ptr); -#else virtual SocketOperation closing(bool, const Ice::LocalException&); -#endif virtual void close(); virtual SocketOperation write(Buffer&); virtual SocketOperation read(Buffer&); diff --git a/cpp/src/Ice/ios/StreamTransceiver.cpp b/cpp/src/Ice/ios/StreamTransceiver.cpp index 4fcbec4f400..8c9305f4031 100644 --- a/cpp/src/Ice/ios/StreamTransceiver.cpp +++ b/cpp/src/Ice/ios/StreamTransceiver.cpp @@ -297,11 +297,7 @@ IceObjC::StreamTransceiver::initialize(Buffer& readBuffer, Buffer& writeBuffer) } SocketOperation -#ifdef ICE_CPP11_MAPPING -IceObjC::StreamTransceiver::closing(bool initiator, exception_ptr) -#else IceObjC::StreamTransceiver::closing(bool initiator, const Ice::LocalException&) -#endif { // If we are initiating the connection closure, wait for the peer // to close the TCP/IP connection. Otherwise, close immediately. diff --git a/cpp/src/Ice/ios/StreamTransceiver.h b/cpp/src/Ice/ios/StreamTransceiver.h index e38285451f8..c6ba084b64b 100644 --- a/cpp/src/Ice/ios/StreamTransceiver.h +++ b/cpp/src/Ice/ios/StreamTransceiver.h @@ -52,11 +52,7 @@ public: virtual void closeStreams(); virtual IceInternal::SocketOperation initialize(IceInternal::Buffer&, IceInternal::Buffer&); -#ifdef ICE_CPP11_MAPPING - virtual IceInternal::SocketOperation closing(bool initiator, std::exception_ptr); -#else virtual IceInternal::SocketOperation closing(bool, const Ice::LocalException&); -#endif virtual void close(); virtual IceInternal::SocketOperation write(IceInternal::Buffer&); |