diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-06-14 18:13:49 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-06-14 18:13:49 +0000 |
commit | 59901f050591c04475d65acb1df0d8649861a11e (patch) | |
tree | 429110387dde74ee0b5ce0d303596b3a8dd8fee0 /TAO/tao/IIOP_Connection_Handler.cpp | |
parent | d68a49f366b819cf2e690e327a41b4a3f1a7ce78 (diff) | |
download | ATCD-59901f050591c04475d65acb1df0d8649861a11e.tar.gz |
ChangeLogTag:Fri Jun 14 13:58:56 2002 Carlos O'Ryan <coryan@atdesk.com>
Diffstat (limited to 'TAO/tao/IIOP_Connection_Handler.cpp')
-rw-r--r-- | TAO/tao/IIOP_Connection_Handler.cpp | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/TAO/tao/IIOP_Connection_Handler.cpp b/TAO/tao/IIOP_Connection_Handler.cpp index fb8819e806f..fe4506dc6aa 100644 --- a/TAO/tao/IIOP_Connection_Handler.cpp +++ b/TAO/tao/IIOP_Connection_Handler.cpp @@ -194,38 +194,44 @@ int TAO_IIOP_Connection_Handler::handle_close (ACE_HANDLE handle, ACE_Reactor_Mask rm) { - // @@ Alex: we need to figure out if the transport decides to close - // us or something else. If it is something else (for example - // the cached connector trying to make room for other - // connections) then we should let the transport know, so it can - // in turn take appropiate action (such as sending exceptions to - // all waiting reply handlers). + ACE_HANDLE my_handle = this->get_handle (); + if (TAO_debug_level) - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("TAO (%P|%t) ") - ACE_LIB_TEXT ("IIOP_Connection_Handler::handle_close ") - ACE_LIB_TEXT ("(%d, %d)\n"), - handle, - rm)); + { + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - IIOP_Connection_Handler[%d]::handle_close, " + "(%d, %d)\n", + my_handle, handle, rm)); + } + + if(my_handle == ACE_INVALID_HANDLE) + { + return 0; + } + + // Just close the socket irrespective of what the upcall count is, + // we need to cleanup OS resources ASAP. + this->peer().close (); + + // Set the handle to be INVALID_HANDLE + this->set_handle (ACE_INVALID_HANDLE); + this->state_changed (TAO_LF_Event::LFS_CONNECTION_CLOSED); + + // @@ TODO All this code dealing with upcalls is fishy, upcalls are + // incremented/decremented in handle_input_i(), and only + // decremented here! Also: the reference count is decremented + // here, while it is incremented in a selected few other places, + // in a very confusing ways. long upcalls = this->decr_pending_upcalls (); + // @@ TODO This is just bogus, a reference count below zero + // indicates a bug, should be ACE_ASSERT'ed and crash the ORB + // during testing! // Just return incase the upcall count goes below 0. if (upcalls < 0) return 0; - if (this->get_handle () != ACE_INVALID_HANDLE) - { - // Just close the socket irrespective of what the upcall count - // is. - this->peer().close (); - - // Set the handle to be INVALID_HANDLE - this->set_handle (ACE_INVALID_HANDLE); - } - - this->state_changed (TAO_LF_Event::LFS_CONNECTION_CLOSED); - // If the upcall count is zero start the cleanup. if (upcalls == 0) this->decr_refcount (); |