diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-07-23 23:09:33 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-07-23 23:09:33 +0000 |
commit | 99cd3386785b2e0370df03ee2806c602cda7bb96 (patch) | |
tree | 7b076b875324185fb26864ac8a414c6c7f50dbf7 /TAO/tao/Acceptor_Impl.cpp | |
parent | deac13c18914ad557f4a974a0192e90cd413a694 (diff) | |
download | ATCD-99cd3386785b2e0370df03ee2806c602cda7bb96.tar.gz |
ChangeLogTag:Fri Jul 23 17:54:45 1999 Irfan Pyarali <irfan@cs.wustl.edu>
Diffstat (limited to 'TAO/tao/Acceptor_Impl.cpp')
-rw-r--r-- | TAO/tao/Acceptor_Impl.cpp | 68 |
1 files changed, 67 insertions, 1 deletions
diff --git a/TAO/tao/Acceptor_Impl.cpp b/TAO/tao/Acceptor_Impl.cpp index c6933690369..94a21acc7bf 100644 --- a/TAO/tao/Acceptor_Impl.cpp +++ b/TAO/tao/Acceptor_Impl.cpp @@ -26,6 +26,7 @@ #include "tao/ORB_Core.h" #include "tao/Server_Strategy_Factory.h" +#include "tao/Connector_Registry.h" #if !defined(__ACE_INLINE__) #include "tao/Acceptor_Impl.i" @@ -33,6 +34,8 @@ ACE_RCSID(tao, Acceptor_Impl, "$Id$") +//////////////////////////////////////////////////////////////////////////////// + template <class SVC_HANDLER> TAO_Creation_Strategy<SVC_HANDLER>::TAO_Creation_Strategy (TAO_ORB_Core *orb_core) : orb_core_ (orb_core) @@ -50,13 +53,14 @@ TAO_Creation_Strategy<SVC_HANDLER>::make_svc_handler (SVC_HANDLER *&sh) return 0; } +//////////////////////////////////////////////////////////////////////////////// + template <class SVC_HANDLER> TAO_Concurrency_Strategy<SVC_HANDLER>::TAO_Concurrency_Strategy (TAO_ORB_Core *orb_core) : orb_core_ (orb_core) { } - template <class SVC_HANDLER> int TAO_Concurrency_Strategy<SVC_HANDLER>::activate_svc_handler (SVC_HANDLER *sh, void *arg) @@ -76,4 +80,66 @@ TAO_Concurrency_Strategy<SVC_HANDLER>::activate_svc_handler (SVC_HANDLER *sh, (sh, ACE_Event_Handler::READ_MASK); } +//////////////////////////////////////////////////////////////////////////////// + +template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> +TAO_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::TAO_Accept_Strategy (TAO_ORB_Core *orb_core) + : orb_core_ (orb_core) +{ +} + +template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int +TAO_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::open (const ACE_PEER_ACCEPTOR_ADDR &local_addr, + int restart) +{ + int result = ACCEPT_STRATEGY_BASE::open (local_addr, + restart); + + if (result == 0) + return result; + + // If the error occured due to the fact that the open handle limit + // was exhausted, then purge some "old" connections. + result = this->out_of_sockets_handler (); + if (result == -1) + return -1; + + // If we are able to purge, try again. + return ACCEPT_STRATEGY_BASE::open (local_addr, restart); +} + +template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int +TAO_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::accept_svc_handler (SVC_HANDLER *svc_handler) +{ + int result = ACCEPT_STRATEGY_BASE::accept_svc_handler (svc_handler); + + if (result == 0) + return result; + + // If the error occured due to the fact that the open handle limit + // was exhausted, then purge some "old" connections. + this->out_of_sockets_handler (); + + return result; +} + +template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int +TAO_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::out_of_sockets_handler (void) +{ + if (ACE::out_of_handles (errno)) + { + // Close some cached connections by explicitly purging the + // connection cache maintained by the connectors in the + // connector registry. + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, "Purging connections from Connectors in Connector Registry...\n")); + + return this->orb_core_->connector_registry ()->purge_connections (); + } + + return -1; +} + +//////////////////////////////////////////////////////////////////////////////// + #endif /* TAO_ACCEPTOR_IMPL_C */ |