Go to the documentation of this file.00001
00002
00003 #include "tao/Synch_Reply_Dispatcher.h"
00004 #include "tao/ORB_Core.h"
00005 #include "tao/Pluggable_Messaging_Utils.h"
00006 #include "tao/debug.h"
00007
00008
00009 ACE_RCSID (tao,
00010 Synch_Reply_Dispatcher,
00011 "$Id: Synch_Reply_Dispatcher.cpp 84563 2009-02-23 08:13:54Z johnnyw $")
00012
00013 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00014
00015
00016 TAO_Synch_Reply_Dispatcher::TAO_Synch_Reply_Dispatcher (
00017 TAO_ORB_Core *orb_core,
00018 IOP::ServiceContextList &sc
00019 )
00020 : reply_service_info_ (sc),
00021 orb_core_ (orb_core),
00022 db_ (sizeof buf_,
00023 ACE_Message_Block::MB_DATA,
00024 this->buf_,
00025 this->orb_core_->input_cdr_buffer_allocator (),
00026 this->orb_core_->locking_strategy (),
00027 ACE_Message_Block::DONT_DELETE,
00028 this->orb_core_->input_cdr_dblock_allocator ()),
00029 reply_cdr_ (&db_,
00030 ACE_Message_Block::DONT_DELETE,
00031 TAO_ENCAP_BYTE_ORDER,
00032 TAO_DEF_GIOP_MAJOR,
00033 TAO_DEF_GIOP_MINOR,
00034 orb_core)
00035 {
00036
00037 this->state_changed_i (TAO_LF_Event::LFS_ACTIVE);
00038 }
00039
00040
00041 TAO_Synch_Reply_Dispatcher::~TAO_Synch_Reply_Dispatcher (void)
00042 {
00043 }
00044
00045 TAO_InputCDR &
00046 TAO_Synch_Reply_Dispatcher::reply_cdr (void)
00047 {
00048 return this->reply_cdr_;
00049 }
00050
00051 void
00052 TAO_Synch_Reply_Dispatcher::reply_timed_out (void)
00053 {
00054
00055 }
00056
00057 int
00058 TAO_Synch_Reply_Dispatcher::dispatch_reply (
00059 TAO_Pluggable_Reply_Params ¶ms)
00060 {
00061 if (params.input_cdr_ == 0)
00062 return -1;
00063
00064 this->reply_status_ = params.reply_status ();
00065 this->locate_reply_status_ = params.locate_reply_status ();
00066
00067
00068
00069 CORBA::ULong const max = params.svc_ctx_.maximum ();
00070 CORBA::ULong const len = params.svc_ctx_.length ();
00071 IOP::ServiceContext* context_list = params.svc_ctx_.get_buffer (true);
00072 this->reply_service_info_.replace (max, len, context_list, true);
00073
00074 if (this->reply_service_info_.length() > 0)
00075 {
00076 orb_core_->service_context_registry ().
00077 process_service_contexts (this->reply_service_info_, *(params.transport_));
00078 }
00079
00080
00081
00082
00083
00084
00085 if (ACE_BIT_DISABLED ((*params.input_cdr_).start()->data_block()->flags(),
00086 ACE_Message_Block::DONT_DELETE))
00087 {
00088
00089 this->reply_cdr_ = *params.input_cdr_;
00090 this->reply_cdr_.clr_mb_flags (ACE_Message_Block::DONT_DELETE);
00091 }
00092 else
00093 {
00094 ACE_Data_Block *db = this->reply_cdr_.clone_from (*params.input_cdr_);
00095
00096 if (db == 0)
00097 {
00098 if (TAO_debug_level > 2)
00099 {
00100 ACE_ERROR ((LM_ERROR,
00101 "TAO (%P|%t) - Synch_Reply_Dispatcher::dispatch_reply "
00102 "clone_from failed\n"));
00103 }
00104 return -1;
00105 }
00106
00107
00108
00109
00110
00111
00112 if (ACE_BIT_DISABLED (db->flags (),
00113 ACE_Message_Block::DONT_DELETE))
00114 {
00115 db->release ();
00116 }
00117 }
00118
00119 this->state_changed (TAO_LF_Event::LFS_SUCCESS,
00120 this->orb_core_->leader_follower ());
00121
00122 return 1;
00123 }
00124
00125 void
00126 TAO_Synch_Reply_Dispatcher::connection_closed (void)
00127 {
00128 this->state_changed (TAO_LF_Event::LFS_CONNECTION_CLOSED,
00129 this->orb_core_->leader_follower ());
00130 }
00131
00132 TAO_END_VERSIONED_NAMESPACE_DECL