#include <Synch_Reply_Dispatcher.h>
Inheritance diagram for TAO_Synch_Reply_Dispatcher:
Public Member Functions | |
TAO_Synch_Reply_Dispatcher (TAO_ORB_Core *orb_core, IOP::ServiceContextList &sc) | |
Constructor. | |
virtual | ~TAO_Synch_Reply_Dispatcher (void) |
Destructor. | |
TAO_InputCDR & | reply_cdr (void) |
Return the reply CDR. | |
virtual int | dispatch_reply (TAO_Pluggable_Reply_Params ¶ms) |
virtual void | connection_closed (void) |
Protected Attributes | |
IOP::ServiceContextList & | reply_service_info_ |
The service context list. | |
Private Attributes | |
TAO_ORB_Core * | orb_core_ |
Cache the ORB Core pointer. | |
char | buf_ [ACE_CDR::DEFAULT_BUFSIZE] |
The buffer that is used to initialise the data block. | |
ACE_Data_Block | db_ |
TAO_InputCDR | reply_cdr_ |
Definition at line 44 of file Synch_Reply_Dispatcher.h.
TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Synch_Reply_Dispatcher::TAO_Synch_Reply_Dispatcher | ( | TAO_ORB_Core * | orb_core, | |
IOP::ServiceContextList & | sc | |||
) |
Constructor.
Definition at line 16 of file Synch_Reply_Dispatcher.cpp.
References TAO_LF_Event::LFS_ACTIVE.
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 // As a TAO_LF_Event we start in the active state.... 00037 this->state_changed_i (TAO_LF_Event::LFS_ACTIVE); 00038 }
TAO_Synch_Reply_Dispatcher::~TAO_Synch_Reply_Dispatcher | ( | void | ) | [virtual] |
void TAO_Synch_Reply_Dispatcher::connection_closed | ( | void | ) | [virtual] |
The used for the pending reply has been closed. No reply is expected.
Implements TAO_Reply_Dispatcher.
Definition at line 114 of file Synch_Reply_Dispatcher.cpp.
References TAO_LF_Event::LFS_CONNECTION_CLOSED, and TAO_LF_Event::state_changed().
00115 { 00116 this->state_changed (TAO_LF_Event::LFS_CONNECTION_CLOSED, 00117 this->orb_core_->leader_follower ()); 00118 }
int TAO_Synch_Reply_Dispatcher::dispatch_reply | ( | TAO_Pluggable_Reply_Params & | params | ) | [virtual] |
Dispatch the reply. Return 1 on sucess, -1 on error.
Implements TAO_Reply_Dispatcher.
Definition at line 52 of file Synch_Reply_Dispatcher.cpp.
References ACE_BIT_DISABLED, ACE_ERROR, ACE_InputCDR::clone_from(), TAO_InputCDR::clr_mb_flags(), ACE_Message_Block::DONT_DELETE, ACE_Data_Block::flags(), TAO_Pluggable_Reply_Params::input_cdr_, TAO_LF_Event::LFS_SUCCESS, LM_ERROR, TAO_Pluggable_Reply_Params_Base::locate_reply_status(), TAO_Reply_Dispatcher::locate_reply_status_, ACE_Data_Block::release(), reply_cdr_, reply_service_info_, TAO_Pluggable_Reply_Params_Base::reply_status(), TAO_Reply_Dispatcher::reply_status_, TAO_LF_Event::state_changed(), TAO_Pluggable_Reply_Params_Base::svc_ctx_, and TAO_debug_level.
00054 { 00055 if (params.input_cdr_ == 0) 00056 return -1; 00057 00058 this->reply_status_ = params.reply_status (); 00059 this->locate_reply_status_ = params.locate_reply_status (); 00060 00061 // Steal the buffer, that way we don't do any unnecesary copies of 00062 // this data. 00063 CORBA::ULong const max = params.svc_ctx_.maximum (); 00064 CORBA::ULong const len = params.svc_ctx_.length (); 00065 IOP::ServiceContext* context_list = params.svc_ctx_.get_buffer (1); 00066 this->reply_service_info_.replace (max, len, context_list, 1); 00067 00068 // Must reset the message state, it is possible that the same reply 00069 // dispatcher is used because the request must be re-sent. 00070 //this->message_state_.reset (0); 00071 00072 // Transfer the <params.input_cdr_>'s content to this->reply_cdr_ 00073 if (ACE_BIT_DISABLED ((*params.input_cdr_).start()->data_block()->flags(), 00074 ACE_Message_Block::DONT_DELETE)) 00075 { 00076 // Data block is on the heap, so just duplicate it. 00077 this->reply_cdr_ = *params.input_cdr_; 00078 this->reply_cdr_.clr_mb_flags( ACE_Message_Block::DONT_DELETE ); 00079 } 00080 else 00081 { 00082 ACE_Data_Block *db = this->reply_cdr_.clone_from (*params.input_cdr_); 00083 00084 if (db == 0) 00085 { 00086 if (TAO_debug_level > 2) 00087 { 00088 ACE_ERROR ((LM_ERROR, 00089 "TAO (%P|%t) - Synch_Reply_Dispatcher::dispatch_reply " 00090 "clone_from failed \n")); 00091 } 00092 return -1; 00093 } 00094 00095 // See whether we need to delete the data block by checking the 00096 // flags. We cannot be happy that we initally allocated the 00097 // datablocks of the stack. If this method is called twice, as is in 00098 // some cases where the same invocation object is used to make two 00099 // invocations like forwarding, the release becomes essential. 00100 if (ACE_BIT_DISABLED (db->flags (), 00101 ACE_Message_Block::DONT_DELETE)) 00102 { 00103 db->release (); 00104 } 00105 } 00106 00107 this->state_changed (TAO_LF_Event::LFS_SUCCESS, 00108 this->orb_core_->leader_follower ()); 00109 00110 return 1; 00111 }
TAO_InputCDR & TAO_Synch_Reply_Dispatcher::reply_cdr | ( | void | ) |
Return the reply CDR.
Definition at line 46 of file Synch_Reply_Dispatcher.cpp.
References reply_cdr_.
Referenced by TAO::LocateRequest_Invocation::check_reply(), and TAO::Synch_Twoway_Invocation::check_reply_status().
00047 { 00048 return this->reply_cdr_; 00049 }
char TAO_Synch_Reply_Dispatcher::buf_[ACE_CDR::DEFAULT_BUFSIZE] [private] |
The buffer that is used to initialise the data block.
Definition at line 80 of file Synch_Reply_Dispatcher.h.
datablock that is created on teh stack to initialise the CDR stream underneath.
Definition at line 84 of file Synch_Reply_Dispatcher.h.
CDR stream which has the reply information that needs to be demarshalled by the stubs
Definition at line 88 of file Synch_Reply_Dispatcher.h.
Referenced by dispatch_reply(), and reply_cdr().
IOP::ServiceContextList& TAO_Synch_Reply_Dispatcher::reply_service_info_ [protected] |
The service context list.
Definition at line 66 of file Synch_Reply_Dispatcher.h.
Referenced by dispatch_reply().