diff options
author | Bernard Normier <bernard@zeroc.com> | 2007-05-16 19:14:39 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2007-05-16 19:14:39 +0000 |
commit | 93349d8446a3847d38c8bed0cefb71cdecb0570a (patch) | |
tree | 1426813a2e221e92dc7ce56c36d4aba240ed0c96 /cpp/src/Ice/DispatchInterceptor.cpp | |
parent | Bug 1996 - multihomed hostnames (diff) | |
download | ice-93349d8446a3847d38c8bed0cefb71cdecb0570a.tar.bz2 ice-93349d8446a3847d38c8bed0cefb71cdecb0570a.tar.xz ice-93349d8446a3847d38c8bed0cefb71cdecb0570a.zip |
New Dispatch Interceptor (see bug #2126)
Diffstat (limited to 'cpp/src/Ice/DispatchInterceptor.cpp')
-rw-r--r-- | cpp/src/Ice/DispatchInterceptor.cpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/cpp/src/Ice/DispatchInterceptor.cpp b/cpp/src/Ice/DispatchInterceptor.cpp new file mode 100644 index 00000000000..eb128af15ce --- /dev/null +++ b/cpp/src/Ice/DispatchInterceptor.cpp @@ -0,0 +1,59 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#include <Ice/DispatchInterceptor.h> +#include <Ice/IncomingRequest.h> +#include <Ice/Direct.h> +#include <Ice/LocalException.h> + +using namespace Ice; +using namespace IceInternal; + +DispatchStatus +Ice::DispatchInterceptor::__dispatch(IceInternal::Incoming& in, const Current& current) +{ + try + { + IncomingRequest request(in); + DispatchStatus status = dispatch(request); + if(status != DispatchAsync) + { + // + // Make sure 'in' owns the connection etc. + // + in.killAsync(); + } + return status; + } + catch(const ResponseSentException&) + { + return DispatchAsync; + } + catch(...) + { + try + { + in.killAsync(); + } + catch(const ResponseSentException&) + { + return DispatchAsync; + } + throw; + } +} + +DispatchStatus +Ice::DispatchInterceptor::__collocDispatch(Direct& request) +{ + // + // Should only return DispatchOK or DispatchUserException + // + return dispatch(request); +} |