diff options
author | Phil Mesnier <mesnier_p@ociweb.com> | 2011-08-18 01:35:18 +0000 |
---|---|---|
committer | Phil Mesnier <mesnier_p@ociweb.com> | 2011-08-18 01:35:18 +0000 |
commit | b9418ef0162779243f3e1a5a0dfc705d784b2079 (patch) | |
tree | 7ca258901c256aa9ee88525b218a52b8eba75fda | |
parent | ffcda438a3c6c7d419705b85956f5d2fe42a9474 (diff) | |
download | ATCD-b9418ef0162779243f3e1a5a0dfc705d784b2079.tar.gz |
Thu Aug 18 01:31:48 UTC 2011 Phil Mesnier <mesnier_p@ociweb.com>
* ace/Message_Block.cpp:
Reverted the change from Mon Aug 15 14:41:24 UTC 2011 Douglas
C. Schmidt <schmidt@dre.vanderbilt.edu>. This change caused a
regression failure that showed up on some of the TAO tests. We
can try reintroducing this patch after the upcoming release.
-rw-r--r-- | ACE/ChangeLog | 9 | ||||
-rw-r--r-- | ACE/ace/Message_Block.cpp | 151 |
2 files changed, 76 insertions, 84 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog index 8af65788180..d669a7cb47d 100644 --- a/ACE/ChangeLog +++ b/ACE/ChangeLog @@ -1,3 +1,12 @@ +Thu Aug 18 01:31:48 UTC 2011 Phil Mesnier <mesnier_p@ociweb.com> + + * ace/Message_Block.cpp: + + Reverted the change from Mon Aug 15 14:41:24 UTC 2011 Douglas + C. Schmidt <schmidt@dre.vanderbilt.edu>. This change caused a + regression failure that showed up on some of the TAO tests. We + can try reintroducing this patch after the upcoming release. + Wed Aug 17 15:01:28 UTC 2011 Phil Mesnier <mesnier_p@ociweb.com> * ACE-INSTALL.html: diff --git a/ACE/ace/Message_Block.cpp b/ACE/ace/Message_Block.cpp index 4ba74a9c125..fea01d0903c 100644 --- a/ACE/ace/Message_Block.cpp +++ b/ACE/ace/Message_Block.cpp @@ -1173,97 +1173,80 @@ ACE_Message_Block::clone (Message_Flags mask) const { ACE_TRACE ("ACE_Message_Block::clone"); - const ACE_Message_Block *old_message_block = this; - ACE_Message_Block *new_message_block = 0; - ACE_Message_Block *new_previous_message_block = 0; - ACE_Message_Block *new_root_message_block = 0; + // Get a pointer to a "cloned" <ACE_Data_Block> (will copy the + // values rather than increment the reference count). + ACE_Data_Block *db = this->data_block ()->clone (mask); - do - { - // Get a pointer to a "cloned"<ACE_Data_Block> (will copy the - // values rather than increment the reference count). - - ACE_Data_Block *db = old_message_block->data_block ()->clone (mask); - - if (db == 0) - return 0; - - if (message_block_allocator_ == 0) - { - ACE_NEW_RETURN (new_message_block, - ACE_Message_Block (0, // size - ACE_Message_Type (0), // type - 0, // cont - 0, // data - 0, // allocator - 0, // locking strategy - 0, // flags - old_message_block->priority_, // priority - ACE_EXECUTION_TIME, // execution time - ACE_DEADLINE_TIME, // absolute time to deadline - // Get a pointer to a - // "duplicated"<ACE_Data_Block> - // (will simply increment the - // reference count). - db, - db->data_block_allocator (), - old_message_block->message_block_allocator_), - 0); - } - else - { - // This is the ACE_NEW_MALLOC macro with the return check - // removed. We need to do it this way because if it fails - // we need to release the cloned data block that was created - // above. If we used ACE_NEW_MALLOC_RETURN, there would be a - // memory leak because the above db pointer would be left - // dangling. - - new_message_block = static_cast<ACE_Message_Block*> - (message_block_allocator_->malloc (sizeof (ACE_Message_Block))); - - if (new_message_block != 0) - new (new_message_block) ACE_Message_Block (0, // size - ACE_Message_Type (0), // type - 0, // cont - 0, // data - 0, // allocator - 0, // locking strategy - 0, // flags - old_message_block->priority_, // priority - ACE_EXECUTION_TIME, // execution time - ACE_DEADLINE_TIME, // absolute time to deadline - db, - db->data_block_allocator (), - old_message_block->message_block_allocator_); - } + if (db == 0) + return 0; - if (new_message_block == 0) - { - db->release (); - return 0; - } + ACE_Message_Block *nb = 0; - // Set the read and write pointers in the new <Message_Block> to - // the same relative offset as in the existing <Message_Block>. - new_message_block->rd_ptr (old_message_block->rd_ptr_); - new_message_block->wr_ptr (old_message_block->wr_ptr_); + if(message_block_allocator_ == 0) + { + ACE_NEW_RETURN (nb, + ACE_Message_Block (0, // size + ACE_Message_Type (0), // type + 0, // cont + 0, // data + 0, // allocator + 0, // locking strategy + 0, // flags + this->priority_, // priority + ACE_EXECUTION_TIME, // execution time + ACE_DEADLINE_TIME, // absolute time to deadline + // Get a pointer to a + // "duplicated" <ACE_Data_Block> + // (will simply increment the + // reference count). + db, + db->data_block_allocator (), + this->message_block_allocator_), + 0); + } + else + { + // This is the ACE_NEW_MALLOC macro with the return check removed. + // We need to do it this way because if it fails we need to release + // the cloned data block that was created above. If we used + // ACE_NEW_MALLOC_RETURN, there would be a memory leak because the + // above db pointer would be left dangling. + nb = static_cast<ACE_Message_Block*> (message_block_allocator_->malloc (sizeof (ACE_Message_Block))); + if(nb != 0) + new (nb) ACE_Message_Block (0, // size + ACE_Message_Type (0), // type + 0, // cont + 0, // data + 0, // allocator + 0, // locking strategy + 0, // flags + this->priority_, // priority + ACE_EXECUTION_TIME, // execution time + ACE_DEADLINE_TIME, // absolute time to deadline + db, + db->data_block_allocator (), + this->message_block_allocator_); + } - // Save the root message block to return. - if (new_root_message_block == 0) - new_root_message_block = new_message_block; + if (nb == 0) + { + db->release (); + return 0; + } - if (new_previous_message_block != 0) - // We're a continuation of the previous block, add ourself to - // its chain. - new_previous_message_block->cont_ = new_message_block; + // Set the read and write pointers in the new <Message_Block> to the + // same relative offset as in the existing <Message_Block>. + nb->rd_ptr (this->rd_ptr_); + nb->wr_ptr (this->wr_ptr_); - new_previous_message_block = new_message_block; - old_message_block = old_message_block->cont(); + // Clone all the continuation messages if necessary. + if (this->cont () != 0 + && (nb->cont_ = this->cont ()->clone (mask)) == 0) + { + nb->release (); + return 0; } - while (old_message_block != 0); - - return new_root_message_block; + return nb; } // This is private. |