From 54b09c0289ccd58a8fc6299a38d9096e17ae95fd Mon Sep 17 00:00:00 2001 From: coryan Date: Wed, 7 Mar 2001 03:59:37 +0000 Subject: ChangeLogTag:Tue Mar 6 19:44:44 2001 Carlos O'Ryan --- TAO/ChangeLogs/ChangeLog-02a | 19 ++++++++++++ TAO/tao/GIOP_Message_Handler.cpp | 2 +- TAO/tao/ORB_Core.cpp | 8 ++++- TAO/tao/Transport.cpp | 60 ++++++++++++++++++++++++------------- TAO/tao/Wait_On_Leader_Follower.cpp | 7 +---- 5 files changed, 67 insertions(+), 29 deletions(-) diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index d9f9a74ab35..7c195bd6017 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,3 +1,22 @@ +Tue Mar 6 19:44:44 2001 Carlos O'Ryan + + * tao/GIOP_Message_Handler.cpp: + When printing an invalid GIOP magic number use hex values, not + the character representation, because the latter can print out + garbage. + + * tao/ORB_Core.cpp: + Print the return value of each handle_events() call, on an + attempt to figure out why it is spinning. + + * tao/Transport.cpp: + Print handle, return value and errno after each call to + send_current_message() + + * tao/Wait_On_Leader_Follower.cpp: + Don't enter the event loop if the reply has been received + already. + Tue Mar 6 11:02:43 2001 Carlos O'Ryan * Merged in changes from the fix_bug132 branch. I need several diff --git a/TAO/tao/GIOP_Message_Handler.cpp b/TAO/tao/GIOP_Message_Handler.cpp index a5a98781e69..c0b0459a1bb 100644 --- a/TAO/tao/GIOP_Message_Handler.cpp +++ b/TAO/tao/GIOP_Message_Handler.cpp @@ -189,7 +189,7 @@ TAO_GIOP_Message_Handler::parse_magic_bytes (void) // For the present... if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) bad header, magic word [%c%c%c%c]\n"), + ACE_TEXT ("TAO (%P|%t) bad header, magic word [%2.2x%2.2x%2.2x%2.2x]\n"), buf[0], buf[1], buf[2], diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index 2e487560f0f..2cc6b37286f 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -1920,9 +1920,15 @@ TAO_ORB_Core::run (ACE_Time_Value *tv, if (TAO_debug_level >= 3) ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) - blocking on handle events\n"))); + ACE_TEXT ("TAO (%P|%t) - calling handle_events\n"))); + result = r->handle_events (tv); + if (TAO_debug_level >= 3) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) - handle_events returns %d\n"), + result)); + if (result == -1) { // An error, terminate the loop diff --git a/TAO/tao/Transport.cpp b/TAO/tao/Transport.cpp index 847a8b92c4d..0854ae28538 100644 --- a/TAO/tao/Transport.cpp +++ b/TAO/tao/Transport.cpp @@ -71,32 +71,45 @@ TAO_Transport::handle_output () { if (TAO_debug_level > 4) { - ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - handle_output\n")); + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - handle_output (%d)\n", + this->handle ())); } - // The reactor is asking us to send more data, first check if - // there is a current message that needs more sending: - int result = this->send_current_message (); - while (result > 0) + int retval; + do { - // ... there is no current message or it was completely - // sent, time to check the queue.... - result = this->dequeue_next_message (); - if (result == 1) + // The reactor is asking us to send more data, first check if + // there is a current message that needs more sending: + retval = this->send_current_message (); + + if (TAO_debug_level > 4) { - (void) this->cancel_output (); - return 0; + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - send_current_message (%d) %d/%d\n", + this->handle (), + retval, + errno)); } - result = this->send_current_message (); - } - // else { there was an error.... } - if (result == -1) - return -1; // There was an error, return -1 so the Reactor + if (retval == 1) + { + // ... there is no current message or it was completely + // sent, time to check the queue.... + int dequeue = this->dequeue_next_message (); + if (dequeue == -1) + { + // ... no more messages in the queue, cancel output... + (void) this->cancel_output (); + return 0; + } + } + // ... on Win32 we must continue until we get EWOULDBLOCK ... + } + while (retval > 0); - // There is no more data or socket blocked, just return 0 - /* if (result >= 0) */ - return 0; + // Any errors are returned directly to the Reactor + return retval; } int @@ -204,7 +217,12 @@ TAO_Transport::send_current_message (void) this->current_message_ = 0; if (retval == -1) - return -1; + { + if (errno == EWOULDBLOCK || errno == ETIME) + return 0; + + return -1; + } return 1; } @@ -228,7 +246,7 @@ TAO_Transport::dequeue_next_message (void) { ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->queue_mutex_, -1); if (this->head_ == 0) - return 1; + return -1; this->current_message_ = this->head_; this->head_->remove_from_list (this->head_, this->tail_); diff --git a/TAO/tao/Wait_On_Leader_Follower.cpp b/TAO/tao/Wait_On_Leader_Follower.cpp index 8e8308c96fd..ed2b4034a46 100644 --- a/TAO/tao/Wait_On_Leader_Follower.cpp +++ b/TAO/tao/Wait_On_Leader_Follower.cpp @@ -216,16 +216,11 @@ TAO_Wait_On_Leader_Follower::wait (ACE_Time_Value *max_wait_time, ACE_TEXT ("TAO (%P|%t) - wait (leader):to enter reactor event loop on <%x>\n"), this->transport_)); - while (1) + while (!reply_received) { // Run the event loop. result = reactor->handle_events (max_wait_time); - // If we got our reply, no need to run the event loop any - // further. - if (reply_received) - break; - // Did we timeout? If so, stop running the loop. if (result == 0 && max_wait_time != 0 && -- cgit v1.2.1