summaryrefslogtreecommitdiff
path: root/cppe/src/IceE/Outgoing.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cppe/src/IceE/Outgoing.cpp')
-rw-r--r--cppe/src/IceE/Outgoing.cpp500
1 files changed, 250 insertions, 250 deletions
diff --git a/cppe/src/IceE/Outgoing.cpp b/cppe/src/IceE/Outgoing.cpp
index 2bf572dfab2..19b7d9a07ee 100644
--- a/cppe/src/IceE/Outgoing.cpp
+++ b/cppe/src/IceE/Outgoing.cpp
@@ -45,7 +45,7 @@ IceInternal::LocalExceptionWrapper::retry() const
}
IceInternal::Outgoing::Outgoing(Connection* connection, Reference* ref, const string& operation,
- OperationMode mode, const Context* context) :
+ OperationMode mode, const Context* context) :
_connection(connection),
_reference(ref),
_state(StateUnsent),
@@ -58,26 +58,26 @@ IceInternal::Outgoing::Outgoing(Connection* connection, Reference* ref, const st
{
switch(_reference->getMode())
{
- case ReferenceModeTwoway:
- case ReferenceModeOneway:
- {
- _stream.writeBlob(requestHdr, sizeof(requestHdr));
- break;
- }
+ case ReferenceModeTwoway:
+ case ReferenceModeOneway:
+ {
+ _stream.writeBlob(requestHdr, sizeof(requestHdr));
+ break;
+ }
- case ReferenceModeBatchOneway:
+ case ReferenceModeBatchOneway:
#ifdef ICEE_HAS_BATCH
- {
- _connection->prepareBatchRequest(&_stream);
- break;
- }
+ {
+ _connection->prepareBatchRequest(&_stream);
+ break;
+ }
#endif
- case ReferenceModeDatagram:
- case ReferenceModeBatchDatagram:
- {
- assert(false);
- break;
- }
+ case ReferenceModeDatagram:
+ case ReferenceModeBatchDatagram:
+ {
+ assert(false);
+ break;
+ }
}
// _reference->getIdentity().__write(&_stream);
@@ -91,12 +91,12 @@ IceInternal::Outgoing::Outgoing(Connection* connection, Reference* ref, const st
//
if(_reference->getFacet().empty())
{
- _stream.writeSize(0);
+ _stream.writeSize(0);
}
else
{
- _stream.writeSize(1);
- _stream.write(_reference->getFacet());
+ _stream.writeSize(1);
+ _stream.write(_reference->getFacet());
}
_stream.write(operation, false);
@@ -112,8 +112,8 @@ IceInternal::Outgoing::Outgoing(Connection* connection, Reference* ref, const st
Context::const_iterator p;
for(p = context->begin(); p != context->end(); ++p)
{
- _stream.write(p->first);
- _stream.write(p->second);
+ _stream.write(p->first);
+ _stream.write(p->second);
}
//
@@ -134,86 +134,86 @@ IceInternal::Outgoing::invoke()
switch(_reference->getMode())
{
- case ReferenceModeTwoway:
- {
- //
- // We let all exceptions raised by sending directly
- // propagate to the caller, because they can be retried
- // without violating "at-most-once". In case of such
- // exceptions, the connection object does not call back on
- // this object, so we don't need to lock the mutex, keep
- // track of state, or save exceptions.
- //
- _connection->sendRequest(&_stream, this);
+ case ReferenceModeTwoway:
+ {
+ //
+ // We let all exceptions raised by sending directly
+ // propagate to the caller, because they can be retried
+ // without violating "at-most-once". In case of such
+ // exceptions, the connection object does not call back on
+ // this object, so we don't need to lock the mutex, keep
+ // track of state, or save exceptions.
+ //
+ _connection->sendRequest(&_stream, this);
- if(_exception.get())
- {
- //
- // A CloseConnectionException indicates graceful
- // server shutdown, and is therefore always repeatable
- // without violating "at-most-once". That's because by
- // sending a close connection message, the server
- // guarantees that all outstanding requests can safely
- // be repeated.
- //
- // An ObjectNotExistException can always be retried as
- // well without violating "at-most-once".
- //
- if(dynamic_cast<CloseConnectionException*>(_exception.get()) ||
- dynamic_cast<ObjectNotExistException*>(_exception.get()))
- {
- _exception->ice_throw();
- }
-
- //
- // Throw the exception wrapped in a LocalExceptionWrapper, to
- // indicate that the request cannot be resent without
- // potentially violating the "at-most-once" principle.
- //
- throw LocalExceptionWrapper(*_exception.get(), false);
- }
-
- if(_state == StateUserException)
- {
- return false;
- }
+ if(_exception.get())
+ {
+ //
+ // A CloseConnectionException indicates graceful
+ // server shutdown, and is therefore always repeatable
+ // without violating "at-most-once". That's because by
+ // sending a close connection message, the server
+ // guarantees that all outstanding requests can safely
+ // be repeated.
+ //
+ // An ObjectNotExistException can always be retried as
+ // well without violating "at-most-once".
+ //
+ if(dynamic_cast<CloseConnectionException*>(_exception.get()) ||
+ dynamic_cast<ObjectNotExistException*>(_exception.get()))
+ {
+ _exception->ice_throw();
+ }
+
+ //
+ // Throw the exception wrapped in a LocalExceptionWrapper, to
+ // indicate that the request cannot be resent without
+ // potentially violating the "at-most-once" principle.
+ //
+ throw LocalExceptionWrapper(*_exception.get(), false);
+ }
+
+ if(_state == StateUserException)
+ {
+ return false;
+ }
- assert(_state == StateOK);
- break;
- }
-
- case ReferenceModeOneway:
- {
- //
- // For oneway requests, the connection object
- // never calls back on this object. Therefore we don't
- // need to lock the mutex or save exceptions. We simply
- // let all exceptions from sending propagate to the
- // caller, because such exceptions can be retried without
- // violating "at-most-once".
- //
- _connection->sendRequest(&_stream, 0);
- break;
- }
+ assert(_state == StateOK);
+ break;
+ }
+
+ case ReferenceModeOneway:
+ {
+ //
+ // For oneway requests, the connection object
+ // never calls back on this object. Therefore we don't
+ // need to lock the mutex or save exceptions. We simply
+ // let all exceptions from sending propagate to the
+ // caller, because such exceptions can be retried without
+ // violating "at-most-once".
+ //
+ _connection->sendRequest(&_stream, 0);
+ break;
+ }
- case ReferenceModeBatchOneway:
+ case ReferenceModeBatchOneway:
#ifdef ICEE_HAS_BATCH
- {
- //
- // For batch oneways, the same rules as for
- // regular oneways (see comment above)
- // apply.
- //
- _connection->finishBatchRequest(&_stream);
- break;
- }
+ {
+ //
+ // For batch oneways, the same rules as for
+ // regular oneways (see comment above)
+ // apply.
+ //
+ _connection->finishBatchRequest(&_stream);
+ break;
+ }
#endif
- case ReferenceModeDatagram:
- case ReferenceModeBatchDatagram:
- {
- assert(false);
- return false;
- }
+ case ReferenceModeDatagram:
+ case ReferenceModeBatchDatagram:
+ {
+ assert(false);
+ return false;
+ }
}
return true;
@@ -232,14 +232,14 @@ IceInternal::Outgoing::abort(const LocalException& ex)
#ifdef ICEE_HAS_BATCH
if(_reference->getMode() == ReferenceModeBatchOneway)
{
- _connection->abortBatchRequest();
-
- //
- // If we abort a batch requests, we cannot retry, because not
- // only the batch request that caused the problem will be
- // aborted, but all other requests in the batch as well.
- //
- throw LocalExceptionWrapper(ex, false);
+ _connection->abortBatchRequest();
+
+ //
+ // If we abort a batch requests, we cannot retry, because not
+ // only the batch request that caused the problem will be
+ // aborted, but all other requests in the batch as well.
+ //
+ throw LocalExceptionWrapper(ex, false);
}
#endif
@@ -257,7 +257,7 @@ IceInternal::Outgoing::finished(BasicStream& is)
//
if(&is != &_stream)
{
- _stream.swap(is);
+ _stream.swap(is);
}
Byte replyStatus;
@@ -265,153 +265,153 @@ IceInternal::Outgoing::finished(BasicStream& is)
switch(replyStatus)
{
- case replyOK:
- {
- //
- // Input and output parameters are always sent in an
- // encapsulation, which makes it possible to forward
- // oneway requests as blobs.
- //
- _stream.startReadEncaps();
- _state = StateOK; // The state must be set last, in case there is an exception.
- break;
- }
-
- case replyUserException:
- {
- //
- // Input and output parameters are always sent in an
- // encapsulation, which makes it possible to forward
- // oneway requests as blobs.
- //
- _stream.startReadEncaps();
- _state = StateUserException; // The state must be set last, in case there is an exception.
- break;
- }
-
- case replyObjectNotExist:
- case replyFacetNotExist:
- case replyOperationNotExist:
- {
- //
- // Don't read the exception members directly into the
- // exception. Otherwise if reading fails and raises an
- // exception, you will have a memory leak.
- //
- Identity ident;
- ident.__read(&_stream);
+ case replyOK:
+ {
+ //
+ // Input and output parameters are always sent in an
+ // encapsulation, which makes it possible to forward
+ // oneway requests as blobs.
+ //
+ _stream.startReadEncaps();
+ _state = StateOK; // The state must be set last, in case there is an exception.
+ break;
+ }
+
+ case replyUserException:
+ {
+ //
+ // Input and output parameters are always sent in an
+ // encapsulation, which makes it possible to forward
+ // oneway requests as blobs.
+ //
+ _stream.startReadEncaps();
+ _state = StateUserException; // The state must be set last, in case there is an exception.
+ break;
+ }
+
+ case replyObjectNotExist:
+ case replyFacetNotExist:
+ case replyOperationNotExist:
+ {
+ //
+ // Don't read the exception members directly into the
+ // exception. Otherwise if reading fails and raises an
+ // exception, you will have a memory leak.
+ //
+ Identity ident;
+ ident.__read(&_stream);
- //
- // For compatibility with the old FacetPath.
- //
- vector<string> facetPath;
- _stream.read(facetPath);
- string facet;
- if(!facetPath.empty())
- {
- if(facetPath.size() > 1)
- {
- throw MarshalException(__FILE__, __LINE__);
- }
- facet.swap(facetPath[0]);
- }
+ //
+ // For compatibility with the old FacetPath.
+ //
+ vector<string> facetPath;
+ _stream.read(facetPath);
+ string facet;
+ if(!facetPath.empty())
+ {
+ if(facetPath.size() > 1)
+ {
+ throw MarshalException(__FILE__, __LINE__);
+ }
+ facet.swap(facetPath[0]);
+ }
- string operation;
- _stream.read(operation, false);
-
- RequestFailedException* ex;
- switch(replyStatus)
- {
- case replyObjectNotExist:
- {
- ex = new ObjectNotExistException(__FILE__, __LINE__);
- break;
- }
-
- case replyFacetNotExist:
- {
- ex = new FacetNotExistException(__FILE__, __LINE__);
- break;
- }
-
- case replyOperationNotExist:
- {
- ex = new OperationNotExistException(__FILE__, __LINE__);
- break;
- }
-
- default:
- {
- ex = 0; // To keep the compiler from complaining.
- assert(false);
- break;
- }
- }
-
- ex->id = ident;
- ex->facet = facet;
- ex->operation = operation;
- _exception.reset(ex);
+ string operation;
+ _stream.read(operation, false);
+
+ RequestFailedException* ex;
+ switch(replyStatus)
+ {
+ case replyObjectNotExist:
+ {
+ ex = new ObjectNotExistException(__FILE__, __LINE__);
+ break;
+ }
+
+ case replyFacetNotExist:
+ {
+ ex = new FacetNotExistException(__FILE__, __LINE__);
+ break;
+ }
+
+ case replyOperationNotExist:
+ {
+ ex = new OperationNotExistException(__FILE__, __LINE__);
+ break;
+ }
+
+ default:
+ {
+ ex = 0; // To keep the compiler from complaining.
+ assert(false);
+ break;
+ }
+ }
+
+ ex->id = ident;
+ ex->facet = facet;
+ ex->operation = operation;
+ _exception.reset(ex);
- _state = StateLocalException; // The state must be set last, in case there is an exception.
- break;
- }
-
- case replyUnknownException:
- case replyUnknownLocalException:
- case replyUnknownUserException:
- {
- //
- // Don't read the exception members directly into the
- // exception. Otherwise if reading fails and raises an
- // exception, you will have a memory leak.
- //
- string unknown;
- _stream.read(unknown, false);
-
- UnknownException* ex;
- switch(replyStatus)
- {
- case replyUnknownException:
- {
- ex = new UnknownException(__FILE__, __LINE__);
- break;
- }
-
- case replyUnknownLocalException:
- {
- ex = new UnknownLocalException(__FILE__, __LINE__);
- break;
- }
-
- case replyUnknownUserException:
- {
- ex = new UnknownUserException(__FILE__, __LINE__);
- break;
- }
-
- default:
- {
- ex = 0; // To keep the compiler from complaining.
- assert(false);
- break;
- }
- }
-
- ex->unknown = unknown;
- _exception.reset(ex);
+ _state = StateLocalException; // The state must be set last, in case there is an exception.
+ break;
+ }
+
+ case replyUnknownException:
+ case replyUnknownLocalException:
+ case replyUnknownUserException:
+ {
+ //
+ // Don't read the exception members directly into the
+ // exception. Otherwise if reading fails and raises an
+ // exception, you will have a memory leak.
+ //
+ string unknown;
+ _stream.read(unknown, false);
+
+ UnknownException* ex;
+ switch(replyStatus)
+ {
+ case replyUnknownException:
+ {
+ ex = new UnknownException(__FILE__, __LINE__);
+ break;
+ }
+
+ case replyUnknownLocalException:
+ {
+ ex = new UnknownLocalException(__FILE__, __LINE__);
+ break;
+ }
+
+ case replyUnknownUserException:
+ {
+ ex = new UnknownUserException(__FILE__, __LINE__);
+ break;
+ }
+
+ default:
+ {
+ ex = 0; // To keep the compiler from complaining.
+ assert(false);
+ break;
+ }
+ }
+
+ ex->unknown = unknown;
+ _exception.reset(ex);
- _state = StateLocalException; // The state must be set last, in case there is an exception.
- break;
- }
-
- default:
- {
- //_exception.reset(new UnknownReplyStatusException(__FILE__, __LINE__));
- _exception.reset(new ProtocolException(__FILE__, __LINE__, "unknown reply status"));
- _state = StateLocalException;
- break;
- }
+ _state = StateLocalException; // The state must be set last, in case there is an exception.
+ break;
+ }
+
+ default:
+ {
+ //_exception.reset(new UnknownReplyStatusException(__FILE__, __LINE__));
+ _exception.reset(new ProtocolException(__FILE__, __LINE__, "unknown reply status"));
+ _state = StateLocalException;
+ break;
+ }
}
}