summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/DispatchInterceptor.cpp
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2007-05-16 19:14:39 +0000
committerBernard Normier <bernard@zeroc.com>2007-05-16 19:14:39 +0000
commit93349d8446a3847d38c8bed0cefb71cdecb0570a (patch)
tree1426813a2e221e92dc7ce56c36d4aba240ed0c96 /cpp/src/Ice/DispatchInterceptor.cpp
parentBug 1996 - multihomed hostnames (diff)
downloadice-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.cpp59
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);
+}