summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoroci <oci@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-05-04 19:12:53 +0000
committeroci <oci@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-05-04 19:12:53 +0000
commitbc3313db39915846c94a5ccbc0155f5ca72e461a (patch)
tree114bb4ffff4644c69294e4425e4dc5560d8f5847
parentfe0ce34c66453f87c7714a6458cffea456f24c5b (diff)
downloadATCD-bc3313db39915846c94a5ccbc0155f5ca72e461a.tar.gz
ChangeLogTag: Fri May 4 14:11:36 2001 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r--TAO/ChangeLogs/ChangeLog-02a18
-rw-r--r--TAO/tao/ORB_Core.cpp13
-rw-r--r--TAO/tao/Transport.cpp16
-rw-r--r--TAO/tao/Transport.h12
-rw-r--r--TAO/tao/Transport_Cache_Manager.cpp16
-rw-r--r--TAO/tao/Transport_Cache_Manager.h10
-rw-r--r--TAO/tao/Transport_Cache_Manager.inl5
-rw-r--r--TAO/tao/Wait_On_Read.cpp10
8 files changed, 81 insertions, 19 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a
index e6fb8569830..2b7f27880c0 100644
--- a/TAO/ChangeLogs/ChangeLog-02a
+++ b/TAO/ChangeLogs/ChangeLog-02a
@@ -1,3 +1,21 @@
+Fri May 4 14:11:36 2001 Chad Elliott <elliott_c@ociweb.com>
+
+ * tao/ORB_Core.cpp:
+ * tao/Transport.cpp:
+ * tao/Transport.h:
+ * tao/Transport_Cache_Manager.cpp:
+ * tao/Transport_Cache_Manager.h:
+ * tao/Transport_Cache_Manager.inl:
+
+ Added code to clean up unregistered connection handlers at ORB
+ shutdown.
+
+ * tao/Wait_On_Read.cpp:
+
+ Close the transport if we get a -1 from the call to
+ read_process_message() on the transport. This indicates an error,
+ in which case we need to clean up the connection handler.
+
Fri May 4 12:08:55 2001 Jeff Parsons <parsons@cs.wustl.edu>
* tao/NVList.cpp:
diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp
index a09bd913ae8..398b7c25400 100644
--- a/TAO/tao/ORB_Core.cpp
+++ b/TAO/tao/ORB_Core.cpp
@@ -1189,10 +1189,11 @@ TAO_ORB_Core::fini (void)
// as the Singleton reactor, is used instead of an ORB created one.
ACE_Handle_Set handle_set;
+ TAO_EventHandlerSet unregistered;
// Close the transport cache and return the handle set that needs
// to be de-registered from the reactor.
- this->transport_cache_.close (handle_set);
+ this->transport_cache_.close (handle_set, unregistered);
// Shutdown all open connections that are registered with the ORB
// Core. Note that the ACE_Event_Handler::DONT_CALL mask is NOT
@@ -1203,6 +1204,16 @@ TAO_ORB_Core::fini (void)
if (handle_set.num_set () > 0)
(void) this->reactor ()->remove_handler (handle_set,
ACE_Event_Handler::ALL_EVENTS_MASK);
+ if (!unregistered.is_empty ())
+ {
+ ACE_Event_Handler** eh;
+ for (TAO_EventHandlerSetIterator iter(unregistered);
+ iter.next (eh); iter.advance())
+ {
+ (*eh)->handle_close (ACE_INVALID_HANDLE,
+ ACE_Event_Handler::ALL_EVENTS_MASK);
+ }
+ }
// Pass reactor back to the resource factory.
if (this->resource_factory_ != 0)
diff --git a/TAO/tao/Transport.cpp b/TAO/tao/Transport.cpp
index 42e8b28739e..54fd4285a67 100644
--- a/TAO/tao/Transport.cpp
+++ b/TAO/tao/Transport.cpp
@@ -152,7 +152,8 @@ TAO_Transport::handle_output ()
}
void
-TAO_Transport::provide_handle (ACE_Handle_Set &handle_set)
+TAO_Transport::provide_handle (ACE_Handle_Set &reactor_registered,
+ TAO_EventHandlerSet &unregistered)
{
ACE_MT (ACE_GUARD (ACE_Lock,
guard,
@@ -160,8 +161,17 @@ TAO_Transport::provide_handle (ACE_Handle_Set &handle_set)
ACE_Event_Handler *eh = this->event_handler_i ();
// TAO_Connection_Handler *ch = ACE_reinterpret_cast (TAO_Connection_Handler *, eh);
- if (eh && this->ws_->is_registered ())
- handle_set.set_bit (eh->get_handle ());
+ if (eh != 0)
+ {
+ if (this->ws_->is_registered ())
+ {
+ reactor_registered.set_bit (eh->get_handle ());
+ }
+ else
+ {
+ unregistered.insert (eh);
+ }
+ }
}
static void
diff --git a/TAO/tao/Transport.h b/TAO/tao/Transport.h
index 04ec3c06c71..68f674088de 100644
--- a/TAO/tao/Transport.h
+++ b/TAO/tao/Transport.h
@@ -211,10 +211,16 @@ public:
/**
* Called by the cache when the cache is closing in order to fill
* in a handle_set in a lock-safe manner.
- * @param handle_set the ACE_Handle_Set into which the transport
- * should place any handle registered with the reactor
+ *
+ * @param reactor_registered the ACE_Handle_Set into which the
+ * transport should place any handle registered with the reactor
+ *
+ * @param unregistered the TAO_EventHandlerSet into which the
+ * transport should place any event handler that is not registered
+ * with anyone
*/
- void provide_handle (ACE_Handle_Set &handle_set);
+ void provide_handle (ACE_Handle_Set &reactor_registered,
+ TAO_EventHandlerSet &unregistered);
/// Extracts the list of listen points from the <cdr> stream. The
/// list would have the protocol specific details of the
diff --git a/TAO/tao/Transport_Cache_Manager.cpp b/TAO/tao/Transport_Cache_Manager.cpp
index ea6e9c3b7c3..2197b1c56ea 100644
--- a/TAO/tao/Transport_Cache_Manager.cpp
+++ b/TAO/tao/Transport_Cache_Manager.cpp
@@ -254,7 +254,8 @@ TAO_Transport_Cache_Manager::make_idle_i (HASH_MAP_ENTRY *&entry)
int
-TAO_Transport_Cache_Manager::close_i (ACE_Handle_Set &handle_set)
+TAO_Transport_Cache_Manager::close_i (ACE_Handle_Set &reactor_registered,
+ TAO_EventHandlerSet &unregistered)
{
for (HASH_MAP_ITER iter = this->cache_map_.begin ();
iter != this->cache_map_.end ();
@@ -274,12 +275,13 @@ TAO_Transport_Cache_Manager::close_i (ACE_Handle_Set &handle_set)
// rather than doing it here. That way, the locking is correct.
if ((*iter).int_id_.handler ()->is_registered ())
{
- handle_set.set_bit ((*iter).int_id_.handler ()->fetch_handle ());
+ reactor_registered.set_bit ((*iter).int_id_.handler ()->fetch_handle ());
}
#else
// Get the transport to fill its associated connection's handle in
- // the handle_set.
- (*iter).int_id_.transport ()->provide_handle (handle_set);
+ // the handle sets.
+ (*iter).int_id_.transport ()->provide_handle (reactor_registered,
+ unregistered);
#endif
// Inform the transport that has a reference to the entry in the
// map that we are *gone* now. So, the transport should not use
@@ -385,6 +387,9 @@ template class ACE_Hash_Map_Manager_Ex<TAO_Cache_ExtId, TAO_Cache_IntId, ACE_Has
template class ACE_Hash_Map_Iterator_Base_Ex<TAO_Cache_ExtId, TAO_Cache_IntId, ACE_Hash<TAO_Cache_ExtId>, ACE_Equal_To<TAO_Cache_ExtId>, ACE_Null_Mutex>;
template class ACE_Hash_Map_Iterator_Ex<TAO_Cache_ExtId, TAO_Cache_IntId, ACE_Hash<TAO_Cache_ExtId>, ACE_Equal_To<TAO_Cache_ExtId>, ACE_Null_Mutex>;
template class ACE_Hash_Map_Reverse_Iterator_Ex<TAO_Cache_ExtId, TAO_Cache_IntId, ACE_Hash<TAO_Cache_ExtId>, ACE_Equal_To<TAO_Cache_ExtId>, ACE_Null_Mutex>;
+template class ACE_Unbounded_Set<ACE_Event_Handler*>;
+template class ACE_Unbounded_Set_Iterator<ACE_Event_Handler*>;
+template class ACE_Node<ACE_Event_Handler*>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
@@ -399,5 +404,8 @@ template class ACE_Hash_Map_Reverse_Iterator_Ex<TAO_Cache_ExtId, TAO_Cache_IntId
#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<TAO_Cache_ExtId, TAO_Cache_IntId, ACE_Hash<TAO_Cache_ExtId>, ACE_Equal_To<TAO_Cache_ExtId>, ACE_Null_Mutex>
#pragma instantiate ACE_Hash_Map_Iterator_Ex<TAO_Cache_ExtId, TAO_Cache_IntId, ACE_Hash<TAO_Cache_ExtId>, ACE_Equal_To<TAO_Cache_ExtId>, ACE_Null_Mutex>
#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<TAO_Cache_ExtId, TAO_Cache_IntId, ACE_Hash<TAO_Cache_ExtId>, ACE_Equal_To<TAO_Cache_ExtId>, ACE_Null_Mutex>
+#pragma instantiate ACE_Unbounded_Set<ACE_Event_Handler*>
+#pragma instantiate ACE_Unbounded_Set_Iterator<ACE_Event_Handler*>
+#pragma instantiate ACE_Node<ACE_Event_Handler*>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/tao/Transport_Cache_Manager.h b/TAO/tao/Transport_Cache_Manager.h
index e4868001f61..03e8bac1840 100644
--- a/TAO/tao/Transport_Cache_Manager.h
+++ b/TAO/tao/Transport_Cache_Manager.h
@@ -34,6 +34,10 @@
class TAO_ORB_Core;
class ACE_Handle_Set;
+typedef ACE_Unbounded_Set<ACE_Event_Handler*> TAO_EventHandlerSet;
+typedef ACE_Unbounded_Set_Iterator<ACE_Event_Handler*>
+ TAO_EventHandlerSetIterator;
+
/**
* @class TAO_Transport_Cache_Manager
*
@@ -139,7 +143,8 @@ public:
/// Close the underlying hash map manager and return the handle set
/// that have been registered with the reactor
- int close (ACE_Handle_Set &handle_set);
+ int close (ACE_Handle_Set &reactor_registered,
+ TAO_EventHandlerSet &unregistered);
/// Return the current size of the cache.
size_t current_size (void) const;
@@ -188,7 +193,8 @@ private:
int make_idle_i (HASH_MAP_ENTRY *&entry);
/// Non-locking version and actual implementation of close ()
- int close_i (ACE_Handle_Set &handle_set);
+ int close_i (ACE_Handle_Set &reactor_registered,
+ TAO_EventHandlerSet &unregistered);
/// Purge the entry from the Cache Map
int purge_entry_i (HASH_MAP_ENTRY *&entry);
diff --git a/TAO/tao/Transport_Cache_Manager.inl b/TAO/tao/Transport_Cache_Manager.inl
index 0b5932ee694..49afd1d472d 100644
--- a/TAO/tao/Transport_Cache_Manager.inl
+++ b/TAO/tao/Transport_Cache_Manager.inl
@@ -134,7 +134,8 @@ TAO_Transport_Cache_Manager::make_idle (HASH_MAP_ENTRY *&entry)
ACE_INLINE int
-TAO_Transport_Cache_Manager::close (ACE_Handle_Set &handle_Set)
+TAO_Transport_Cache_Manager::close (ACE_Handle_Set &reactor_registered,
+ TAO_EventHandlerSet &unregistered)
{
// The cache lock pointer should only be zero if
// Transport_Cache_Manager::open() was never called. Note that
@@ -148,7 +149,7 @@ TAO_Transport_Cache_Manager::close (ACE_Handle_Set &handle_Set)
*this->cache_lock_,
-1));
- return this->close_i (handle_Set);
+ return this->close_i (reactor_registered, unregistered);
}
diff --git a/TAO/tao/Wait_On_Read.cpp b/TAO/tao/Wait_On_Read.cpp
index 92ad9df87a4..4e73325944a 100644
--- a/TAO/tao/Wait_On_Read.cpp
+++ b/TAO/tao/Wait_On_Read.cpp
@@ -22,15 +22,17 @@ TAO_Wait_On_Read::wait (ACE_Time_Value * max_wait_time,
int &reply_received)
{
reply_received = 0;
- while (reply_received != 1)
+ while (reply_received == 0)
{
reply_received =
this->transport_->read_process_message (max_wait_time, 1);
- if (reply_received == -1)
- return -1;
}
- return 0;
+ if (reply_received == -1)
+ {
+ this->transport_->close_connection ();
+ }
+ return (reply_received == 1 ? 0 : reply_received);
}
// No-op.