From 1a7c82f463ac85060b31e8b51d97a332ae7d097b Mon Sep 17 00:00:00 2001 From: Chris Cleeland Date: Thu, 20 Mar 2003 18:40:13 +0000 Subject: Bug fixes and changes leading up to first merge back to OCI repo. --- TAO/PMBChangeLog | 17 +++++++++ .../orbsvcs/PortableGroup/UIPMC_Transport.cpp | 34 +++++++++++------- TAO/tao/Strategies/DIOP_Transport.cpp | 42 ++++++++++++++++------ TAO/tao/Transport.cpp | 6 ++-- 4 files changed, 72 insertions(+), 27 deletions(-) diff --git a/TAO/PMBChangeLog b/TAO/PMBChangeLog index e959cb8a7f5..1957ebeea87 100644 --- a/TAO/PMBChangeLog +++ b/TAO/PMBChangeLog @@ -1,3 +1,20 @@ +Thu Mar 20 12:34:24 2003 Chris Cleeland + + * all: First merge back to OCI. + +Thu Mar 20 12:17:23 2003 Chris Cleeland + + * tao/Strategies/DIOP_Transport.cpp (handle_input_i): + * orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.cpp + (handle_input_i): + + Update to use new parsing and message processing methods + consistent with PMB changes. + + * tao/Transport.cpp (process_queue_head): Corrected a possible memory + leak where, if process_parsed_messages returned with an error, + the TAO_Queued_Data instance wouldn't be released. + Tue Mar 18 14:57:07 2003 Chris Cleeland * VERSION: diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.cpp index 7645ae8a839..c6a6b6abfda 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.cpp @@ -591,7 +591,7 @@ TAO_UIPMC_Transport::handle_input_i (TAO_Resume_Handle &rh, // Read the message into the message block that we have created on // the stack. - ssize_t n = this->recv (message_block.rd_ptr (), + ssize_t n = this->recv (message_block.wr_ptr (), message_block.space (), max_wait_time); @@ -615,14 +615,14 @@ TAO_UIPMC_Transport::handle_input_i (TAO_Resume_Handle &rh, // Set the write pointer in the stack buffer. message_block.wr_ptr (n); - // Parse the incoming message for validity. The check needs to be + // Check the incoming message for validity. The check needs to be // performed by the messaging objects. - if (this->parse_incoming_messages (message_block) == -1) + if (this->messaging_object ()->check_for_valid_header (message_block) == 0) { if (TAO_debug_level) { ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO: (%P|%t|%N|%l) parse_incoming_messages failed on transport %d after fault %p\n"), + ACE_TEXT ("TAO: (%P|%t|%N|%l) failed to find a valid header on transport %d after fault %p\n"), this->id (), ACE_TEXT ("handle_input_i ()\n"))); } @@ -631,17 +631,27 @@ TAO_UIPMC_Transport::handle_input_i (TAO_Resume_Handle &rh, } // NOTE: We are not performing any queueing nor any checking for - // missing data. We are assuming that ALL the data would be got in a + // missing data. We are assuming that ALL the data arrives in a // single read. // Make a node of the message block.. - TAO_Queued_Data qd (&message_block); - - // Extract the data for the node.. - this->messaging_object ()->get_message_data (&qd); - - // Process the message - return this->process_parsed_messages (&qd, rh); + // + // We could make this more efficient by having a fixed Queued Data + // allocator, i.e., it always gave back the same thing. Actually, + // we *could* create an allocator that took a stack-allocated object + // as an argument and returned that when asked an allocation is + // done. Something to contemplate... + TAO_Queued_Data* qd = + TAO_Queued_Data::make_completed_message (message_block, + *this->messaging_object ()); + int retval = -1; + if (qd) + { + // Process the message + retval = this->process_parsed_messages (qd, rh); + TAO_Queued_Data::release (qd); + } + return retval; } int diff --git a/TAO/tao/Strategies/DIOP_Transport.cpp b/TAO/tao/Strategies/DIOP_Transport.cpp index 7ddea78ace5..531f02e35e1 100644 --- a/TAO/tao/Strategies/DIOP_Transport.cpp +++ b/TAO/tao/Strategies/DIOP_Transport.cpp @@ -216,23 +216,43 @@ TAO_DIOP_Transport::handle_input_i (TAO_Resume_Handle &rh, // Set the write pointer in the stack buffer message_block.wr_ptr (n); - // Parse the incoming message for validity. The check needs to be + // Check the incoming message for validity. The check needs to be // performed by the messaging objects. - if (this->parse_incoming_messages (message_block) == -1) - return -1; + if (this->messaging_object ()->check_for_valid_header (message_block) == 0) + { + if (TAO_debug_level) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO: (%P|%t|%N|%l) failed to find a valid header on transport %d after fault %p\n"), + this->id (), + ACE_TEXT ("handle_input_i ()\n"))); + } + + return -1; + } // NOTE: We are not performing any queueing nor any checking for - // missing data. We are assuming that ALL the data would be got in a + // missing data. We are assuming that ALL the data arrives in a // single read. // Make a node of the message block.. - TAO_Queued_Data qd (&message_block); - - // Extract the data for the node.. - this->messaging_object ()->get_message_data (&qd); - - // Process the message - return this->process_parsed_messages (&qd, rh); + // + // We could make this more efficient by having a fixed Queued Data + // allocator, i.e., it always gave back the same thing. Actually, + // we *could* create an allocator that took a stack-allocated object + // as an argument and returned that when asked an allocation is + // done. Something to contemplate... + TAO_Queued_Data* qd = + TAO_Queued_Data::make_completed_message (message_block, + *this->messaging_object ()); + int retval = -1; + if (qd) + { + // Process the message + retval = this->process_parsed_messages (qd, rh); + TAO_Queued_Data::release (qd); + } + return retval; } diff --git a/TAO/tao/Transport.cpp b/TAO/tao/Transport.cpp index 3a76879c67a..decc6c359b2 100644 --- a/TAO/tao/Transport.cpp +++ b/TAO/tao/Transport.cpp @@ -1970,14 +1970,12 @@ TAO_Transport::process_queue_head (TAO_Resume_Handle &rh) } // Process the message... - if (this->process_parsed_messages (qd, - rh) == -1) - return -1; + int retval = this->process_parsed_messages (qd, rh); // Delete the Queued_Data.. TAO_Queued_Data::release (qd); - return 0; + return retval; } int -- cgit v1.2.1