summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/Incoming.cpp
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2009-03-02 15:23:53 -0330
committerDwayne Boone <dwayne@zeroc.com>2009-03-02 15:23:53 -0330
commit8b15e6ba73a45b5be5064cb2f866ad0654d7af18 (patch)
tree9ee591d38fb7725ab2e6ef637b46b54d1394ef33 /cpp/src/Ice/Incoming.cpp
parentFix 3755 - demo/Ice/callback has context parameter? (diff)
downloadice-8b15e6ba73a45b5be5064cb2f866ad0654d7af18.tar.bz2
ice-8b15e6ba73a45b5be5064cb2f866ad0654d7af18.tar.xz
ice-8b15e6ba73a45b5be5064cb2f866ad0654d7af18.zip
C++Builder 2009 port
Diffstat (limited to 'cpp/src/Ice/Incoming.cpp')
-rw-r--r--cpp/src/Ice/Incoming.cpp181
1 files changed, 97 insertions, 84 deletions
diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp
index 17d49550847..ee574377515 100644
--- a/cpp/src/Ice/Incoming.cpp
+++ b/cpp/src/Ice/Incoming.cpp
@@ -91,6 +91,46 @@ IceInternal::IncomingBase::__warning(const string& msg) const
out << "\noperation: " << _current.operation;
}
+bool
+IceInternal::IncomingBase::__servantLocatorFinished()
+{
+ assert(_locator && _servant);
+ try
+ {
+ _locator->finished(_current, _servant, _cookie);
+ return true;
+ }
+ catch(const UserException& ex)
+ {
+ //
+ // The operation may have already marshaled a reply; we must overwrite that reply.
+ //
+ if(_response)
+ {
+ _os.endWriteEncaps();
+ _os.b.resize(headerSize + 4); // Reply status position.
+ _os.write(replyUserException);
+ _os.startWriteEncaps();
+ _os.write(ex);
+ _os.endWriteEncaps();
+ _connection->sendResponse(&_os, _compress);
+ }
+ else
+ {
+ _connection->sendNoResponse();
+ }
+ }
+ catch(const std::exception& ex)
+ {
+ __handleException(ex);
+ }
+ catch(...)
+ {
+ __handleException();
+ }
+ return false;
+}
+
void
IceInternal::IncomingBase::__handleException(const std::exception& exc)
{
@@ -400,117 +440,90 @@ IceInternal::Incoming::invoke(const ServantManagerPtr& servantManager)
// the caller of this operation.
//
- try
+ if(servantManager)
{
- bool finishedException = false;
- try
+ _servant = servantManager->findServant(_current.id, _current.facet);
+ if(!_servant)
{
- if(servantManager)
- {
- _servant = servantManager->findServant(_current.id, _current.facet);
- if(!_servant)
- {
- _locator = servantManager->findServantLocator(_current.id.category);
- if(!_locator && !_current.id.category.empty())
- {
- _locator = servantManager->findServantLocator("");
- }
- if(_locator)
- {
- try
- {
- _servant = _locator->locate(_current, _cookie);
- }
- catch(const UserException& ex)
- {
- _os.write(ex);
- replyStatus = replyUserException;
- }
- }
- }
- }
- if(replyStatus == replyOK)
+ _locator = servantManager->findServantLocator(_current.id.category);
+ if(!_locator && !_current.id.category.empty())
{
- if(!_servant)
- {
- if(servantManager && servantManager->hasServant(_current.id))
- {
- replyStatus = replyFacetNotExist;
- }
- else
- {
- replyStatus = replyObjectNotExist;
- }
- }
- else
- {
- dispatchStatus = _servant->__dispatch(*this, _current);
- if(dispatchStatus == DispatchUserException)
- {
- replyStatus = replyUserException;
- }
- }
+ _locator = servantManager->findServantLocator("");
}
- }
- catch(...)
- {
- if(_locator && _servant && dispatchStatus != DispatchAsync)
+
+ if(_locator)
{
try
{
- _locator->finished(_current, _servant, _cookie);
+ _servant = _locator->locate(_current, _cookie);
}
catch(const UserException& ex)
{
- //
- // The operation may have already marshaled a reply; we must overwrite that reply.
- //
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 5); // Byte following reply status.
- _os.startWriteEncaps();
_os.write(ex);
- replyStatus = replyUserException; // Code below inserts the reply status.
- finishedException = true;
+ replyStatus = replyUserException;
+ }
+ catch(const std::exception& ex)
+ {
+ __handleException(ex);
+ return;
}
catch(...)
{
- throw;
+ __handleException();
+ return;
}
}
- if(!finishedException)
+ }
+ }
+
+ if(_servant)
+ {
+ try
+ {
+ assert(replyStatus == replyOK);
+ dispatchStatus = _servant->__dispatch(*this, _current);
+ if(dispatchStatus == DispatchUserException)
+ {
+ replyStatus = replyUserException;
+ }
+
+ if(dispatchStatus != DispatchAsync)
{
- throw;
+ if(_locator && !__servantLocatorFinished())
+ {
+ return;
+ }
}
}
-
- if(!finishedException && _locator && _servant && dispatchStatus != DispatchAsync)
+ catch(const std::exception& ex)
{
- try
+ if(_locator && !__servantLocatorFinished())
{
- _locator->finished(_current, _servant, _cookie);
+ return;
}
- catch(const UserException& ex)
+ __handleException(ex);
+ return;
+ }
+ catch(...)
+ {
+ if(_locator && !__servantLocatorFinished())
{
- //
- // The operation may have already marshaled a reply; we must overwrite that reply.
- //
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 5); // Byte following reply status.
- _os.startWriteEncaps();
- _os.write(ex);
- replyStatus = replyUserException; // Code below inserts the reply status.
+ return;
}
+ __handleException();
+ return;
}
}
- catch(const std::exception& ex)
+ else if(replyStatus == replyOK)
{
- __handleException(ex);
- return;
- }
- catch(...)
- {
- __handleException();
- return;
+ if(servantManager && servantManager->hasServant(_current.id))
+ {
+ replyStatus = replyFacetNotExist;
+ }
+ else
+ {
+ replyStatus = replyObjectNotExist;
+ }
}
//