diff options
author | bala <balanatarajan@users.noreply.github.com> | 2001-07-04 21:17:51 +0000 |
---|---|---|
committer | bala <balanatarajan@users.noreply.github.com> | 2001-07-04 21:17:51 +0000 |
commit | 56c79625f002133bec26ef7e2637c37151dca7d4 (patch) | |
tree | 416c685146dd09cefa90f82abdeb097d4d1426b4 | |
parent | 97c99a7123f6ac555b1c726d9798d47466bbe56b (diff) | |
download | ATCD-56c79625f002133bec26ef7e2637c37151dca7d4.tar.gz |
ChangeLogTag:Wed Jul 4 16:21:22 2001 Balachandran Natarajan <bala@cs.wustl.edu>
-rw-r--r-- | TAO/tao/IIOP_Transport.cpp | 3 | ||||
-rw-r--r-- | TAO/tao/LIST_OF_TODO | 5 | ||||
-rw-r--r-- | TAO/tao/Transport.cpp | 99 | ||||
-rw-r--r-- | TAO/tao/Transport.h | 26 |
4 files changed, 89 insertions, 44 deletions
diff --git a/TAO/tao/IIOP_Transport.cpp b/TAO/tao/IIOP_Transport.cpp index 0d42ca99802..d3c664db9af 100644 --- a/TAO/tao/IIOP_Transport.cpp +++ b/TAO/tao/IIOP_Transport.cpp @@ -103,9 +103,6 @@ TAO_IIOP_Transport::recv_i (char *buf, if (errno == EWOULDBLOCK) return 0; - // Close the connection - this->tms_->connection_closed (); - return -1; } // @@ What are the other error handling here?? diff --git a/TAO/tao/LIST_OF_TODO b/TAO/tao/LIST_OF_TODO index 4754802f16e..772b4c4d8c0 100644 --- a/TAO/tao/LIST_OF_TODO +++ b/TAO/tao/LIST_OF_TODO @@ -7,9 +7,12 @@ - AMI tests - run purify quantify - DSI_Gateway tests +- In the Longupcalls change the readme and put a new run_test.pl - Go through the code again & again... -- Put tms_->close_connection () wherever we get -1 as a retval.. +- Put tms_->close_connection () wherever we get -1 as a retval. Remove + that from recv_i () of pther protocols.. - Optimize outgoing CDR's, I mean get it on stack.. - Dont we want a cached transport on the server side... - Multi-threaded Single_Read test.. - look for better print outs in Message State..======= +- other protocols
\ No newline at end of file diff --git a/TAO/tao/Transport.cpp b/TAO/tao/Transport.cpp index fe4ed69c630..ff6d584ceb4 100644 --- a/TAO/tao/Transport.cpp +++ b/TAO/tao/Transport.cpp @@ -796,8 +796,18 @@ TAO_Transport::handle_input_i (TAO_Resume_Handle &rh, if (retval <= 0) { + if (retval == -1) + { + if (TAO_debug_level > 2) + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) TAO::handle_input_i," + "error while parsing the head of the queue \n")); + + this->tms_->connection_closed (); + } return retval; } + // If there are no messages then we can go ahead to read from the // handle for further reading.. @@ -832,13 +842,16 @@ TAO_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 (), - message_block.space (), - max_wait_time); + ssize_t n = this->recv (message_block.rd_ptr (), + message_block.space (), + max_wait_time); + // If there is an error return to the reactor.. if (n <= 0) { + if (n == -1) + this->tms_->connection_closed (); + return n; } @@ -852,6 +865,8 @@ TAO_Transport::handle_input_i (TAO_Resume_Handle &rh, // Set the write pointer in the stack buffer message_block.wr_ptr (n); + // Parse the message and try consolidating the message if + // needed. retval = this->parse_consolidate_messages (message_block, rh, max_wait_time); @@ -861,9 +876,8 @@ TAO_Transport::handle_input_i (TAO_Resume_Handle &rh, if (retval == -1 && TAO_debug_level > 0) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport::handle_input_i [%d] " - "Error while parsing and consolidating \n", - n)); + "TAO (%P|%t) - Transport::handle_input_i " + "error while parsing and consolidating \n")); } return retval; } @@ -896,7 +910,7 @@ TAO_Transport::parse_consolidate_messages (ACE_Message_Block &block, if (missing_data < 0) { - // If we have read too many messages.. + // If we have more than one message return this->consolidate_extra_messages (block, rh); } @@ -914,28 +928,28 @@ TAO_Transport::parse_consolidate_messages (ACE_Message_Block &block, } int -TAO_Transport::parse_incoming_messages (ACE_Message_Block &message_block) +TAO_Transport::parse_incoming_messages (ACE_Message_Block &block) { // If we have a queue and if the last message is not complete a // complete one, then this read will get us the remaining data. So // do not try to parse the header if we have an incomplete message // in the queue. - if (this->incoming_message_queue_.is_tail_complete () == 0) + if (this->incoming_message_queue_.is_tail_complete () != 0) { - return 0; - } + // As it looks like a new message has been read, process the + // message. Call the messaging object to do the parsing.. + int retval = + this->messaging_object ()->parse_incoming_messages (block); - // Now that a new message has been read, process the message. Call - // the messaging object to do the parsing - if (this->messaging_object ()->parse_incoming_messages (message_block) == -1) - { - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) - %p\n"), - ACE_TEXT ("TAO (%P|%t) - error in incoming message \n"))); + if (retval == -1) + { + if (TAO_debug_level > 2) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) - error in incoming message \n"))); - this->tms_->connection_closed (); - return -1; + this->tms_->connection_closed (); + return -1; + } } return 0; @@ -962,13 +976,12 @@ TAO_Transport::consolidate_message (ACE_Message_Block &incoming, TAO_Resume_Handle &rh, ACE_Time_Value *max_wait_time) { + // Checek whether the last message in the queue is complete.. if (this->incoming_message_queue_.is_tail_complete () == 0) - { - return this->consolidate_message_queue (incoming, - missing_data, - rh, - max_wait_time); - } + return this->consolidate_message_queue (incoming, + missing_data, + rh, + max_wait_time); // Calculate the actual length of the load that we are supposed to // read which is equal to the <missing_data> + length of the buffer @@ -986,7 +999,20 @@ TAO_Transport::consolidate_message (ACE_Message_Block &incoming, // If we got an EWOULDBLOCK or some other error.. if (n <= 0) - return n; + { + if (n == -1) + { + if (TAO_debug_level > 4) + { + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - TAO_Trasport::consolidate_message," + "error while trying to consolidate \n")); + } + this->tms_->connection_closed (); + } + + return n; + } // Move the write pointer incoming.wr_ptr (n); @@ -996,27 +1022,30 @@ TAO_Transport::consolidate_message (ACE_Message_Block &incoming, if (missing_data > 0) { - // Duplicate the message block - ACE_Message_Block *mb = - incoming.duplicate (); - // Get an instance of TAO_Queued_Data TAO_Queued_Data *qd = TAO_Queued_Data::get_queued_data (); + // Add the missing data to the queue qd->missing_data_ = missing_data; - qd->msg_block_ = mb; + // Duplicate the data block before putting it in the queue. + qd->msg_block_ = incoming.duplicate (); + + // Get the rest of the messaging data this->messaging_object ()->get_message_data (qd); + // Add it to the tail of the queue.. this->incoming_message_queue_.enqueue_tail (qd); return 0; } + // We dont have any missing data. Just make a queued_data node with + // the existing message block and send it to the higher layers of + // the ORB. TAO_Queued_Data pqd (&incoming); pqd.missing_data_ = missing_data; - this->messaging_object ()->get_message_data (&pqd); // Resume the handle before processing the request diff --git a/TAO/tao/Transport.h b/TAO/tao/Transport.h index e60c63f1005..69dad7903f8 100644 --- a/TAO/tao/Transport.h +++ b/TAO/tao/Transport.h @@ -611,28 +611,44 @@ protected: /// Called by the handle_input_i (). This method is used to parse - /// message just read. It also decides whether the message - // @@Bala: Documentation??? + /// message read by the handle_input_i () call. It also decides + /// whether the message needs consolidation before processing. int parse_consolidate_messages (ACE_Message_Block &bl, TAO_Resume_Handle &rh, - ACE_Time_Value *time); + ACE_Time_Value *time = 0); + + /// Method does parsing of the message if we have a fresh message in + /// the <message_block> or just returns if we have read part of the + /// previously stored message. int parse_incoming_messages (ACE_Message_Block &message_block); + /// Return if we have any missing data in the queue of messages + /// or determine if we have more information left out in the + /// presently read message to make it complete. size_t missing_data (ACE_Message_Block &message_block); - int check_message_integrity (ACE_Message_Block &message_block); - + /// Consolidate the currently read message or consolidate the last + /// message in the queue. The consolidation of the last message in + /// the queue is done by calling consolidate_message_queue (). virtual int consolidate_message (ACE_Message_Block &incoming, ssize_t missing_data, TAO_Resume_Handle &rh, ACE_Time_Value *max_wait_time); + /// First consolidate the message queue. If the message is still not + /// complete, try to read from the handle again to make it + /// complete. If these dont help put the message back in the queue + /// and try to check the queue if we have message to process. (the + /// thread needs to do some work anyway :-)) int consolidate_message_queue (ACE_Message_Block &incoming, ssize_t missing_data, TAO_Resume_Handle &rh, ACE_Time_Value *max_wait_time); + /// Called by parse_consolidate_message () if we have more messages + /// in one read. Queue up the messages and try to process one of + /// them, atleast at the head of them. int consolidate_extra_messages (ACE_Message_Block &incoming, TAO_Resume_Handle &rh); |