summaryrefslogtreecommitdiff
path: root/TAO/tao/DynamicInterface/DII_Reply_Dispatcher.cpp
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-10-31 18:14:53 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-10-31 18:14:53 +0000
commit572eafb31c0f8833df639bb7cf4cf5eb6d4689db (patch)
tree459333aaeffce07d580e66cfefcbc6a9b550b942 /TAO/tao/DynamicInterface/DII_Reply_Dispatcher.cpp
parent3e371c71ede1a5de41078e6eb84aa9010d69561b (diff)
downloadATCD-572eafb31c0f8833df639bb7cf4cf5eb6d4689db.tar.gz
ChangeLogTag: Tue Oct 31 12:01:10 2000 Jeff Parsons <parsons@cs.wustl.edu>
Diffstat (limited to 'TAO/tao/DynamicInterface/DII_Reply_Dispatcher.cpp')
-rw-r--r--TAO/tao/DynamicInterface/DII_Reply_Dispatcher.cpp130
1 files changed, 130 insertions, 0 deletions
diff --git a/TAO/tao/DynamicInterface/DII_Reply_Dispatcher.cpp b/TAO/tao/DynamicInterface/DII_Reply_Dispatcher.cpp
new file mode 100644
index 00000000000..ff257fa4ea9
--- /dev/null
+++ b/TAO/tao/DynamicInterface/DII_Reply_Dispatcher.cpp
@@ -0,0 +1,130 @@
+// $Id$
+
+
+#include "DII_Reply_Dispatcher.h"
+
+ACE_RCSID(DynamicInterface, DII_Reply_Dispatcher, "$Id$")
+
+#include "Request.h"
+#include "tao/Pluggable.h"
+#include "tao/Environment.h"
+#include "tao/GIOP_Message_State.h"
+#include "tao/debug.h"
+
+#if !defined (__ACE_INLINE__)
+#include "DII_Reply_Dispatcher.inl"
+#endif /* __ACE_INLINE__ */
+
+// Constructor.
+TAO_DII_Deferred_Reply_Dispatcher::TAO_DII_Deferred_Reply_Dispatcher (const CORBA::Request_ptr req)
+ : req_ (req),
+ transport_ (0)
+{
+}
+
+// Destructor.
+TAO_DII_Deferred_Reply_Dispatcher::~TAO_DII_Deferred_Reply_Dispatcher (void)
+{
+ if (this->transport_ != 0)
+ {
+ this->transport_->idle_after_reply ();
+ }
+}
+
+// Dispatch the reply.
+int
+TAO_DII_Deferred_Reply_Dispatcher::dispatch_reply (
+ CORBA::ULong reply_status,
+ const TAO_GIOP_Version & /* version */,
+ IOP::ServiceContextList &reply_ctx,
+ TAO_GIOP_Message_State *message_state
+ )
+{
+ this->reply_status_ = reply_status;
+ this->message_state_ = message_state;
+
+ // Steal the buffer, that way we don't do any unnecesary copies of
+ // this data.
+ CORBA::ULong max = reply_ctx.maximum ();
+ CORBA::ULong len = reply_ctx.length ();
+ IOP::ServiceContext* context_list = reply_ctx.get_buffer (1);
+ this->reply_service_info_.replace (max, len, context_list, 1);
+
+ if (TAO_debug_level >= 4)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P | %t):TAO_Asynch_Reply_Dispatcher::dispatch_reply:\n")));
+ }
+
+ ACE_TRY_NEW_ENV
+ {
+ // Call the Request back and send the reply data.
+ this->req_->handle_response (this->message_state_->cdr,
+ reply_status,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ if (TAO_debug_level >= 4)
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Exception during reply handler");
+ }
+ }
+ ACE_ENDTRY;
+
+ // This was dynamically allocated. Now the job is done. Commit
+ // suicide here.
+ delete this;
+
+ return 1;
+}
+
+TAO_GIOP_Message_State *
+TAO_DII_Deferred_Reply_Dispatcher::message_state (void)
+{
+ return this->message_state_;
+}
+
+void
+TAO_DII_Deferred_Reply_Dispatcher::dispatcher_bound (TAO_Transport*)
+{
+}
+
+void
+TAO_DII_Deferred_Reply_Dispatcher::connection_closed (void)
+{
+ ACE_TRY_NEW_ENV
+ {
+ // Generate a fake exception....
+ CORBA::COMM_FAILURE comm_failure (0,
+ CORBA::COMPLETED_MAYBE);
+
+ TAO_OutputCDR out_cdr;
+
+ comm_failure._tao_encode (out_cdr,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+
+ // Turn into an output CDR
+ TAO_InputCDR cdr (out_cdr);
+
+ this->req_->handle_response (cdr,
+ TAO_PLUGGABLE_MESSAGE_SYSTEM_EXCEPTION,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ if (TAO_debug_level >= 4)
+ {
+ ACE_PRINT_EXCEPTION (
+ ACE_ANY_EXCEPTION,
+ "DII_Deferred_Reply_Dispacher::connection_closed"
+ );
+ }
+ }
+ ACE_ENDTRY;
+}
+