diff options
Diffstat (limited to 'TAO/tao/Synch_Reply_Dispatcher.cpp')
-rw-r--r-- | TAO/tao/Synch_Reply_Dispatcher.cpp | 68 |
1 files changed, 27 insertions, 41 deletions
diff --git a/TAO/tao/Synch_Reply_Dispatcher.cpp b/TAO/tao/Synch_Reply_Dispatcher.cpp index d8f7fd8df1e..d901b7b93e3 100644 --- a/TAO/tao/Synch_Reply_Dispatcher.cpp +++ b/TAO/tao/Synch_Reply_Dispatcher.cpp @@ -1,17 +1,15 @@ // $Id$ -#include "tao/Synch_Reply_Dispatcher.h" -#include "tao/ORB_Core.h" -#include "tao/Pluggable_Messaging_Utils.h" -#include "tao/debug.h" +#include "Synch_Reply_Dispatcher.h" +#include "ORB_Core.h" +#include "Pluggable_Messaging_Utils.h" +#include "debug.h" ACE_RCSID (tao, Synch_Reply_Dispatcher, "$Id$") -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - // Constructor. TAO_Synch_Reply_Dispatcher::TAO_Synch_Reply_Dispatcher ( TAO_ORB_Core *orb_core, @@ -69,40 +67,30 @@ TAO_Synch_Reply_Dispatcher::dispatch_reply ( //this->message_state_.reset (0); // Transfer the <params.input_cdr_>'s content to this->reply_cdr_ - if (ACE_BIT_DISABLED ((*params.input_cdr_).start()->data_block()->flags(), + ACE_Data_Block *db = + this->reply_cdr_.clone_from (*params.input_cdr_); + + if (db == 0) + { + if (TAO_debug_level > 2) + { + ACE_ERROR ((LM_ERROR, + "TAO (%P|%t) - Synch_Reply_Dispatcher::dispatch_reply " + "clone_from failed \n")); + } + return -1; + } + + // See whether we need to delete the data block by checking the + // flags. We cannot be happy that we initally allocated the + // datablocks of the stack. If this method is called twice, as is in + // some cases where the same invocation object is used to make two + // invocations like forwarding, the release becomes essential. + if (ACE_BIT_DISABLED (db->flags (), ACE_Message_Block::DONT_DELETE)) - { - // Data block is on the heap, so just duplicate it. - this->reply_cdr_ = *params.input_cdr_; - this->reply_cdr_.clr_mb_flags( ACE_Message_Block::DONT_DELETE ); - } - else - { - ACE_Data_Block *db = - this->reply_cdr_.clone_from (*params.input_cdr_); - - if (db == 0) - { - if (TAO_debug_level > 2) - { - ACE_ERROR ((LM_ERROR, - "TAO (%P|%t) - Synch_Reply_Dispatcher::dispatch_reply " - "clone_from failed \n")); - } - return -1; - } - - // See whether we need to delete the data block by checking the - // flags. We cannot be happy that we initally allocated the - // datablocks of the stack. If this method is called twice, as is in - // some cases where the same invocation object is used to make two - // invocations like forwarding, the release becomes essential. - if (ACE_BIT_DISABLED (db->flags (), - ACE_Message_Block::DONT_DELETE)) - { - db->release (); - } - } + { + db->release (); + } this->state_changed (TAO_LF_Event::LFS_SUCCESS, this->orb_core_->leader_follower ()); @@ -116,5 +104,3 @@ TAO_Synch_Reply_Dispatcher::connection_closed (void) this->state_changed (TAO_LF_Event::LFS_CONNECTION_CLOSED, this->orb_core_->leader_follower ()); } - -TAO_END_VERSIONED_NAMESPACE_DECL |