diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-07-07 23:58:34 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-07-07 23:58:34 +0000 |
commit | 81e0a245decc09943832d52cb9f419e3f8f355b7 (patch) | |
tree | 8aaf3418082d4c3b107e2f01eedf0d55095c7ec7 | |
parent | 784fe453b13e068e3ec273b9a0f4021ac5a51e96 (diff) | |
download | ATCD-81e0a245decc09943832d52cb9f419e3f8f355b7.tar.gz |
ChangeLogTag: Mon Jul 07 18:00:38 2003 Irfan Pyarali <irfan@oomworks.com>
189 files changed, 16328 insertions, 9717 deletions
diff --git a/ACEXML/common/Mem_Map_Stream.cpp b/ACEXML/common/Mem_Map_Stream.cpp index 25f785d3b64..e33b0602055 100644 --- a/ACEXML/common/Mem_Map_Stream.cpp +++ b/ACEXML/common/Mem_Map_Stream.cpp @@ -265,19 +265,9 @@ ACEXML_Mem_Map_Stream::~ACEXML_Mem_Map_Stream (void) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>; template class ACE_Connector <Svc_Handler, ACE_SOCK_CONNECTOR>; -template class ACE_Svc_Tuple<Svc_Handler>; -template class ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *>; -template class ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX>; +template class ACE_NonBlocking_Connect_Handler<Svc_Handler>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> #pragma instantiate ACE_Connector <Svc_Handler, ACE_SOCK_CONNECTOR> -#pragma instantiate ACE_Svc_Tuple<Svc_Handler> -#pragma instantiate ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *> -#pragma instantiate ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX> +#pragma instantiate ACE_NonBlocking_Connect_Handler<Svc_Handler> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/ChangeLog b/ChangeLog index 50d56e6741a..d32e79475ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,643 @@ +Mon Jul 07 18:00:38 2003 Irfan Pyarali <irfan@oomworks.com> + + * The following changes are related to improving memory management + of Event Handlers when they interact with Reactors (and Timer + Queues). When a handler is registered with the Reactor, the + Reactor increments the reference count on the handler. The + Reactor also increments this reference count when making upcalls + on the handler. The reference count is decremented when an + upcall completes or when the handler is removed from the + Reactor. + + This mechanism is similar to what happens between POAs and + Servants and it allows for the safe deletion of handlers. This + mechanism is particularly need for multi-threaded applications + that can have multiple threads executing upcalls on a handler + that needs to be shutdown in a safe manner. The following + illustrates an example of how this mechanism works: + + - When a handler is created, it reference count is one. + + - After the handler is registered with the Reactor, it reference + count becomes two. + + - At this point, the handler creator can let go of the handler + reference, bringing down the reference count to one. + + - For each thread executing upcalls on the handler, the Reactor + increments the reference count by one. So if three threads were + simultaneously making upcalls on a handler, the reference count + would be four. + + - Assuming an external event (and thread) decides to close the + handler. It simply removes the handler from the Reactor. This + decreases the reference count to three. + + - As each thread completes their upcall, the reference reduces. + + - Once the final thread exits the upcall, the reference reaches + zero, and the handler is finally deleted. + + This mechanism ensures that the handler is not deleted until the + final upcall thread exits the handler. + + Reference counting on handlers is optional and is disabled by + default. To enable reference counting on a handler, reset its + reference counting policy to "ENABLED". + + To facilitate reference counting of handlers, an + ACE_Event_Handler_var class was added. This class is akin to + the PortableServer::ServantBase_var class. + + Similar reference counting related changes were made to the + Timer Queues so that handlers can be used in a thread safe + manner with the queues. + + The Connector implementation was completely revised to utilize + the new memory management mechanisms and remove existing + concurrency bugs. + + Several new examples/tests were added: + + - tests\Reference_Counted_Event_Handler_Test + - tests\MT_Reference_Counted_Event_Handler_Test + - tests\MT_Reference_Counted_Notify_Test + - tests\Timer_Queue_Reference_Counting_Test + - tests\NonBlocking_Conn_Test + - tests\Reactor_Registration_Test + - tests\WFMO_Reactor_Test + - tests\Timer_Cancellation_Test + + Details follow below: + + Fri May 09 20:13:37 2003 Irfan Pyarali <irfan@oomworks.com> + + * ace\Event_Handler: + + Added reference counting capabilities to the event handler. The + reference counting will be used for event handler memory + management by Reactors that will call add_reference() and + remove_reference() during registrations, removals, and upcalls. + This mechanism is similar to the protocol between servants and + POAs. + + Reference counting is configurable and can be controlled by the + Reference_Counting_Policy which is disabled by default. + + Added a ACE_Event_Handler_var auto pointer like class for + Event Handlers. This class calls + ACE_Event_Handler::remove_reference() in its destructor. + + Added reactor_timer_interface() method that returns the + Reactor's timer related interface. + + * ace\Reactor_Timer_Interface.h: + + Added a new class ACE_Reactor_Timer_Interface that contains + timer related (pure virtual) methods of the Reactor. This + allows us to make timer related calls on the Reactor from the + Timer Queue without having to include Reactor.h. + + * ace\Reactor: + + Vastly improved documentation, specially with respect to how the + reference counting works. + + Made the Reactor class inherit from ACE_Reactor_Timer_Interface + so that timer related calls can be made on the Reactor from the + Timer Queue without having to include Reactor.h. + + * ace\Reactor: + * ace\Reactor_Impl: + * ace\Select_Reactor_T: + * ace\WFMO_Reactor: + + Added a new find_handler() method that returns the event handler + associated with a <handle>. + + * ace\Select_Reactor_Base.cpp: + + - bind(): Make sure that the user is not registering a different + handler for an existing handle in the + Reactor_Handler_Repository. Also, if it is a new entry, call + add_reference() if reference counting is needed. + + - unbind(): Call remove_reference() if the removal is complete + and reference counting is needed. Also, Bala's change: + + Mon Apr 7 16:58:55 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu> + + is no longer necessary since handle_close() is now only called + once the Reactor state has been completely updated. + + - mask_ops(): If the handle is not suspended, then set the ops + on the <wait_set_>, otherwise set the <suspend_set_>. + + - handler_i(): Add to reference count of event handler before + returning to the user if reference counting is needed. + + - ACE_Select_Reactor_Notify::dispatch_notify(): + - ACE_Select_Reactor_Notify::purge_pending_notifications(): + - ACE_Select_Reactor_Notify::notify(): + + Added reference counting for notifies. + + * ace\Select_Reactor_T: + + notify_handle(): Added reference counting to upcalls. + + * ace\TP_Reactor: + + - remove_handler(): All remove_handler() specializations can be + removed since there no longer is the requirement of calling + handle_close() from outside the Reactor lock. + + - handle_timer_events(): Call preinvoke() and postinvoke() on + the timer queue so that timer upcalls can be reference counted. + + - handle_socket_events(): Added reference counting to upcalls. + + - mask_ops(): Specialization no longer necessary since the base + class now does the right thing. + + * ace\WFMO_Reactor: + + - handler(): Original handler() method was not locked. + + - bind_i(): Call add_reference() if reference counting is + needed. + + - make_changes_in_current_infos(): + - make_changes_in_suspension_infos(): + - make_changes_in_to_be_added_infos(): + + The iteration loop was incorrect. When an entry was replaced + from the one at the end, the newly shifted entry was skipped and + not evaluated. make_changes_in_to_be_added_infos() did not need + this change since entries are not moved around in the + <to_be_added_info_> set. + + Also, call remove_reference() if reference counting if needed. + + - complex_dispatch_handler(): Added reference counting to + upcalls. + + - ACE_WFMO_Reactor_Notify::purge_pending_notifications(): + - ACE_WFMO_Reactor_Notify::notify(): + - ACE_WFMO_Reactor_Notify::handle_signal(): + + Added reference counting for notifies. + + * ace\Timer_Queue_T: + + - Not sure why we were including Test_and_Set.h when we only + needed to include Event_Handler.h. + + - dispatch_info() and dispatch_info_i(): Made these virtual so + that they can be specialized. + + - ACE_Timer_Node_Dispatch_Info_T: Added <recurring_timer_> so + that we can determine if we need to call remove_reference() if + it is not a recurring timer and if reference counting is + required. This value is passed to the timeout() method of the + upcall functor. + + - timeout(): When handle_timeout() returns -1, invoke + cancel_timer() on the reactor if the event handler has a valid + reactor, otherwise invoke cancel() on the timer queue. It is + necessary to get the same locking as was used when registering + the timer, which was potentially done holding the reactor lock + while the timer queue could have been configured with a null + lock. + + - schedule(): No longer a pure virtual method. It now grabs + the lock, call schedule_i(), and finally calls registration() on + the upcall functor. + + - registration(): This method is called when a timer is + registered. + + - preinvoke(): Invokes add_reference() on the event handler if + reference counting is required before making the upcall. + + - upcall(): Changed the signature to pass + ACE_Timer_Node_Dispatch_Info_T instead of the individual + parameters. + + - postinvoke(): Invokes remove_reference() on the event handler + if reference counting is required after making the upcall. + + - cancel_type() and cancel_timer(): Split cancellation() into + two methods. cancel_timer() is called when a timer is + cancelled. cancel_type() is called when a handler is + cancelled. Also added <dont_call> parameter to these method. + cancel_timer() will be used for reference counting and + cancel_type() will be used for calling handle_close(). + + - expire(): Call preinvoke() before calling upcall() and + postinvoke() after calling upcall(). + + - deletion(): Now calls cancel_type() and cancel_timer() for + each timer remaining in the queue. + + * ace\Timer_List_T: + * ace\Timer_Wheel_T: + * ace\Timer_Heap_T: + * ace\Timer_Hash_T: + + - schedule_i(): This method replaces the old schedule() method. + Locking is not necessary anymore. + + - cancel(): This method will call cancel_timer() once for each + timer cancelled and cancel_type() once for each handler + cancelled. + + - cancel_i(): The <skip_close> check will be performed in the + upcall functor. + + * ace\Timer_Heap_T: + + - ~ACE_Timer_Heap_T(): Don't use <cur_size_> for the for loop + since it reduces after free_node() is called. + + - cancel(): Not sure why this is the only cancel() where the + upcall is made outside the lock. + + * ace\Timer_Wheel_T: + + - expire(): Made this method similar to Timer_Queue_T::expire() + by (a) invoking preinvoke() before calling upcall() and invoking + postinvoke() after calling upcall() and (b) making sure that we + skip past time values that have already "expired" when + rescheduling. + + * ace\Timer_Hash_T: + + - ACE_Timer_Hash_Upcall: Updated this upcall functor to match + the new APIs. + + - ACE_Timer_Hash_Upcall::registration(): + - ACE_Timer_Hash_Upcall::cancel_type(): + - ACE_Timer_Hash_Upcall::cancel_timer(): + + Nothing to be done in these methods since + registration/cancellation will be handled by the upcall functor + of the timer hash. + + - ACE_Timer_Hash_Upcall::preinvoke(): + - ACE_Timer_Hash_Upcall::postinvoke(): + - ACE_Timer_Hash_Upcall::preinvoke(): + + Assert that these methods never get invoked since we don't + invoke expire() on the buckets. + + - ACE_Timer_Hash_Upcall::deletion(): Call up to the upcall + functor of the timer hash since the timer hash does not invoke + deletion() on its upcall functor directly. This is because + entries are actually registered with the buckets, and this + method will be invoked when the buckets are cleaned up. + + - Hash_Token: Added TYPE information to the token. This + required templatizing Hash_Token since TYPE is a template + parameter. + + - reschedule(): Cancel the old timer before registering the new + one. Otherwise, the old timer will always remain in the + buckets. Also, make sure that the new bucket position is noted. + + - dispatch_info_i(): This method needs to be specialized to give + the original act and not the modified act. + + - free_node(): Needs to cancel the timer in addition to freeing + the node. + + - expire(): Only call cancel() for timers that don't need to be + rescheduled. reschedule() takes care of removing the old timer + for timers that need to be rescheduled. Also, made this method + similar to Timer_Queue_T::expire() by invoking preinvoke() + before calling upcall() and invoking postinvoke() after calling + upcall(). + + * ace\Proactor: + + Updated ACE_Proactor_Handle_Timeout_Upcall upcall functor to + match the new APIs. + + * ace\Connector: + + Completely reworked the Connector to utilize the reference + counting provided by the Reactor. This new design fixes bugs + 1405 and 1408. + + - There used to be a hash map that mapped handles to service + handlers. There is no need for this map since the Reactor + already keeps this mapping. We now keep a simple handle set to + remember the non-blocking connects in progress. This will help + when the Connector is closing down and we need to cancel the + non-blocking connections in progress. + + - The Connector no longer needs to inherit from + ACE_Service_Object since it does not register with the Reactor. + We now use ACE_NonBlocking_Connect_Handler for handling + non-blocking connects. The resume(), suspend(), and init() + no-ops, and fini() and info() were removed. + + - The <mutex_> is no longer needed since we use the Reactor lock + to do all our synchronization. This will solve bug 1408. + + - We no longer need the <closing_> flag. + + - Need to add a <reactor_> field since the Connector is no + longer an event handler. + + - Reference counting of ASTs is no longer needed since event + handlers are reference counted. + + * tests\Reference_Counted_Event_Handler_Test: + + This test is used to check reference counting of the Event + Handler when it interacts with the Reactor. + + * tests\MT_Reference_Counted_Event_Handler_Test: + + This test tries to represents what happens in the TAO ORB wrt to + event handlers, reactors, timer queues, threads, and connection + caches, minus the other complexities. The following three + Reactors are tested: Select, TP, and WFMO. + + The test checks proper use and shutting down of client-side + event handlers when it is used by invocation threads and/or + event loop threads. Server-side event handlers are either + threaded or reactive. A purger thread is introduced to check the + connection recycling and cache purging. Nested upcalls are also + tested. + + * tests\MT_Reference_Counted_Notify_Test: + + This test is used to check reference counting of the event + handlers when it interacts with the reactor notification + mechanism. + + * tests\Timer_Queue_Reference_Counting_Test: + + New test is used to check reference counting of the Event + Handler when it interacts with Timer Queues. + + * tests\NonBlocking_Conn_Test: + + This test checks for the proper working of the following: + - blocking connections + - blocking connections with timeouts + - non-blocking connections + - non-blocking connections without waiting for completions + - non-blocking connections with timeouts + + * tests\Reactor_Registration_Test: + + This is a test of registering handlers with the Reactor. + + * tests\WFMO_Reactor_Test: + + New test of the WFMO_Reactor. It makes sure that removals and + suspensions work correctly. + + * tests\Timer_Cancellation_Test: + + A test to ensure the timer cancellation works correctly. + + * tests\Makefile: + * tests\Makefile.am: + * tests\Makefile.bor: + * tests\run_test.lst: + * tests\tests.icp: + * tests\tests.mpc: + * tests\tests.dsw: + + Added new tests: + + - MT_Reference_Counted_Event_Handler_Test + - MT_Reference_Counted_Notify_Test + - NonBlocking_Conn_Test + - Reactor_Registration_Test + - Reference_Counted_Event_Handler_Test + - Timer_Cancellation_Test + - Timer_Queue_Reference_Counting_Test + - WFMO_Reactor_Test + + * tests\Conn_Test.cpp: + + Updated template instantiations. + + * tests\icc.bat: + * tests\run_tests.bat: + * tests\run_tests.psosim: + + Removed this file since it has become obsolete. + + Wed May 14 17:56:13 2003 Irfan Pyarali <irfan@oomworks.com> + + * ace/OS.i: + + - event_timedwait(): For relative times, the <timeout> parameter + was being modified. Instead use a stack variable such that the + <timeout> parameter is not modified. + + * ace/Timer_Hash_T: + + - expire(): Remove nodes from the buckets instead of simply + getting them and canceling them later. Also, if timers were + expired, find the new earliest time. + + - reschedule(): No need to cancel the timer node since it is now + removed from the bucket in expire(). + + - free_node(): No need for this function since nodes are removed + from the bucket in expire(). + + - cancel(): No need to pass <act> to bucket's cancel() since the + act comes from the Hash Token. Also, only perform upcall and + related cleanup on successful bucket cancel. + + - Added asserts in the code since there is not enough error + checking (and recovery) going on. + + * ace/Reactor: + * ace/Reactor_Impl: + * ace/Select_Reactor_T: + * ace/WFMO_Reactor: + + Renamed handler() to find_handler() since ACE_HANDLE is an "int" + on UNIX platforms and that causes ambiguity between + handler(ACE_HANDLE) and handler(int). + + * ace/Select_Reactor_Base.cpp (unbind): + + unbind() and bind(): Minor fixes for UNIX specific code. + + * ace/SOCK_SEQPACK_Association.cpp: + + Added template instantiation for ACE_Auto_Array_Ptr<sockaddr_in>. + + * ace/Connector.cpp: + + cancel() and close(): Changed calls from Reactor::handler() to + Reactor::find_handler(). + + * tests/MT_Reference_Counted_Notify_Test.cpp: + * tests/NonBlocking_Conn_Test.cpp: + * tests/MT_Reference_Counted_Event_Handler_Test.cpp: + * tests/Reference_Counted_Event_Handler_Test.cpp: + * tests/Timer_Queue_Reference_Counting_Test.cpp: + + Added template instantiations. + + * tests/MT_Reference_Counted_Event_Handler_Test.cpp: + + - main(): Added code to ignore SIGPIPE. + + - test(): Converted this into template class so that multiple + instances of reactor implementation can be created. + + - Added additional asserts. + + Thu May 15 18:12:10 2003 Irfan Pyarali <irfan@oomworks.com> + + * ace/WFMO_Reactor (find_handler): + + Fixed minor oversights. + + * ace/Timer_Hash_T.cpp: + * ace/Connector.cpp: + + Fixed unused arg warnings. + + * tests/MT_Reference_Counted_Event_Handler_Test.cpp: + + - Added a Pipe class. It is a replica of the ACE_Pipe class. + Only difference is that this class always uses two sockets to + create the pipe, even on platforms that support pipes. + + - Removed some test cases that don't work on Linux. + + * tests/MT_Reference_Counted_Event_Handler_Test.cpp: + * tests/MT_Reference_Counted_Notify_Test.cpp: + * tests/Reference_Counted_Event_Handler_Test.cpp: + * tests/Reactor_Registration_Test.cpp: + * tests/Timer_Cancellation_Test.cpp: + * tests/Timer_Queue_Reference_Counting_Test.cpp: + + - Fixed member ordering in constructors. + - Fixed unused arg warnings. + + Thu May 15 19:46:49 2003 Irfan Pyarali <irfan@oomworks.com> + + * ACEXML/common/Mem_Map_Stream.cpp: + * apps/Gateway/Gateway/Connection_Handler_Connector.cpp: + * apps/Gateway/Peer/Peer.cpp: + * apps/JAWS/clients/Blobby/Blob.cpp: + * apps/JAWS/clients/Caching/http_handler.cpp: + * examples/ASX/Event_Server/Transceiver/transceiver.cpp: + * examples/Connection/blocking/SPIPE-connector.cpp: + * examples/Connection/misc/test_upipe.cpp: + * examples/Connection/non_blocking/test_lsock_connector.cpp: + * examples/Connection/non_blocking/test_sock_connector.cpp: + * examples/Connection/non_blocking/test_spipe_connector.cpp: + * examples/Connection/non_blocking/test_tli_connector.cpp: + * examples/Web_Crawler/URL_Visitor.cpp: + * netsvcs/lib/TS_Clerk_Handler.cpp: + * tests/Cached_Accept_Conn_Test.cpp: + * tests/Cached_Conn_Test.cpp: + * tests/Dev_Poll_Reactor_Test.cpp: + * tests/Priority_Reactor_Test.cpp: + * tests/Reactor_Performance_Test.cpp: + * tests/TP_Reactor_Test.cpp: + * tests/CLASSIX/CLASSIX_Con_Acc_Test.cpp: + + Fixed Connector related template instantiations. + + Fri May 16 16:34:35 2003 Irfan Pyarali <irfan@oomworks.com> + + * tests/MT_Reference_Counted_Event_Handler_Test.cpp: + * tests/Timer_Queue_Reference_Counting_Test.cpp (cancellation_test): + + Fixed static array initialization warnings. + + Tue May 20 18:33:07 2003 Irfan Pyarali <irfan@oomworks.com> + + * ace/Connector: + + Reverted the Connector to inherit from ACE_Service_Object again. + Even though the Connector no longer registers with the Reactor, + it still needs to inherit from ACE_Service_Object so that it can + be used through the Service Configurator primarily for dynamic + linking. The resume(), suspend(), and init() no-ops, and fini() + and info() were restated. + + Mon Jun 30 16:31:33 2003 Irfan Pyarali <irfan@oomworks.com> + + * ace\SSL\ACE_SSL_LIB.dsp: + + Fixed the project names - they should be: + + # Name "ACE_SSL_LIB - Win32 Static Release" + # Name "ACE_SSL_LIB - Win32 Static Debug" + + instead of: + + # Name "ACE_SSL_LIB - Win32 Release" + # Name "ACE_SSL_LIB - Win32 Debug" + + Wed Jul 02 15:31:33 2003 Irfan Pyarali <irfan@oomworks.com> + + * examples\Connection\non_blocking\CPP-connector.cpp: + + handle_close() on the Connector was being specialized to know + when the connection was not successful. This is not the correct + approach in the first place since one should look for close() on + the service handler. In addition, handle_close() is no longer + used by ACE_Connector. Therefore, I changed this to use close() + on the service handler. + + * apps\JAWS\clients\Caching\http_handler.h: + + Included "ace/Svc_Handler.h" explicitly. + + * examples\Logger\Acceptor-server\server_loggerd.cpp: + + Included "ace/Test_and_Set.h" explicitly since + ace\Timer_Queue_T.h is no longer including it. + + Thu Jun 26 17:36:13 2003 Irfan Pyarali <irfan@oomworks.com> + + * bin\msvc_auto_compile.pl: + + Added -tests_TAO and -examples_TAO options to make all projects + in TAO tests and TAO examples. + + Thu May 22 14:13:37 2003 Irfan Pyarali <irfan@oomworks.com> + + * Merged Reactor_RefCount branch with the main truck since all ACE + level changes are now complete. New branch is + Reactor_RefCount_1. + + Tue May 27 19:59:25 2003 Irfan Pyarali <irfan@oomworks.com> + + * Merged Reactor_RefCount_1 branch with the main truck to avail + new changes by Bala to the TAO connection handlers. New branch + is Reactor_RefCount_2. + +Mon Jul 7 11:14:02 2003 Jeff Parsons <j.parsons@vanderbilt.edu> + + * TAO_IDL/be/be_visitor_structure/any_op_cs.cpp (visit_enum): + + Fixed a cut and paste error that was causing the code generation + for the any operators in the stub source file to be skipped. Thanks + to <dyafe@itgil.com> for reporting the bug. + + * TAO_IDL/be/be_visitor_enum/any_op_cs.cpp: + + Fixed cut and paste error in the explicit template instantiation. + Mon Jul 7 12:31:40 2003 Chad Elliott <elliott_c@ociweb.com> * bin/MakeProjectCreator/modules/MakeWorkspaceCreator.pm: diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 268faf6ee67..de88531b413 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,14 +1,543 @@ -Mon Jul 7 11:14:02 2003 Jeff Parsons <j.parsons@vanderbilt.edu> +Mon Jul 07 18:00:38 2003 Irfan Pyarali <irfan@oomworks.com> - * TAO_IDL/be/be_visitor_structure/any_op_cs.cpp (visit_enum): + * The following changes utilize the new memory management mechanisms + of Event Handlers. Previously, both the connection handlers and + the transports had their own reference counting mechanism and + independent lifetimes. The reference counting was inadequate + since it was not originated at the Reactor and the independent + lifetimes unnecessarily completed protocol specific transport + code. - Fixed a cut and paste error that was causing the code generation - for the any operators in the stub source file to be skipped. Thanks - to <dyafe@itgil.com> for reporting the bug. + These changes couple the lifetime of the connection handler with + that of the transport and utilizes the reference count in the + base ACE_Event_Handler class. This allowed us to remove several + hacks throughout TAO code which were designed to prevent (or + delay) crashes. Several extra checks and unnecessary locks were + also removed. - * TAO_IDL/be/be_visitor_enum/any_op_cs.cpp: + All of the following protocols were updated: - Fixed cut and paste error in the explicit template instantiation. + - DIOP + - IIOP + - SCIOP + - SHMIOP + - SSLIOP + - UIOP + - UIPMC + + Fri Jun 20 19:45:07 2003 Irfan Pyarali <irfan@oomworks.com> + + * tao\Connection_Handler: + + - Removed the incr_refcount() and decr_refcount() methods and + the related <reference_count_> and <refcount_lock_> members. + Also removed any explicit reference counting since now the + Reactor framework will handle this correctly. + + - Removed all asserts for a valid <transport_> since now the + lifetime of the handler and the transport are the same. + + - Removed connection_close_wait() since this state is no longer + needed. + + - handle_close_eh() is no longer required since we no longer + rely on the Reactor calling handle_close(). + + - Moved the call to release_os_resources() from decr_refcount() + to the destructor. + + - Mega-simplified transport() method since the transport will + only be set once. + + - Call to Transport::send_connection_closed_notifications() was + moved to Connection_Handler::close_connection_eh() to ensure it + gets called in all cases when the handler is closed. + + - close_connection_eh() was also super-simplified. Now it + simply purges the handler from the connection cache and removes + the handler from the Reactor. + + - Made the destructor public since this class is no longer + (directly) reference counted. + + - is_finalized() was renamed to is_closed(). + + - is_open() and is_connecting() were added to check the status + of the connection handler. + + * tao\IIOP_Connection_Handler: + + - Added close() method that will be called by the Acceptor or + Connector when connection establishment fails. + + - No need to reference count the transport. Handlers and + transports now have the same lifespan. Transport in created in + the constructor and deleted in the destructor. + + - handle_input() and handle_output() intercept any errors from + handle_input_eh() and handle_output_eh() respectively and call + close_connection(). We no longer rely on handle_close(). + + - Assert that handle_close() no longer gets called. + + - Added handle_timeout(). We don't use this upcall for I/O. + This is only used by the Connector to indicate that the + connection timedout. Therefore, we should call close(). + + - The unused constructor should assert(0). + + * tao\Transport: + + - The Transport class no longer needs to inherit from + TAO_Synch_Refcountable. The reference counting is provided by + the Event_Handler class. + + - Replaced the _duplicate() and release() methods with + add_reference() and remove_reference() methods. This matches + the signature of the reference counting methods on the base + Event_Handler class. + + - Changed provide_handler() to simply provide the related + connection handler. + + - register_handler() was made virtual and register_handler_i() + was removed since there was no locking required. Same was done + for recv() and send(). + + - Removed: + + close_connection_shared() + close_connection_no_purge() + close_connection_i(), + connection_handler_closing() + check_event_handler_i() + invalidate_event_handler_i() + + since they were no longer needed. + + - Renamed handle_input_i() to handle_input(). + + - Made send_connection_closed_notifications() public. + + - No need for: + + send_message_block_chain() + send_message_shared() + schedule_output_i() + drain_queue_helper() + handle_timeout() + check_buffering_constraints_i() + notify_reactor() + + to call check_event_handler_i() since the handler is always + valid. + + - No need for to call send_connection_closed_notifications() in + case of errors since it will get called when the handler is + closed. + + - No need for process_parsed_messages() to do any explicit + reference counting since now the Reactor framework will handle + this correctly. + + - No need for notify_reactor() to create a Notify_Handler. The + Reactor framework already does the proper reference counting for + notifications. + + * tao\IIOP_Transport: + + - invalidate_event_handler_i() no longer needed. + + - Override send() and recv() instead of send_i() and recv_i(). + + - No need for reference counting the connection handler since + the lifespan of the connection handler is tied to the lifespan + of the transport. + + - register_handler_i() no longer needed. + + - No need for: + + send_request() + send_message_shared() + tear_listen_point_list() + get_listen_point() + + to call check_event_handler_i() since the handler is always + valid. + + * tao\Acceptor_Impl.cpp (activate_svc_handler): + + Made several changes to this method. Now the sequence is: + + - At the start of the method, the service handler has been + created and the new connection has been accepted. #REFCOUNT# is + one at this point. + + - Cache handler: If successful, #REFCOUNT# is two at this + point. If failure, call close on handler. + + - Activate/register handler: If successful, #REFCOUNT# is three + at this point. We can let go of our reference. If failure, + remove handler from cache and call close on handler. + + - Success completion of method: #REFCOUNT# is two at this point. + + * tao\IIOP_Connector.cpp (make_connection): + + Made several changes to this method. Now the sequence is: + + - The connect() method creates the service handler and bumps the + #REFCOUNT# up one extra. There are three possibilities from + calling connect(): (a) connection succeeds immediately - in this + case, the #REFCOUNT# on the handler is two; (b) connection + completion is pending - in this case, the #REFCOUNT# on the + handler is also two; (c) connection fails immediately - in this + case, the #REFCOUNT# on the handler is one since close() gets + called on the handler. + + - The extra reference count in + TAO_Connect_Creation_Strategy::make_svc_handler() is needed in + the case when connection completion is pending and we are going + to wait on a variable in the handler to change, signifying + success or failure. Note, that this increment cannot be done + once the connect() returns since this might be too late if + another thread picks up the completion and potentially deletes + the handler before we get a chance to increment the reference + count. + + - If there is no immediate result, wait for completion. No need + to specify timeout to wait() since the correct timeout was + passed to the Connector. The Connector will close the handler in + the case of timeouts, so the event will complete (either success + or failure) within timeout. + + - When the wait completes, check if the handler has been closed. + Irrespective of success or failure, remove the #REFCOUNT# + added for waiting. + + - There are three possibilities when wait() returns: (a) + connection succeeded; (b) connection failed; (c) wait() failed + because of some other error. It is easy to deal with (a) and + (b). (c) is tricky since the connection is still pending and + may get completed by some other thread. The following deals + with (c). + + * In case of failure and close() has not be called, first + cancel from connector. Then double check to make sure the + handler has not been closed yet. This double check is required + to ensure that the connection handler was not closed yet by some + other thread since it was still registered with the connector. + Once connector.cancel() has been processed, we are assured that + the connector will no longer open/close this handler. + + * If closed, there is nothing to do. + + * If the handler has been opened, some other thread was able to + open the handler even though wait failed for this thread. Reset + <result> to zero. + + * If the handler is still connecting, forcefully close() the + handler. + + - If the connection has be successfully connected, add the + handler to connection cache. + + - Failure in adding to cache, close the handler. + + - If the wait strategy wants us to be registered with the reactor + then we do so. If registeration is required and it succeeds, + #REFCOUNT# becomes two. + + - In case of reactor registration failures, purge from the + connection cache and close the handler. + + - In case of success, handover the transport pointer to the + Invocation class. + + * tao\Connector_Impl.cpp (make_svc_handler): + + We add to the #REFCOUNT# since the Connector needs this. See + Connector::make_connection() for details. + + * tao\Transport_Cache_Manager (close): + + Previously, close() was returning a handle set and a set of + event handlers. This was changed such the only a set of + connection handlers is returned since the previous parameters + are no longer necessary. + + Also in purge(), there is no need to actually purge the handler + since they will be purged when the handlers close. This also + removes the need for Transport::close_connection_no_purge(). + Transport_Cache_Manager no longer needs to be friends with the + Transport. + + * tao\Thread_Lane_Resources.cpp (finalize): + + We now close the transport cache and return the handlers that + were still registered. The cache will decrease the #REFCOUNT# + on the handler when it removes the handler from cache. However, + #REFCOUNT# is increased when the handler is placed in the + handler set. Then we go through the handler set, closing the + connections and removing the references. Finally the connection + is closed. There is also a potential removal from the Reactor. + Finally, the #REFCOUNT# related to the handler set decreases. + + * tao\Notify_Handler: + + These files are no longer required since the Reactor framework + does the correct reference counting for notifications. + + * tao\LF_CH_Event: + * tao\LF_Event: + + Removed the LFS_CONNECTION_CLOSE_WAIT state since it is no + longer needed. + + * tao\Connect_Strategy: + + Removed Connect_Strategy::post_failed_connect() since + *_Connector::make_connection() now does the right thing. + + * tao\Asynch_Reply_Dispatcher_Base.cpp: + * tao\Asynch_Reply_Dispatcher_Base.i: + * tao\Cache_Entries.cpp: + * tao\Invocation.cpp: + * tao\Transport.cpp: + * tao\Notify_Handler.cpp: + * tao\Thread_Per_Connection_Handler.cpp: + * tao\PortableServer\AMH_Response_Handler.cpp: + + Replace calls to Transport::_duplicate() and + Transport::release() with new Transport::add_handler() and + Transport::remove_handler() methods respectively. + + * tests\TAO_Tests.dsw: + + Added several missing tests: + + - AMH_Exceptions_Test + - AMH_Oneway_Test + - Abstract Interface + - Bug_1361_Regression + - Bug_1482_Regression + - Collocation_Test + - Connect_Strategy_Test + - Connection_Timeout + - File_IO + - MProfile_Connection_Timeout + - MT_BiDir + - Manipulation + - Muxed_GIOP_Versions + - Nested_Upcall_Crash + - No_Server_MT_Connect_Test + - ORB_shutdown + - Objref_Sequence_Test + - Oneway_Buffering + - Stack_Recursion + - Strategies + - Two_Objects + + * tao\Makefile.bor: + * tao\Makefile.tao: + * tao\TAO.dsp: + * tao\TAO_Static.dsp: + * tao\tao.mpc: + + Removed Notify_Handler* from project/makefiles. + + * tests\Connection_Timeout\client.dsp: + * tests\MProfile_Connection_Timeout\client.dsp: + * tests\MProfile_Connection_Timeout\server.dsp: + * tests\MT_BiDir\client.dsp: + * tests\MT_BiDir\server.dsp: + * tests\ORB_shutdown\server.dsp: + + Fixed the above project files. + + * tests\Bug_1361_Regression\Bug_1361_Regression.dsw: + * tests\Bug_1361_Regression\client.dsp: + * tests\Bug_1361_Regression\server.dsp: + * tests\Bug_1361_Regression\shutdown.dsp: + + New project files. + + Tue Jun 24 21:46:13 2003 Irfan Pyarali <irfan@oomworks.com> + + * tao\Strategies\DIOP_Connection_Handler: + * tao\Strategies\SCIOP_Connection_Handler: + * tao\Strategies\SHMIOP_Connection_Handler: + * tao\Strategies\UIOP_Connection_Handler: + * orbsvcs\orbsvcs\SSLIOP\SSLIOP_Connection_Handler: + + - Constructor: Removed code to release the transport. Lifetimes + of transports and connection handlers are now coupled. + + - Destructor: Delete the transport. + + - handle_input(), handle_output(): Intercept any errors from + handle_input_eh() and handle_output_eh() respectively and call + close_connection(). We no longer rely on handle_close(). + + - handle_close(): Assert that this method no longer gets called. + + - handle_timeout(): Added this method. We don't use this upcall + for I/O. This is only used by the Connector to indicate that + the connection timedout. Therefore, we should call close(). + + - close(): Added this method that will be called by the Acceptor + or Connector when connection establishment fails. + + - The unused constructor should assert(0). + + * orbsvcs\orbsvcs\SSLIOP\IIOP_SSL_Connection_Handler: + + - Constructor: Replaced the code to release the transport with + explicit deletion. Lifetimes of transports and connection + handlers are now coupled. + + - The unused constructor should assert(0). + + * tao\Strategies\DIOP_Transport: + * tao\Strategies\SCIOP_Transport: + * tao\Strategies\SHMIOP_Transport: + * tao\Strategies\UIOP_Transport: + * orbsvcs\orbsvcs\SSLIOP\SSLIOP_Transport: + + - Constructor: No need to manage reference count on the + connection handler. Lifetimes of transports and connection + handlers are now coupled. + + - Destructor: Removed the assert for the connection handler. + + - send(), recv(): send_i() and recv_i() were renamed send() and + recv() respectively since locks are no longer required while + sending or receiving. + + - handle_input(): handle_input_i() was renamed to + handle_input(). + + - register_handler(): No longer required since the base class + does the right thing. + + - invalidate_event_handler_i(): This is no longer required. + + * orbsvcs\orbsvcs\SSLIOP\SSLIOP_Transport: + + No need for acquiring <handler_lock_> and calling + check_event_handler_i() in tear_listen_point_list() and + get_listen_point() since <connection_handler_> is now always + valid for the lifetime of the transport. + + * tao\Strategies\DIOP_Transport: + + - Removed commented out code. + + - Renamed register_handler_i() to register_handler(). + + * tao\Strategies\SCIOP_Transport: + + - send_request(), get_listen_point(), tear_listen_point_list(): + Removed guard and check for valid connection handler. + + - send_message_shared(): Removed check for valid connection + handler. + + * orbsvcs\orbsvcs\SSLIOP\IIOP_SSL_Transport: + + Rename handle_input_i() to handle_input(). + + * tao\Strategies\SCIOP_Connector.cpp (make_connection): + * tao\Strategies\UIOP_Connector.cpp (make_connection): + * orbsvcs\orbsvcs\SSLIOP\IIOP_SSL_Connector.cpp (make_connection): + * orbsvcs\orbsvcs\SSLIOP\SSLIOP_Connector.cpp (ssliop_connect): + + Made this method similar to IIOP_Connector::make_connection(). + + * tao\Strategies\SHMIOP_Connector.cpp (make_connection): + + Made this method similar to IIOP_Connector::make_connection() + except that the connects are always blocking. + + * tao\Strategies\DIOP_Connector.cpp (make_connection): + + - Replaced decr_refcount() with remove_reference() and + duplicate() with add_reference() respectively. + + Wed Jun 25 15:56:14 2003 Irfan Pyarali <irfan@oomworks.com> + + * tao\Strategies\DIOP_Acceptor: + + Revised the management of the connection handler. Replaced the + call to handle_close() with call to remove_reference(). + + Thu Jun 26 19:34:26 2003 Irfan Pyarali <irfan@oomworks.com> + + * tao\Strategies\DIOP_Acceptor.cpp (close): + + Added DONT_CALL mask to the remove_handler() call so that + handle_close() is not called anymore. + + Mon Jun 30 20:46:22 2003 Irfan Pyarali <irfan@oomworks.com> + + * orbsvcs\orbsvcs\PortableGroup\UIPMC_Connection_Handler: + * orbsvcs\orbsvcs\PortableGroup\UIPMC_Connector.cpp: + * orbsvcs\orbsvcs\PortableGroup\UIPMC_Transport: + + DIOP and UIPMC are very similar. Therefore, similar changes + were made. + + * tests\Connection_Failure: + + New test added that checks connection failures by connecting to + a non-existent object. + + The following files were added: + + - tests\Connection_Failure\Connection_Failure.dsw + - tests\Connection_Failure\Connection_Failure.mpc + - tests\Connection_Failure\Makefile + - tests\Connection_Failure\Makefile.bor + - tests\Connection_Failure\README + - tests\Connection_Failure\client.bor + - tests\Connection_Failure\client.cpp + - tests\Connection_Failure\client.dsp + - tests\Connection_Failure\run_test.pl + - tests\Connection_Failure\test.idl + + and the following were modified: + + - tests\Makefile + - tests\Makefile.bor + - tests\TAO_Tests.dsw + - tests\README + - $ACE_ROOT\bin\tao_orb_tests.lst + + Thu May 15 19:46:49 2003 Irfan Pyarali <irfan@oomworks.com> + + * TAO/orbsvcs/orbsvcs/AV/TCP.cpp: + * TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Connector.cpp: + * TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connector.cpp: + * TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp: + * TAO/tao/IIOP_Connector.cpp: + * TAO/tao/Strategies/DIOP_Connector.cpp: + * TAO/tao/Strategies/SHMIOP_Connector.cpp: + * TAO/tao/Strategies/UIOP_Connector.cpp: + + Fixed Connector related template instantiations. + + Thu May 22 14:13:37 2003 Irfan Pyarali <irfan@oomworks.com> + + * Merged Reactor_RefCount branch with the main truck since all ACE + level changes are now complete. New branch is + Reactor_RefCount_1. + + Tue May 27 19:59:25 2003 Irfan Pyarali <irfan@oomworks.com> + + * Merged Reactor_RefCount_1 branch with the main truck to avail + new changes by Bala to the TAO connection handlers. New branch + is Reactor_RefCount_2. Mon Jul 07 07:46:00 2003 Justin Michel <michel_j@ociweb.com> diff --git a/TAO/docs/releasenotes/index.html b/TAO/docs/releasenotes/index.html index 24ae0856c73..f4c6397c5d4 100644 --- a/TAO/docs/releasenotes/index.html +++ b/TAO/docs/releasenotes/index.html @@ -21,6 +21,9 @@ href="http://www.cs.wustl.edu/~schmidt/TAO.html">TAO</a>: <TD valign="top"> <ul> <li> +<a href="#ace">ACE Wrappers</a></li> + +<li> <a href="#idl">IDL Compiler</a></li> <li> @@ -157,6 +160,82 @@ A complete list of all modifications to TAO is available in the <a href="../../C <hr> <h3> +<a NAME="ace"></a>ACE Wrappers</h3> +<p>Current status: (As of July 07, 2003.) +<ul> +<li> + +The following changes are related to improving memory management of +Event Handlers when they interact with Reactors (and Timer Queues). +When a handler is registered with the Reactor, the Reactor increments +the reference count on the handler. The Reactor also increments this +reference count when making upcalls on the handler. The reference +count is decremented when an upcall completes or when the handler is +removed from the Reactor. <p> + +This mechanism is similar to what happens between POAs and Servants +and it allows for the safe deletion of handlers. This mechanism is +particularly need for multi-threaded applications that can have +multiple threads executing upcalls on a handler that needs to be +shutdown in a safe manner. The following illustrates an example of +how this mechanism works: <p> + +<ul> +<li> When a handler is created, it reference count is one. + +<li> After the handler is registered with the Reactor, it reference +count becomes two. + +<li> At this point, the handler creator can let go of the handler +reference, bringing down the reference count to one. + +<li> For each thread executing upcalls on the handler, the Reactor +increments the reference count by one. So if three threads were +simultaneously making upcalls on a handler, the reference count would +be four. + +<li> Assuming an external event (and thread) decides to close the +handler. It simply removes the handler from the Reactor. This +decreases the reference count to three. + +<li> As each thread completes their upcall, the reference reduces. + +<li> Once the final thread exits the upcall, the reference reaches +zero, and the handler is finally deleted. + +</ul> <p> + +This mechanism ensures that the handler is not deleted until the final +upcall thread exits the handler. <p> + +Reference counting on handlers is optional and is disabled by default. +To enable reference counting on a handler, reset its reference +counting policy to "ENABLED". <p> + +To facilitate reference counting of handlers, an ACE_Event_Handler_var +class was added. This class is akin to the +PortableServer::ServantBase_var class. <p> + +Similar reference counting related changes were made to the Timer +Queues so that handlers can be used in a thread safe manner with the +queues. <p> + +The Connector implementation was completely revised to utilize the new +memory management mechanisms and remove existing concurrency bugs. <p> + +Several new examples/tests were added: +Reference_Counted_Event_Handler_Test, +MT_Reference_Counted_Event_Handler_Test, +MT_Reference_Counted_Notify_Test, Timer_Queue_Reference_Counting_Test, +NonBlocking_Conn_Test, Reactor_Registration_Test, WFMO_Reactor_Test, +Timer_Cancellation_Test + +</li> +</ul> +<hr> +</ul> + +<h3> <a NAME="idl"></a>IDL Compiler</h3> Point of contact: <a href="mailto:parsons@cs.wustl.edu"> Jeff Parsons</a> diff --git a/TAO/docs/releasenotes/orbcore.html b/TAO/docs/releasenotes/orbcore.html index 316de23b0e0..9a5c18c6a37 100644 --- a/TAO/docs/releasenotes/orbcore.html +++ b/TAO/docs/releasenotes/orbcore.html @@ -48,13 +48,6 @@ Point of contact: <a href="mailto: bala@cs.wustl.edu">Balchandran Natarajan</a> perfect. There have been reported interoperability problems. <p></li> - <li><p> There is a known race condition with the TP_Reactor. It - kicks up when a client running multiple threads, sees a remote - server crash or do an abnormal exit . The details of this bug - are documented <A - HREF="http://deuce.doc.wustl.edu/bugzilla/show_bug.cgi?id=1020"> - here</A>.</p></li> - <li><p> The multi-profile parsing code in TAO hasnt been tested well and we have been able to identify some issues with it. The details are documented in our <A @@ -85,11 +78,6 @@ Point of contact: <a href="mailto: bala@cs.wustl.edu">Balchandran Natarajan</a> <a name="ongoing"><h3>Ongoing Work:</h3></a> <ul> - <li><p> Work is on to write a new <A - HREF="http://deuce.doc.wustl.edu/bugzilla/show_bug.cgi?id=1031"> - reactor</A> framework for TAO which overcomes some of the - problems associated with the new reactor<p></li> - </li> <li><p>Support new concurrency models, e.g., Thread-per-Request, etc..</p> </li> @@ -204,6 +192,24 @@ Point of contact: <a href="mailto: bala@cs.wustl.edu">Balchandran Natarajan</a> </p> </li> + <li><p> Several changes were made to utilize the new memory management mechanisms + of Event Handlers in TAO. Previously, both the connection handlers and + the transports had their own reference counting mechanism and + independent lifetimes. The reference counting was inadequate + since it was not originated at the Reactor and the independent + lifetimes unnecessarily completed protocol specific transport + code. <p> + + The changes couple the lifetime of the connection handler with + that of the transport and utilizes the reference count in the + base ACE_Event_Handler class. This allowed us to remove several + hacks throughout TAO code which were designed to prevent (or + delay) crashes. Several extra checks and unnecessary locks were + also removed. <p> + + All of the following protocols were updated: DIOP, IIOP, + SCIOP, SHMIOP, SSLIOP, UIOP, UIPMC. + </li> </ul> <!-- --------------------- --> diff --git a/TAO/orbsvcs/orbsvcs/AV/TCP.cpp b/TAO/orbsvcs/orbsvcs/AV/TCP.cpp index 7aa78c6e87e..885ec2936e6 100644 --- a/TAO/orbsvcs/orbsvcs/AV/TCP.cpp +++ b/TAO/orbsvcs/orbsvcs/AV/TCP.cpp @@ -692,25 +692,11 @@ TAO_AV_TCP_Flow_Handler::handle_timeout (const ACE_Time_Value &tv, #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Acceptor<TAO_AV_TCP_Flow_Handler, ACE_SOCK_ACCEPTOR>; template class ACE_Connector<TAO_AV_TCP_Flow_Handler, ACE_SOCK_CONNECTOR>; - -template class ACE_Svc_Tuple<TAO_AV_TCP_Flow_Handler>; -template class ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<TAO_AV_TCP_Flow_Handler> *>; -template class ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<TAO_AV_TCP_Flow_Handler> *, TAO_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<TAO_AV_TCP_Flow_Handler> *, TAO_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<TAO_AV_TCP_Flow_Handler> *, TAO_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<TAO_AV_TCP_Flow_Handler> *, TAO_SYNCH_RW_MUTEX>; - +template class ACE_NonBlocking_Connect_Handler<TAO_AV_TCP_Flow_Handler>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Acceptor<TAO_AV_TCP_Flow_Handler, ACE_SOCK_Acceptor, ACE_INET_Addr> #pragma instantiate ACE_Connector<TAO_AV_TCP_Flow_Handler, ACE_SOCK_Connector, ACE_INET_Addr> - -#pragma instantiate ACE_Svc_Tuple<TAO_AV_TCP_Flow_Handler> -#pragma instantiate ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<TAO_AV_TCP_Flow_Handler> *> -#pragma instantiate ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<TAO_AV_TCP_Flow_Handler> *, TAO_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<TAO_AV_TCP_Flow_Handler> *, TAO_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<TAO_AV_TCP_Flow_Handler> *, TAO_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<TAO_AV_TCP_Flow_Handler> *, TAO_SYNCH_RW_MUTEX> - +#pragma instantiate ACE_NonBlocking_Connect_Handler<TAO_AV_TCP_Flow_Handler> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ ACE_STATIC_SVC_DEFINE (TAO_AV_TCP_Flow_Factory, diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Connection_Handler.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Connection_Handler.cpp index 25b56919781..21e73eb6a08 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Connection_Handler.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Connection_Handler.cpp @@ -36,7 +36,7 @@ TAO_UIPMC_Connection_Handler::TAO_UIPMC_Connection_Handler (ACE_Thread_Manager * // Creation_Strategy requires a constructor with that signature, we // don't use that implementation, but some (most?) compilers // instantiate it anyway. - ACE_ASSERT (this->orb_core () != 0); + ACE_ASSERT (0); } @@ -53,8 +53,7 @@ TAO_UIPMC_Connection_Handler::TAO_UIPMC_Connection_Handler (TAO_ORB_Core *orb_co TAO_UIPMC_Transport(this, orb_core, 0)); // store this pointer (indirectly increment ref count) - this->transport(specific_transport); - TAO_Transport::release (specific_transport); + this->transport (specific_transport); } @@ -68,6 +67,8 @@ TAO_UIPMC_Connection_Handler::~TAO_UIPMC_Connection_Handler (void) } else this->udp_socket_.close (); + + delete this->transport (); } ACE_HANDLE @@ -182,20 +183,57 @@ TAO_UIPMC_Connection_Handler::close_connection (void) int TAO_UIPMC_Connection_Handler::handle_input (ACE_HANDLE h) { - return this->handle_input_eh (h, this); + int result = + this->handle_input_eh (h, this); + + if (result == -1) + { + this->close_connection (); + return 0; + } + + return result; } int TAO_UIPMC_Connection_Handler::handle_output (ACE_HANDLE handle) { - return this->handle_output_eh (handle, this); + int result = + this->handle_output_eh (handle, this); + + if (result == -1) + { + this->close_connection (); + return 0; + } + + return result; } int -TAO_UIPMC_Connection_Handler::handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask rm) +TAO_UIPMC_Connection_Handler::handle_timeout (const ACE_Time_Value &, + const void *) { - return this->handle_close_eh (handle, rm, this); + // We don't use this upcall for I/O. This is only used by the + // Connector to indicate that the connection timedout. Therefore, + // we should call close(). + return this->close (); +} + +int +TAO_UIPMC_Connection_Handler::handle_close (ACE_HANDLE, + ACE_Reactor_Mask) +{ + ACE_ASSERT (0); + return 0; +} + +int +TAO_UIPMC_Connection_Handler::close (u_long) +{ + this->state_changed (TAO_LF_Event::LFS_CONNECTION_CLOSED); + this->transport ()->remove_reference (); + return 0; } int diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Connection_Handler.h b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Connection_Handler.h index 084a612549f..77948dc6ad0 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Connection_Handler.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Connection_Handler.h @@ -93,6 +93,10 @@ public: // @@ Frank: Similar to open, but called on server virtual int open_server (void); + /// Close called by the Acceptor or Connector when connection + /// establishment fails. + int close (u_long = 0); + //@{ /** @name Event Handler overloads */ @@ -101,6 +105,8 @@ public: virtual int handle_input (ACE_HANDLE); virtual int handle_output (ACE_HANDLE); virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask); + virtual int handle_timeout (const ACE_Time_Value ¤t_time, + const void *act = 0); virtual int open (void *); //@} diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Connector.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Connector.cpp index af62d549d4e..39aae932f98 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Connector.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Connector.cpp @@ -19,32 +19,18 @@ ACE_RCSID(tao, UIPMC_Connector, "$Id$") #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - -template class ACE_Svc_Tuple<TAO_UIPMC_Connection_Handler>; -template class ACE_Map_Manager<int, ACE_Svc_Tuple<TAO_UIPMC_Connection_Handler> *, TAO_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator_Base<int, ACE_Svc_Tuple<TAO_UIPMC_Connection_Handler> *, TAO_SYNCH_RW_MUTEX>; -template class ACE_Map_Entry<int,ACE_Svc_Tuple<TAO_UIPMC_Connection_Handler>*>; +template class ACE_NonBlocking_Connect_Handler<TAO_UIPMC_Connection_Handler>; template class ACE_Map_Entry<ACE_INET_Addr, TAO_UIPMC_Connection_Handler *>; - -template class ACE_Map_Iterator<int,ACE_Svc_Tuple<TAO_UIPMC_Connection_Handler>*,TAO_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<int,ACE_Svc_Tuple<TAO_UIPMC_Connection_Handler>*,TAO_SYNCH_RW_MUTEX>; template class ACE_Hash_Map_Iterator_Base_Ex < ACE_INET_Addr, TAO_UIPMC_Connection_Handler *, ACE_Hash < ACE_INET_Addr >, ACE_Equal_To < ACE_INET_Addr >, ACE_Null_Mutex >; template class ACE_Hash_Map_Iterator_Ex<ACE_INET_Addr, TAO_UIPMC_Connection_Handler *, ACE_Hash<ACE_INET_Addr>, ACE_Equal_To<ACE_INET_Addr>, ACE_Null_Mutex>; template class ACE_Hash_Map_Reverse_Iterator_Ex<ACE_INET_Addr, TAO_UIPMC_Connection_Handler *, ACE_Hash<ACE_INET_Addr>, ACE_Equal_To<ACE_INET_Addr>, ACE_Null_Mutex>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Svc_Tuple<TAO_UIPMC_Connection_Handler> -#pragma instantiate ACE_Map_Manager<int, ACE_Svc_Tuple<TAO_UIPMC_Connection_Handler> *, TAO_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator_Base<int, ACE_Svc_Tuple<TAO_UIPMC_Connection_Handler> *, TAO_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Entry<int,ACE_Svc_Tuple<TAO_UIPMC_Connection_Handler>*> +#pragma instantiate ACE_NonBlocking_Connect_Handler<TAO_UIPMC_Connection_Handler> #pragma instantiate ACE_Map_Entry<ACE_INET_Addr, TAO_UIPMC_Connection_Handler *>; - -#pragma instantiate ACE_Map_Iterator<int,ACE_Svc_Tuple<TAO_UIPMC_Connection_Handler>*,TAO_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<int,ACE_Svc_Tuple<TAO_UIPMC_Connection_Handler>*,TAO_SYNCH_RW_MUTEX> - #pragma instantiate ACE_Hash_Map_Iterator_Base_Ex < ACE_INET_Addr,TAO_UIPMC_Connection_Handler *, ACE_Hash < ACE_INET_Addr >, ACE_Equal_To < ACE_INET_Addr >, ACE_Null_Mutex > #pragma instantiate ACE_Hash_Map_Iterator_Ex<ACE_INET_Addr, TAO_UIPMC_Connection_Handler *, ACE_Hash<ACE_INET_Addr>, ACE_Equal_To<ACE_INET_Addr>, ACE_Null_Mutex> #pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ACE_INET_Addr, TAO_UIPMC_Connection_Handler *, ACE_Hash<ACE_INET_Addr>, ACE_Equal_To<ACE_INET_Addr>, ACE_Null_Mutex> @@ -81,8 +67,7 @@ TAO_UIPMC_Connector::close (void) while (!iter.done ()) { - // Delete the connection handler - (*iter).int_id_->decr_refcount(); + (*iter).int_id_->remove_reference (); iter++; } @@ -170,8 +155,8 @@ TAO_UIPMC_Connector::make_connection (TAO_GIOP_Invocation *invocation, } // @@ Michael: We do not use traditional connection management. - - transport = TAO_Transport::_duplicate (svc_handler->transport ()); + svc_handler->add_reference (); + transport = svc_handler->transport (); return 0; } diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.cpp index fdfa070c8a7..9b04d83c7bd 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.cpp @@ -73,14 +73,6 @@ TAO_UIPMC_Transport::TAO_UIPMC_Transport (TAO_UIPMC_Connection_Handler *handler, , connection_handler_ (handler) , messaging_object_ (0) { - if (connection_handler_ != 0) - { - // REFCNT: Matches one of - // TAO_Transport::connection_handler_close() or - // TAO_Transport::close_connection_shared. - this->connection_handler_->incr_refcount(); - } - // Use the normal GIOP object ACE_NEW (this->messaging_object_, TAO_GIOP_Message_Base (orb_core, @@ -274,9 +266,9 @@ TAO_UIPMC_Transport::write_unique_id (TAO_OutputCDR &miop_hdr, unsigned long uni } ssize_t -TAO_UIPMC_Transport::send_i (iovec *iov, int iovcnt, - size_t &bytes_transferred, - const ACE_Time_Value *) +TAO_UIPMC_Transport::send (iovec *iov, int iovcnt, + size_t &bytes_transferred, + const ACE_Time_Value *) { const ACE_INET_Addr &addr = this->connection_handler_->addr (); bytes_transferred = 0; @@ -455,9 +447,9 @@ TAO_UIPMC_Transport::send_i (iovec *iov, int iovcnt, ssize_t -TAO_UIPMC_Transport::recv_i (char *buf, - size_t len, - const ACE_Time_Value * /*max_wait_time*/) +TAO_UIPMC_Transport::recv (char *buf, + size_t len, + const ACE_Time_Value * /*max_wait_time*/) { ACE_INET_Addr from_addr; @@ -558,9 +550,9 @@ TAO_UIPMC_Transport::recv_i (char *buf, } int -TAO_UIPMC_Transport::handle_input_i (TAO_Resume_Handle &rh, - ACE_Time_Value *max_wait_time, - int /*block*/) +TAO_UIPMC_Transport::handle_input (TAO_Resume_Handle &rh, + ACE_Time_Value *max_wait_time, + int /*block*/) { // If there are no messages then we can go ahead to read from the // handle for further reading.. @@ -650,7 +642,7 @@ TAO_UIPMC_Transport::handle_input_i (TAO_Resume_Handle &rh, } int -TAO_UIPMC_Transport::register_handler_i (void) +TAO_UIPMC_Transport::register_handler (void) { // We never register register the handler with the reactor // as we never need to be informed about any incoming data, @@ -727,11 +719,3 @@ TAO_UIPMC_Transport::messaging_init (CORBA::Octet major, minor); return 1; } - -TAO_Connection_Handler * -TAO_UIPMC_Transport::invalidate_event_handler_i (void) -{ - TAO_Connection_Handler * eh = this->connection_handler_; - this->connection_handler_ = 0; - return eh; -} diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.h b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.h index 35edbd6c41e..2678c92d575 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Transport.h @@ -60,9 +60,9 @@ public: ~TAO_UIPMC_Transport (void); /// Look for the documentation in Transport.h. - virtual int handle_input_i (TAO_Resume_Handle &rh, - ACE_Time_Value *max_wait_time = 0, - int block = 0); + virtual int handle_input (TAO_Resume_Handle &rh, + ACE_Time_Value *max_wait_time = 0, + int block = 0); protected: /** @name Overridden Template Methods * @@ -72,22 +72,20 @@ protected: virtual ACE_Event_Handler * event_handler_i (void); virtual TAO_Connection_Handler *connection_handler_i (void); - virtual TAO_Connection_Handler * invalidate_event_handler_i (void); - virtual TAO_Pluggable_Messaging *messaging_object (void); /// Write the complete Message_Block chain to the connection. - virtual ssize_t send_i (iovec *iov, int iovcnt, - size_t &bytes_transferred, - const ACE_Time_Value *max_wait_time); + virtual ssize_t send (iovec *iov, int iovcnt, + size_t &bytes_transferred, + const ACE_Time_Value *max_wait_time); /// Read len bytes from into buf. - virtual ssize_t recv_i (char *buf, - size_t len, - const ACE_Time_Value *s = 0); + virtual ssize_t recv (char *buf, + size_t len, + const ACE_Time_Value *s = 0); - virtual int register_handler_i (void); + virtual int register_handler (void); public: /// @@TODO: These methods IMHO should have more meaningful diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connection_Handler.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connection_Handler.cpp index 239be1ba7b8..0ac94b6c5bc 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connection_Handler.cpp +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connection_Handler.cpp @@ -61,7 +61,7 @@ TAO_IIOP_SSL_Connection_Handler (ACE_Thread_Manager *t) // Creation_Strategy requires a constructor with that signature, we // don't use that implementation, but some (most?) compilers // instantiate it anyway. - ACE_ASSERT (this->orb_core () != 0); + ACE_ASSERT (0); } @@ -85,9 +85,11 @@ TAO_IIOP_SSL_Connection_Handler (TAO_ORB_Core *orb_core, s->ssliop_current.in (), 0)); - // store this pointer (indirectly increment ref count) + // Delete the transport with TAO_IIOP_Connection_Handler. + delete this->transport (); + + // store this pointer this->transport (specific_transport); - TAO_Transport::release (specific_transport); } TAO_IIOP_SSL_Connection_Handler:: diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connector.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connector.cpp index d179fd9c574..f132379e7b5 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connector.cpp +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connector.cpp @@ -31,13 +31,7 @@ template class TAO_Connect_Creation_Strategy<TAO_IIOP_SSL_Connection_Handler>; template class ACE_Strategy_Connector<TAO_IIOP_SSL_Connection_Handler, ACE_SOCK_CONNECTOR>; template class ACE_Connect_Strategy<TAO_IIOP_SSL_Connection_Handler, ACE_SOCK_CONNECTOR>; template class ACE_Connector<TAO_IIOP_SSL_Connection_Handler, ACE_SOCK_CONNECTOR>; -template class ACE_Svc_Tuple<TAO_IIOP_SSL_Connection_Handler>; - -template class ACE_Map_Manager<int, ACE_Svc_Tuple<TAO_IIOP_SSL_Connection_Handler> *, TAO_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator_Base<int, ACE_Svc_Tuple<TAO_IIOP_SSL_Connection_Handler> *, TAO_SYNCH_RW_MUTEX>; -template class ACE_Map_Entry<int,ACE_Svc_Tuple<TAO_IIOP_SSL_Connection_Handler>*>; -template class ACE_Map_Iterator<int,ACE_Svc_Tuple<TAO_IIOP_SSL_Connection_Handler>*,TAO_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<int,ACE_Svc_Tuple<TAO_IIOP_SSL_Connection_Handler>*,TAO_SYNCH_RW_MUTEX>; +template class ACE_NonBlocking_Connect_Handler<TAO_IIOP_SSL_Connection_Handler>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) @@ -46,17 +40,7 @@ template class ACE_Map_Reverse_Iterator<int,ACE_Svc_Tuple<TAO_IIOP_SSL_Connectio #pragma instantiate ACE_Strategy_Connector<TAO_IIOP_SSL_Connection_Handler, ACE_SOCK_CONNECTOR> #pragma instantiate ACE_Connect_Strategy<TAO_IIOP_SSL_Connection_Handler, ACE_SOCK_CONNECTOR> #pragma instantiate ACE_Connector<TAO_IIOP_SSL_Connection_Handler, ACE_SOCK_Connector> -#pragma instantiate ACE_Svc_Tuple<TAO_IIOP_SSL_Connection_Handler> - - -#pragma instantiate ACE_Connector<TAO_IIOP_SSL_Connection_Handler, ACE_SOCK_Connector> -#pragma instantiate ACE_Creation_Strategy<TAO_IIOP_SSL_Connection_Handler> -#pragma instantiate ACE_Svc_Tuple<TAO_IIOP_SSL_Connection_Handler> -#pragma instantiate ACE_Map_Manager<int, ACE_Svc_Tuple<TAO_IIOP_SSL_Connection_Handler> *, TAO_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator_Base<int, ACE_Svc_Tuple<TAO_IIOP_SSL_Connection_Handler> *, TAO_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Entry<int,ACE_Svc_Tuple<TAO_IIOP_SSL_Connection_Handler>*> -#pragma instantiate ACE_Map_Iterator<int,ACE_Svc_Tuple<TAO_IIOP_SSL_Connection_Handler>*,TAO_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<int,ACE_Svc_Tuple<TAO_IIOP_SSL_Connection_Handler>*,TAO_SYNCH_RW_MUTEX> +#pragma instantiate ACE_NonBlocking_Connect_Handler<TAO_IIOP_SSL_Connection_Handler> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ @@ -164,25 +148,21 @@ TAO_IIOP_SSL_Connector::make_connection ( TAO_Transport_Descriptor_Interface *desc, ACE_Time_Value *max_wait_time) { - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) Connector::connect - ") - ACE_TEXT ("looking for IIOP connection.\n"))); - - - TAO_IIOP_Endpoint *iiop_endpoint = ACE_dynamic_cast (TAO_IIOP_Endpoint *, desc->endpoint ()); + if (iiop_endpoint == 0) + return -1; + + const ACE_INET_Addr &remote_address = + iiop_endpoint->object_addr (); + if (TAO_debug_level > 4) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) IIOP_SSL_Connector::connect ") ACE_TEXT ("making a new connection \n"))); - const ACE_INET_Addr &remote_address = - iiop_endpoint->object_addr (); - // Get the right synch options ACE_Synch_Options synch_options; @@ -191,103 +171,190 @@ TAO_IIOP_SSL_Connector::make_connection ( TAO_IIOP_SSL_Connection_Handler *svc_handler = 0; - // Active connect - int result = this->base_connector_.connect (svc_handler, - remote_address, - synch_options); - - if (result == -1 && errno == EWOULDBLOCK) - { - if (TAO_debug_level) - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - IIOP_SSL_Connector::make_connection(), " - "going to wait for connection completion on local" - "handle [%d]\n", - svc_handler->get_handle ())); - result = - this->active_connect_strategy_->wait (svc_handler, - max_wait_time); - - if (TAO_debug_level > 2) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - IIOP_SSL_Connector::make_connection(), " - "wait done for handle[%d], result = %d\n", - svc_handler->get_handle (), result)); - } - } - - int status = - svc_handler->is_finalized (); - - // Reduce the refcount to the svc_handler that we have. The - // increment to the handler is done in make_svc_handler (). Now - // that we dont need the reference to it anymore we can decrement - // the refcount whether the connection is successful ot not. - long refcount = svc_handler->decr_refcount (); - - ACE_ASSERT (refcount >= 0); - ACE_UNUSED_ARG (refcount); - - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) IIOP_SSL_Connector::connect ") - ACE_TEXT ("The result is <%d> \n"), result)); + // Connect. + int result = + this->base_connector_.connect (svc_handler, + remote_address, + synch_options); + + // The connect() method creates the service handler and bumps the + // #REFCOUNT# up one extra. There are three possibilities from + // calling connect(): (a) connection succeeds immediately - in this + // case, the #REFCOUNT# on the handler is two; (b) connection + // completion is pending - in this case, the #REFCOUNT# on the + // handler is also two; (c) connection fails immediately - in this + // case, the #REFCOUNT# on the handler is one since close() gets + // called on the handler. + // + // The extra reference count in + // TAO_Connect_Creation_Strategy::make_svc_handler() is needed in + // the case when connection completion is pending and we are going + // to wait on a variable in the handler to changes, signifying + // success or failure. Note, that this increment cannot be done + // once the connect() returns since this might be too late if + // another thread pick up the completion and potentially deletes the + // handler before we get a chance to increment the reference count. + + // No immediate result. Wait for completion. + if (result == -1 && errno == EWOULDBLOCK) + { + if (TAO_debug_level) + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - IIOP_SSL_Connector::make_connection(), " + "going to wait for connection completion on local" + "handle [%d]\n", + svc_handler->get_handle ())); + + // Wait for connection completion. No need to specify timeout + // to wait() since the correct timeout was passed to the + // Connector. The Connector will close the handler in the case + // of timeouts, so the event will complete (either success or + // failure) within timeout. + result = + this->active_connect_strategy_->wait (svc_handler, + 0); + + if (TAO_debug_level > 2) + { + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - IIOP_SSL_Connector::make_connection(), " + "wait done for handle[%d], result = %d\n", + svc_handler->get_handle (), result)); + } + + // There are three possibilities when wait() returns: (a) + // connection succeeded; (b) connection failed; (c) wait() + // failed because of some other error. It is easy to deal with + // (a) and (b). (c) is tricky since the connection is still + // pending and may get completed by some other thread. The + // following code deals with (c). + // Check if the handler has been closed. + int closed = + svc_handler->is_closed (); + + // In case of failures and close() has not be called. + if (result == -1 && + !closed) + { + // First, cancel from connector. + this->base_connector_.cancel (svc_handler); + + // Double check to make sure the handler has not been closed + // yet. This double check is required to ensure that the + // connection handler was not closed yet by some other + // thread since it was still registered with the connector. + // Once connector.cancel() has been processed, we are + // assured that the connector will no longer open/close this + // handler. + closed = + svc_handler->is_closed (); + + // If closed, there is nothing to do here. If not closed, + // it was either opened or is still pending. + if (!closed) + { + // Check if the handler has been opened. + int open = + svc_handler->is_open (); + + // Some other thread was able to open the handler even + // though wait failed for this thread. + if (open) + // Overwrite <result>. + result = 0; + else + { + // Assert that it is still connecting. + ACE_ASSERT (svc_handler->is_connecting ()); + + // Force close the handler now. + svc_handler->close (); + } + } + } + } + + // Irrespective of success or failure, remove the extra #REFCOUNT#. + svc_handler->remove_reference (); + + // In case of errors. if (result == -1) { // Give users a clue to the problem. if (TAO_debug_level) { ACE_DEBUG ((LM_ERROR, - ACE_TEXT ("(%P|%t) %s:%u, connection to ") - ACE_TEXT ("%s:%d failed (%p)\n"), - __FILE__, - __LINE__, - iiop_endpoint->host (), - iiop_endpoint->port (), - ACE_TEXT ("errno"))); + "TAO (%P|%t) - IIOP_Connector::make_connection, " + "connection to <%s:%d> failed (%p)\n", + iiop_endpoint->host (), iiop_endpoint->port (), + "errno")); } - (void) this->active_connect_strategy_->post_failed_connect (svc_handler, - status); - return -1; } - TAO_Transport *base_transport = - TAO_Transport::_duplicate (svc_handler->transport ()); + // At this point, the connection has be successfully connected. + // #REFCOUNT# is one. + if (TAO_debug_level > 2) + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - IIOP_Connector::make_connection, " + "new connection to <%s:%d> on Transport[%d]\n", + iiop_endpoint->host (), iiop_endpoint->port (), + svc_handler->peer ().get_handle ())); - // Add the handler to Cache. - // - // Note that the IIOP-only transport descriptor is used! + TAO_Transport *transport = + svc_handler->transport (); + + // Add the handler to Cache int retval = this->orb_core ()->lane_resources ().transport_cache ().cache_transport (desc, - base_transport); + transport); - if (retval != 0 && TAO_debug_level > 0) + // Failure in adding to cache. + if (retval != 0) { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) IIOP_SSL_Connector::connect ") - ACE_TEXT ("could not add the new connection to ") - ACE_TEXT ("Cache \n"))); + // Close the handler. + svc_handler->close (); + + if (TAO_debug_level > 0) + { + ACE_ERROR ((LM_ERROR, + "TAO (%P|%t) - IIOP_Connector::make_connection, " + "could not add the new connection to cache\n")); + } + + return -1; } // If the wait strategy wants us to be registered with the reactor - // then we do so. - retval = base_transport->wait_strategy ()->register_handler (); + // then we do so. If registeration is required and it succeeds, + // #REFCOUNT# becomes two. + retval = transport->wait_strategy ()->register_handler (); - if (retval != 0 && TAO_debug_level > 0) + // Registration failures. + if (retval != 0) { - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("(%P|%t) IIOP_Connector::connect ") - ACE_LIB_TEXT ("could not add the new connection to reactor \n"))); + // Purge from the connection cache. + transport->purge_entry (); + + // Close the handler. + svc_handler->close (); + + if (TAO_debug_level > 0) + { + ACE_ERROR ((LM_ERROR, + "TAO (%P|%t) - IIOP_Connector::make_connection, " + "could not register the new connection in the reactor\n")); + } + + return -1; } // Handover the transport pointer to the Invocation class. - TAO_Transport *&transport = invocation->transport (); - - transport = base_transport; + TAO_Transport *&invocation_transport = + invocation->transport (); + invocation_transport = transport; return 0; } diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Transport.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Transport.cpp index 8fbb1976ffa..09ba47f567d 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Transport.cpp +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Transport.cpp @@ -29,9 +29,9 @@ TAO_IIOP_SSL_Transport::~TAO_IIOP_SSL_Transport (void) } int -TAO_IIOP_SSL_Transport::handle_input_i (TAO_Resume_Handle &rh, - ACE_Time_Value *max_wait_time, - int block) +TAO_IIOP_SSL_Transport::handle_input (TAO_Resume_Handle &rh, + ACE_Time_Value *max_wait_time, + int block) { int result = 0; @@ -44,7 +44,7 @@ TAO_IIOP_SSL_Transport::handle_input_i (TAO_Resume_Handle &rh, return -1; return - this->TAO_IIOP_Transport::handle_input_i (rh, - max_wait_time, - block); + this->TAO_IIOP_Transport::handle_input (rh, + max_wait_time, + block); } diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Transport.h b/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Transport.h index 46d505776ab..dbc7e1f2356 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Transport.h +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Transport.h @@ -41,7 +41,7 @@ class TAO_Resume_Handle; * sure that SSL session state from a previous connection is not * associated with the non-SSL connection handled by this handler. * - * However, this class overrides the handle_input_i() method to + * However, this class overrides the handle_input() method to * invalidate the current TSS SSL state during a standard IIOP * (insecure) upcall. This prevents SSL session state from a previous * SSL connection from being associated with non-SSL connections @@ -70,9 +70,9 @@ public: * Please check the documentation in "tao/Transport.h" for more * details. */ - virtual int handle_input_i (TAO_Resume_Handle &rh, - ACE_Time_Value *max_wait_time = 0, - int block = 0); + virtual int handle_input (TAO_Resume_Handle &rh, + ACE_Time_Value *max_wait_time = 0, + int block = 0); protected: /// Reference to the SSLIOP::Current object (downcast to gain access diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp index 88e147c21e8..80a09319539 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp @@ -38,7 +38,7 @@ TAO_SSLIOP_Connection_Handler::TAO_SSLIOP_Connection_Handler ( // Creation_Strategy requires a constructor with that signature, we // don't use that implementation, but some (most?) compilers // instantiate it anyway. - ACE_ASSERT (this->orb_core () != 0); + ACE_ASSERT (0); } @@ -63,12 +63,12 @@ TAO_SSLIOP_Connection_Handler::TAO_SSLIOP_Connection_Handler ( // store this pointer (indirectly increment ref count) this->transport (specific_transport); - TAO_Transport::release (specific_transport); } TAO_SSLIOP_Connection_Handler::~TAO_SSLIOP_Connection_Handler (void) { + delete this->transport (); } int @@ -175,20 +175,57 @@ TAO_SSLIOP_Connection_Handler::close_connection (void) int TAO_SSLIOP_Connection_Handler::handle_input (ACE_HANDLE h) { - return this->handle_input_eh (h, this); + int result = + this->handle_input_eh (h, this); + + if (result == -1) + { + this->close_connection (); + return 0; + } + + return result; } int TAO_SSLIOP_Connection_Handler::handle_output (ACE_HANDLE handle) { - return this->handle_output_eh (handle, this); + int result = + this->handle_output_eh (handle, this); + + if (result == -1) + { + this->close_connection (); + return 0; + } + + return result; +} + +int +TAO_SSLIOP_Connection_Handler::handle_timeout (const ACE_Time_Value &, + const void *) +{ + // We don't use this upcall for I/O. This is only used by the + // Connector to indicate that the connection timedout. Therefore, + // we should call close(). + return this->close (); } int -TAO_SSLIOP_Connection_Handler::handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask rm) +TAO_SSLIOP_Connection_Handler::handle_close (ACE_HANDLE, + ACE_Reactor_Mask) { - return this->handle_close_eh (handle, rm, this); + ACE_ASSERT (0); + return 0; +} + +int +TAO_SSLIOP_Connection_Handler::close (u_long) +{ + this->state_changed (TAO_LF_Event::LFS_CONNECTION_CLOSED); + this->transport ()->remove_reference (); + return 0; } int diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.h b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.h index b034528ab69..fa395acbf74 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.h +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.h @@ -66,6 +66,10 @@ public: virtual int open_handler (void *); //@} + /// Close called by the Acceptor or Connector when connection + /// establishment fails. + int close (u_long = 0); + //@{ /** @name Event Handler overloads */ @@ -74,6 +78,8 @@ public: virtual int handle_input (ACE_HANDLE); virtual int handle_output (ACE_HANDLE); virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask); + virtual int handle_timeout (const ACE_Time_Value ¤t_time, + const void *act = 0); virtual int open (void *); //@} diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp index ae62a8ecb47..5a03189d3da 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp @@ -31,13 +31,7 @@ template class TAO_Connect_Creation_Strategy<TAO_SSLIOP_Connection_Handler>; template class ACE_Strategy_Connector<TAO_SSLIOP_Connection_Handler, ACE_SSL_SOCK_CONNECTOR>; template class ACE_Connect_Strategy<TAO_SSLIOP_Connection_Handler, ACE_SSL_SOCK_CONNECTOR>; template class ACE_Connector<TAO_SSLIOP_Connection_Handler, ACE_SSL_SOCK_CONNECTOR>; -template class ACE_Svc_Tuple<TAO_SSLIOP_Connection_Handler>; - -template class ACE_Map_Manager<int, ACE_Svc_Tuple<TAO_SSLIOP_Connection_Handler> *, TAO_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator_Base<int, ACE_Svc_Tuple<TAO_SSLIOP_Connection_Handler> *, TAO_SYNCH_RW_MUTEX>; -template class ACE_Map_Entry<int,ACE_Svc_Tuple<TAO_SSLIOP_Connection_Handler>*>; -template class ACE_Map_Iterator<int,ACE_Svc_Tuple<TAO_SSLIOP_Connection_Handler>*,TAO_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<int,ACE_Svc_Tuple<TAO_SSLIOP_Connection_Handler>*,TAO_SYNCH_RW_MUTEX>; +template class ACE_NonBlocking_Connect_Handler<TAO_SSLIOP_Connection_Handler>; template class ACE_Auto_Basic_Ptr<TAO_SSLIOP_Connection_Handler>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) @@ -47,15 +41,7 @@ template class ACE_Auto_Basic_Ptr<TAO_SSLIOP_Connection_Handler>; #pragma instantiate ACE_Strategy_Connector<TAO_SSLIOP_Connection_Handler, ACE_SSL_SOCK_CONNECTOR> #pragma instantiate ACE_Connect_Strategy<TAO_SSLIOP_Connection_Handler, ACE_SSL_SOCK_CONNECTOR> #pragma instantiate ACE_Connector<TAO_SSLIOP_Connection_Handler, ACE_SSL_SOCK_CONNECTOR> - -#pragma instantiate ACE_Creation_Strategy<TAO_SSLIOP_Connection_Handler> -#pragma instantiate ACE_Svc_Tuple<TAO_SSLIOP_Connection_Handler> - -#pragma instantiate ACE_Map_Manager<int, ACE_Svc_Tuple<TAO_SSLIOP_Connection_Handler> *, TAO_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator_Base<int, ACE_Svc_Tuple<TAO_SSLIOP_Connection_Handler> *, TAO_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Entry<int,ACE_Svc_Tuple<TAO_SSLIOP_Connection_Handler>*> -#pragma instantiate ACE_Map_Iterator<int,ACE_Svc_Tuple<TAO_SSLIOP_Connection_Handler>*,TAO_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<int,ACE_Svc_Tuple<TAO_SSLIOP_Connection_Handler>*,TAO_SYNCH_RW_MUTEX> +#pragma instantiate ACE_NonBlocking_Connect_Handler<TAO_SSLIOP_Connection_Handler> #pragma instantiate ACE_Auto_Basic_Ptr<TAO_SSLIOP_Connection_Handler> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ @@ -418,18 +404,18 @@ TAO_SSLIOP_Connector::ssliop_connect (TAO_SSLIOP_Endpoint *ssl_endpoint, int result = 0; TAO_SSLIOP_Connection_Handler *svc_handler = 0; - TAO_Transport *base_transport = 0; + TAO_Transport *transport = 0; // Check the Cache first for connections if (this->orb_core ()->lane_resources ().transport_cache ().find_transport ( desc, - base_transport) == 0) + transport) == 0) { if (TAO_debug_level > 2) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) SSLIOP_Connector::connect ") ACE_TEXT ("got existing transport[%d]\n"), - base_transport->id ())); + transport->id ())); } else { @@ -447,6 +433,17 @@ TAO_SSLIOP_Connector::ssliop_connect (TAO_SSLIOP_Endpoint *ssl_endpoint, // ACE_Strategy_Connector (the "base_connector_"). This is // thread-safe and reentrant, hence no synchronization is // necessary. + // + // The make_svc_handler() method creates the service handler and + // bumps the #REFCOUNT# up one extra. The extra reference count + // in TAO_Connect_Creation_Strategy::make_svc_handler() is + // needed in the case when connection completion is pending and + // we are going to wait on a variable in the handler to changes, + // signifying success or failure. Note, that this increment + // cannot be done once the connect() returns since this might be + // too late if another thread pick up the completion and + // potentially deletes the handler before we get a chance to + // increment the reference count. if (this->base_connector_.creation_strategy ()->make_svc_handler ( svc_handler) != 0) { @@ -520,55 +517,109 @@ TAO_SSLIOP_Connector::ssliop_connect (TAO_SSLIOP_Endpoint *ssl_endpoint, this->active_connect_strategy_->synch_options (max_wait_time, synch_options); - // We obtain the transport in the <svc_handler> variable. - // As we know now that the connection is not available in - // Cache we can make a new connection + // We obtain the transport in the <svc_handler> variable. As we + // know now that the connection is not available in Cache we can + // make a new connection result = this->base_connector_.connect (svc_handler, remote_address, synch_options); - // base_connector_.connect () will increment the handler's - // reference count once more. This is not needed as we already - // hold a reference to the handler, therefore we discard this - // second reference. - svc_handler->decr_refcount (); + // There are three possibilities from calling connect(): (a) + // connection succeeds immediately - in this case, the + // #REFCOUNT# on the handler is two; (b) connection completion + // is pending - in this case, the #REFCOUNT# on the handler is + // also two; (c) connection fails immediately - in this case, + // the #REFCOUNT# on the handler is one since close() gets + // called on the handler. - // We dont have to wait since we only use a blocked connect - // strategy. + // No immediate result. Wait for completion. if (result == -1 && errno == EWOULDBLOCK) { - if (TAO_debug_level) + if (TAO_debug_level > 2) ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - SSLIOP_Connector::ssliop_connect(), " "going to wait for connection completion on local" "handle [%d]\n", svc_handler->get_handle ())); + // Wait for connection completion. No need to specify timeout + // to wait() since the correct timeout was passed to the + // Connector. The Connector will close the handler in the case + // of timeouts, so the event will complete (either success or + // failure) within timeout. result = this->active_connect_strategy_->wait (svc_handler, - max_wait_time); + 0); if (TAO_debug_level > 2) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - SSLIOP_Connector::ssliop_connect(), " + "TAO (%P|%t) - IIOP_Connector::make_connection" "wait done for handle[%d], result = %d\n", svc_handler->get_handle (), result)); } - } - int status = - svc_handler->is_finalized (); + // There are three possibilities when wait() returns: (a) + // connection succeeded; (b) connection failed; (c) wait() + // failed because of some other error. It is easy to deal with + // (a) and (b). (c) is tricky since the connection is still + // pending and may get completed by some other thread. The + // following code deals with (c). + + // Check if the handler has been closed. + int closed = + svc_handler->is_closed (); - // Reduce the refcount to the svc_handler that we have. The - // increment to the handler is done in make_svc_handler (). Now - // that we dont need the reference to it anymore we can decrement - // the refcount whether the connection is successful or not. - svc_handler->decr_refcount (); + // In case of failures and close() has not be called. + if (result == -1 && + !closed) + { + // First, cancel from connector. + this->base_connector_.cancel (svc_handler); + + // Double check to make sure the handler has not been closed + // yet. This double check is required to ensure that the + // connection handler was not closed yet by some other + // thread since it was still registered with the connector. + // Once connector.cancel() has been processed, we are + // assured that the connector will no longer open/close this + // handler. + closed = + svc_handler->is_closed (); + + // If closed, there is nothing to do here. If not closed, + // it was either opened or is still pending. + if (!closed) + { + // Check if the handler has been opened. + int open = + svc_handler->is_open (); + + // Some other thread was able to open the handler even + // though wait failed for this thread. + if (open) + // Overwrite <result>. + result = 0; + else + { + // Assert that it is still connecting. + ACE_ASSERT (svc_handler->is_connecting ()); + + // Force close the handler now. + svc_handler->close (); + } + } + } + } + + // Irrespective of success or failure, remove the extra #REFCOUNT#. + svc_handler->remove_reference (); + // In case of errors. if (result == -1) { - if (TAO_debug_level > 0) + // Give users a clue to the problem. + if (TAO_debug_level) { char buffer [MAXHOSTNAMELEN + 6 + 1]; ssl_endpoint->addr_to_string (buffer, @@ -581,11 +632,11 @@ TAO_SSLIOP_Connector::ssliop_connect (TAO_SSLIOP_Endpoint *ssl_endpoint, ACE_TEXT ("errno"))); } - (void) this->active_connect_strategy_->post_failed_connect (svc_handler, - status); return -1; } + // At this point, the connection has be successfully connected. + // #REFCOUNT# is one. if (TAO_debug_level > 2) ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - SSLIOP_Connector::ssliop_connect(): " @@ -593,7 +644,8 @@ TAO_SSLIOP_Connector::ssliop_connect (TAO_SSLIOP_Endpoint *ssl_endpoint, remote_address.get_port_number (), svc_handler->peer ().get_handle ())); - base_transport = TAO_Transport::_duplicate (svc_handler->transport ()); + transport = + svc_handler->transport (); ssl_endpoint->qop (qop); ssl_endpoint->trust (trust); @@ -601,36 +653,54 @@ TAO_SSLIOP_Connector::ssliop_connect (TAO_SSLIOP_Endpoint *ssl_endpoint, // Add the handler to Cache int retval = - this->orb_core ()->lane_resources ().transport_cache ().cache_transport ( - desc, - base_transport); + this->orb_core ()->lane_resources ().transport_cache ().cache_transport (desc, + transport); - if (retval != 0 && TAO_debug_level > 0) + // Failure in adding to cache. + if (retval != 0) { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) SSLIOP_Connector::ssliop_connect ") - ACE_TEXT ("could not add the new connection to ") - ACE_TEXT ("cache.\n"))); + // Close the handler. + svc_handler->close (); + + if (TAO_debug_level > 0) + { + ACE_ERROR ((LM_ERROR, + "TAO (%P|%t) - IIOP_Connector::make_connection, " + "could not add the new connection to cache\n")); + } + + return -1; } // If the wait strategy wants us to be registered with the reactor - // then we do so. - int ret = base_transport->wait_strategy ()->register_handler (); + // then we do so. If registeration is required and it succeeds, + // #REFCOUNT# becomes two. + retval = transport->wait_strategy ()->register_handler (); - if (ret != 0 && TAO_debug_level > 0) + // Registration failures. + if (retval != 0) { - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("(%P|%t) SSLIOP_Connector::connect ") - ACE_LIB_TEXT ("could not add the new connection ") - ACE_LIB_TEXT ("to reactor\n"))); + // Purge from the connection cache. + transport->purge_entry (); + + // Close the handler. + svc_handler->close (); + + if (TAO_debug_level > 0) + { + ACE_ERROR ((LM_ERROR, + "TAO (%P|%t) - IIOP_Connector::make_connection, " + "could not register the new connection in the reactor\n")); + } + + return -1; } } - // No need to _duplicate and release since base_transport - // is going out of scope. Transport now has control of - // base_transport. - TAO_Transport *&transport = invocation->transport (); - transport = base_transport; + // Handover the transport pointer to the Invocation class. + TAO_Transport *&invocation_transport = + invocation->transport (); + invocation_transport = transport; return 0; } diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp index 2035aee4208..4b6d332beee 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp @@ -29,23 +29,13 @@ TAO_SSLIOP_Transport::TAO_SSLIOP_Transport ( connection_handler_ (handler), messaging_object_ (0) { - if (connection_handler_ != 0) - { - // REFCNT: Matches one of - // TAO_Transport::connection_handler_close() or - // TAO_Transport::close_connection_shared. - this->connection_handler_->incr_refcount(); - } - // Use the normal GIOP object ACE_NEW (this->messaging_object_, TAO_GIOP_Message_Base (orb_core)); - } TAO_SSLIOP_Transport::~TAO_SSLIOP_Transport (void) { - ACE_ASSERT(this->connection_handler_ == 0); delete this->messaging_object_; } @@ -68,9 +58,9 @@ TAO_SSLIOP_Transport::messaging_object (void) } int -TAO_SSLIOP_Transport::handle_input_i (TAO_Resume_Handle &rh, - ACE_Time_Value *max_wait_time, - int block) +TAO_SSLIOP_Transport::handle_input (TAO_Resume_Handle &rh, + ACE_Time_Value *max_wait_time, + int block) { int result = 0; @@ -80,16 +70,16 @@ TAO_SSLIOP_Transport::handle_input_i (TAO_Resume_Handle &rh, if (result == -1) return -1; - return TAO_Transport::handle_input_i (rh, - max_wait_time, - block); + return TAO_Transport::handle_input (rh, + max_wait_time, + block); } ssize_t -TAO_SSLIOP_Transport::send_i (iovec *iov, - int iovcnt, - size_t &bytes_transferred, - const ACE_Time_Value *max_wait_time) +TAO_SSLIOP_Transport::send (iovec *iov, + int iovcnt, + size_t &bytes_transferred, + const ACE_Time_Value *max_wait_time) { ssize_t retval = this->connection_handler_->peer ().sendv (iov, iovcnt, max_wait_time); @@ -101,9 +91,9 @@ TAO_SSLIOP_Transport::send_i (iovec *iov, } ssize_t -TAO_SSLIOP_Transport::recv_i (char *buf, - size_t len, - const ACE_Time_Value *max_wait_time) +TAO_SSLIOP_Transport::recv (char *buf, + size_t len, + const ACE_Time_Value *max_wait_time) { ssize_t n = this->connection_handler_->peer ().recv (buf, len, @@ -138,35 +128,6 @@ TAO_SSLIOP_Transport::recv_i (char *buf, return n; } - - - -int -TAO_SSLIOP_Transport::register_handler_i (void) -{ - if (TAO_debug_level > 4) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - SSLIOP_Transport::register_handler %d\n", - this->id ())); - } - - // @@ It seems like this method should go away, the right reactor is - // picked at object creation time. - ACE_Reactor *r = this->orb_core_->reactor (); - - if (r == this->connection_handler_->reactor ()) - return 0; - - // Set the flag in the Connection Handler - this->ws_->is_registered (1); - - // Register the handler with the reactor. - return r->register_handler (this->connection_handler_, - ACE_Event_Handler::READ_MASK); -} - - int TAO_SSLIOP_Transport::send_request (TAO_Stub *stub, TAO_ORB_Core *orb_core, @@ -280,17 +241,6 @@ TAO_SSLIOP_Transport::tear_listen_point_list (TAO_InputCDR &cdr) // 1 this->bidirectional_flag (1); - // Just make sure that the connection handler is sane before we go - // head and do anything with it. - ACE_GUARD_RETURN (ACE_Lock, - ace_mon, - *this->handler_lock_, - -1); - - if (this->check_event_handler_i ("SSLIOP_Transport::tear_listen_point_list") - == -1) - return -1; - return this->connection_handler_->process_listen_point_list (listen_list); } @@ -373,17 +323,6 @@ TAO_SSLIOP_Transport::get_listen_point ( // Get the local address of the connection ACE_INET_Addr local_addr; { - // Just make sure that the connection handler is sane before we go - // head and do anything with it. - ACE_GUARD_RETURN (ACE_Lock, - ace_mon, - *this->handler_lock_, - -1); - - if (this->check_event_handler_i ("SSLIOP_Transport::get_listen_point") - == -1) - return -1; - if (this->connection_handler_->peer ().get_local_addr (local_addr) == -1) { @@ -436,11 +375,3 @@ TAO_SSLIOP_Transport::get_listen_point ( return 1; } - -TAO_Connection_Handler * -TAO_SSLIOP_Transport::invalidate_event_handler_i (void) -{ - TAO_Connection_Handler * eh = this->connection_handler_; - this->connection_handler_ = 0; - return eh; -} diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h index fb979d8798d..5f4c8ad6827 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h @@ -72,13 +72,13 @@ public: #endif - /// Overload of the handle_input_i () in the TAO_Transport + /// Overload of the handle_input () in the TAO_Transport /// class. This is required to set up the state guard. The /// thread-per-connection and wait on RW strategies call this - /// handle_input_i (). - virtual int handle_input_i (TAO_Resume_Handle &rh, - ACE_Time_Value *max_wait_time = 0, - int block = 0); + /// handle_input (). + virtual int handle_input (TAO_Resume_Handle &rh, + ACE_Time_Value *max_wait_time = 0, + int block = 0); protected: /** @name Overridden Template Methods * @@ -88,22 +88,19 @@ protected: virtual ACE_Event_Handler * event_handler_i (void); virtual TAO_Connection_Handler *connection_handler_i (void); - virtual TAO_Connection_Handler * invalidate_event_handler_i (void); virtual TAO_Pluggable_Messaging *messaging_object (void); /// Write the complete Message_Block chain to the connection. - virtual ssize_t send_i (iovec *iov, int iovcnt, - size_t &bytes_transferred, - const ACE_Time_Value *timeout = 0); + virtual ssize_t send (iovec *iov, int iovcnt, + size_t &bytes_transferred, + const ACE_Time_Value *timeout = 0); /// Read len bytes from into buf. - virtual ssize_t recv_i (char *buf, - size_t len, - const ACE_Time_Value *s = 0); - - virtual int register_handler_i (void); + virtual ssize_t recv (char *buf, + size_t len, + const ACE_Time_Value *s = 0); public: /// @@TODO: These methods IMHO should have more meaningful diff --git a/TAO/tao/Acceptor_Impl.cpp b/TAO/tao/Acceptor_Impl.cpp index d290d2f4157..dfd5849f1b0 100644 --- a/TAO/tao/Acceptor_Impl.cpp +++ b/TAO/tao/Acceptor_Impl.cpp @@ -87,6 +87,9 @@ template <class SVC_HANDLER> int TAO_Concurrency_Strategy<SVC_HANDLER>::activate_svc_handler (SVC_HANDLER *sh, void *arg) { + // Here the service handler has been created and the new connection + // has been accepted. #REFCOUNT# is one at this point. + if (this->ACE_Concurrency_Strategy<SVC_HANDLER>::activate_svc_handler (sh, arg) == -1) return -1; @@ -94,31 +97,93 @@ TAO_Concurrency_Strategy<SVC_HANDLER>::activate_svc_handler (SVC_HANDLER *sh, // The service handler has been activated. Now cache the handler. if (sh->add_transport_to_cache () == -1) { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("(%P|%t) Could not add the handler to Cache \n"))); + // Adding to the cache fails, close the handler. + sh->close (); + + // #REFCOUNT# is zero at this point. + + if (TAO_debug_level > 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) Could not add the handler to Cache \n"))); + } + + return -1; } + // Registration with cache is successful, #REFCOUNT# is two at this + // point. + TAO_Server_Strategy_Factory *f = this->orb_core_->server_factory (); - // thread-per-connection concurrency model + int result = 0; + // Do we need to create threads? if (f->activate_server_connections ()) { + // Thread-per-connection concurrency model TAO_Thread_Per_Connection_Handler *tpch = 0; ACE_NEW_RETURN (tpch, TAO_Thread_Per_Connection_Handler (sh), -1); - return tpch->activate (f->server_connection_thread_flags (), - f->server_connection_thread_count ()); + result = tpch->activate (f->server_connection_thread_flags (), + f->server_connection_thread_count ()); + } + else + { + // Otherwise, it is the reactive concurrency model. We may want + // to register ourselves with the reactor. Call the register + // handler on the transport. + result = + sh->transport ()->register_handler (); } + if (result != -1) + { + // Activation/registration successful: the handler has been + // registered with either the Reactor or the + // Thread-per-Connection_Handler, and the Transport Cache. + // #REFCOUNT# is three at this point. + + // We can let go of our reference. + sh->transport ()->remove_reference (); + } + else + { + // Activation/registration failure. #REFCOUNT# is two at this + // point. + + // Remove from cache. + sh->transport ()->purge_entry (); + + // #REFCOUNT# is one at this point. + + // Close handler. + sh->close (); + + // #REFCOUNT# is zero at this point. + + if (TAO_debug_level > 0) + { + const char *error = 0; + if (f->activate_server_connections ()) + error = "could not activate new connection"; + else + error = "could not register new connection in the reactor"; + + ACE_ERROR ((LM_ERROR, + "TAO (%P|%t) - Concurrency_Strategy::activate_svc_handler, " + "%s\n", error)); + } + + return -1; + } - // reactive concurrency model. We may want to register ourselves - // with the reactor. Call the register handler on the transport. - return sh->transport ()->register_handler (); + // Success: #REFCOUNT# is two at this point. + return result; } //////////////////////////////////////////////////////////////////////////////// diff --git a/TAO/tao/Asynch_Reply_Dispatcher_Base.cpp b/TAO/tao/Asynch_Reply_Dispatcher_Base.cpp index 21439f66a2a..47b6934cf0c 100644 --- a/TAO/tao/Asynch_Reply_Dispatcher_Base.cpp +++ b/TAO/tao/Asynch_Reply_Dispatcher_Base.cpp @@ -39,7 +39,7 @@ TAO_Asynch_Reply_Dispatcher_Base::~TAO_Asynch_Reply_Dispatcher_Base (void) if (this->transport_ != 0) { this->transport_->idle_after_reply (); - TAO_Transport::release (this->transport_); + this->transport_->remove_reference (); } } diff --git a/TAO/tao/Asynch_Reply_Dispatcher_Base.i b/TAO/tao/Asynch_Reply_Dispatcher_Base.i index 2de4ec8c3ea..232f938f7ff 100644 --- a/TAO/tao/Asynch_Reply_Dispatcher_Base.i +++ b/TAO/tao/Asynch_Reply_Dispatcher_Base.i @@ -4,9 +4,11 @@ ACE_INLINE void TAO_Asynch_Reply_Dispatcher_Base::transport (TAO_Transport *t) { if (this->transport_ != 0) { - TAO_Transport::release (this->transport_); + this->transport_->remove_reference (); } - this->transport_ = TAO_Transport::_duplicate (t); + + this->transport_ = t; + this->transport_->add_reference (); } diff --git a/TAO/tao/Cache_Entries.cpp b/TAO/tao/Cache_Entries.cpp index df610a378f6..4e3ed2de940 100644 --- a/TAO/tao/Cache_Entries.cpp +++ b/TAO/tao/Cache_Entries.cpp @@ -11,14 +11,16 @@ ACE_RCSID(tao, Cache_Entries, "$Id$") TAO_Cache_IntId::TAO_Cache_IntId (TAO_Transport *transport) - : transport_ (TAO_Transport::_duplicate (transport)), + : transport_ (transport), recycle_state_ (ACE_RECYCLABLE_UNKNOWN) { + transport->add_reference (); } TAO_Cache_IntId::~TAO_Cache_IntId (void) { - TAO_Transport::release (this->transport_); + if (this->transport_) + this->transport_->remove_reference (); } TAO_Cache_IntId& @@ -28,9 +30,12 @@ TAO_Cache_IntId::operator= (const TAO_Cache_IntId &rhs) { this->recycle_state_ = rhs.recycle_state_; - TAO_Transport* old_transport = this->transport_; - this->transport_ = TAO_Transport::_duplicate (rhs.transport_); - TAO_Transport::release (old_transport); + TAO_Transport *old_transport = this->transport_; + this->transport_ = rhs.transport_; + if (this->transport_) + this->transport_->add_reference (); + if (old_transport) + old_transport->remove_reference (); } return *this; diff --git a/TAO/tao/Connect_Strategy.cpp b/TAO/tao/Connect_Strategy.cpp index f0cd072677f..8baa2aba950 100644 --- a/TAO/tao/Connect_Strategy.cpp +++ b/TAO/tao/Connect_Strategy.cpp @@ -15,26 +15,3 @@ TAO_Connect_Strategy::TAO_Connect_Strategy (TAO_ORB_Core *orb_core) TAO_Connect_Strategy::~TAO_Connect_Strategy (void) { } - -int -TAO_Connect_Strategy::post_failed_connect (TAO_Connection_Handler *ch, - int is_finalized) -{ - int ref = 0; - if (!is_finalized) - { - // We need to do this here else we will leak memory. We cannot call - // close_connection () for the following reasons - // . the event_handlers get_handle () will return an - // ACE_INVALID_HANDLE as things havent been shutdown - // properly. - // . We cannot relax the conditions since the conditions are right - // for other natural cases ie. LF - // Under these odd circumstances we need to take care of things - // ourseleves - ch->transport (0); - ref = ch->decr_refcount (); - } - - return ref; -} diff --git a/TAO/tao/Connect_Strategy.h b/TAO/tao/Connect_Strategy.h index 3c57d269105..304f6f50201 100644 --- a/TAO/tao/Connect_Strategy.h +++ b/TAO/tao/Connect_Strategy.h @@ -66,16 +66,6 @@ public: virtual int wait (TAO_Connection_Handler *ch, ACE_Time_Value *val) = 0; - /// Cleanup in case of failed connect. - /* - * Do any left over memory management or related things after - * the connect failed. The argument @c is_successful indicates - * whether the connection handler had undergone a sucessful state - * completion or not. - */ - virtual int post_failed_connect (TAO_Connection_Handler *ch, - int is_finalized = 1); - protected: /// Cached copy of the ORB core pointer TAO_ORB_Core *orb_core_; diff --git a/TAO/tao/Connection_Handler.cpp b/TAO/tao/Connection_Handler.cpp index b70d618860b..35b48c1f9d1 100644 --- a/TAO/tao/Connection_Handler.cpp +++ b/TAO/tao/Connection_Handler.cpp @@ -24,14 +24,10 @@ TAO_Connection_Handler::TAO_Connection_Handler (TAO_ORB_Core *orb_core) : orb_core_ (orb_core) , transport_ (0) , tss_resources_ (orb_core->get_tss_resources ()) - , reference_count_ (1) { // @@todo: We need to have a distinct option/ method in the resource // factory for this and TAO_Transport. - this->refcount_lock_ = - this->orb_core_->resource_factory ()->create_cached_connection_lock (); - this->lock_ = this->orb_core_->resource_factory ()->create_cached_connection_lock (); @@ -40,15 +36,20 @@ TAO_Connection_Handler::TAO_Connection_Handler (TAO_ORB_Core *orb_core) this->state_changed (TAO_LF_Event::LFS_CONNECTION_WAIT); } - TAO_Connection_Handler::~TAO_Connection_Handler (void) { - ACE_ASSERT(this->transport_ == 0); - ACE_ASSERT(this->reference_count_ == 0); + int result = + this->release_os_resources (); + + if (result == -1 && TAO_debug_level) + { + ACE_ERROR ((LM_ERROR, + "TAO (%P|%t) - Connection_Handler::~Connection_Handler," + "release_os_resources() failed %p\n")); + } // @@ TODO Use auto_ptr<> delete this->lock_; - delete this->refcount_lock_; } @@ -126,8 +127,8 @@ TAO_Connection_Handler::svc_i (void) (void) this->transport ()->update_transport (); result = - this->transport ()->handle_input_i (rh, - max_wait_time); + this->transport ()->handle_input (rh, + max_wait_time); if (result == -1 && errno == ETIME) { @@ -159,110 +160,17 @@ TAO_Connection_Handler::svc_i (void) void TAO_Connection_Handler::transport (TAO_Transport* transport) { - // The transport can be reset, but not changed! - ACE_ASSERT(this->transport_ == 0 || transport == 0); - - TAO_Transport * tmp = 0; - { - // Make the change atomic - ACE_GUARD (ACE_Lock, ace_mon, *this->lock_); - tmp = this->transport_; - this->transport_ = TAO_Transport::_duplicate (transport); - } - - if (tmp != 0) { - tmp->connection_handler_closing (); - TAO_Transport::release (tmp); - } -} - -long -TAO_Connection_Handler::incr_refcount (void) -{ - ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->refcount_lock_, -1); - - ACE_ASSERT(this->reference_count_ > 0); - return ++this->reference_count_; -} - -long -TAO_Connection_Handler::decr_refcount (void) -{ - { - ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->refcount_lock_, -1); - - if(--this->reference_count_ > 0) - return this->reference_count_; - } - - ACE_ASSERT(this->reference_count_ == 0); - - - int r = this->release_os_resources (); - - if (r == -1 && TAO_debug_level) - { - ACE_ERROR ((LM_ERROR, - "TAO (%P|%t) - Connection_Handler::" - "decr_refcount, release_os_resources() failed %p\n")); - } - - delete this; - - return 0; -} - -void -TAO_Connection_Handler::connection_close_wait (void) -{ - ACE_GUARD (ACE_Lock, ace_mon, *this->lock_); - this->state_changed (TAO_LF_Event::LFS_CONNECTION_CLOSE_WAIT); -} - - - -int -TAO_Connection_Handler::handle_close_eh ( - ACE_HANDLE handle, unsigned long reactor_mask, ACE_Event_Handler * eh) -{ - ACE_HANDLE my_handle = eh->get_handle (); - - if (TAO_debug_level) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Connection_Handler[%d]::handle_close_eh, " - "(%d, %d)\n", - my_handle, handle, reactor_mask)); - } - - if (this->close_connection () == 0) - { - if (TAO_debug_level) - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Connection_Handler[%d]::" - "handle_close, connection closing or already closed\n", - my_handle)); - return 0; - } - - if (TAO_debug_level) - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Connection_Handler[%d]::" - "handle_close, connection fully closed\n", - my_handle)); + this->transport_ = transport; - return 0; + // Enable reference counting on the event handler. + this->transport_->event_handler_i ()->reference_counting_policy ().value + (ACE_Event_Handler::Reference_Counting_Policy::ENABLED); } int TAO_Connection_Handler::handle_output_eh ( ACE_HANDLE, ACE_Event_Handler * eh) { - // We are going to use the transport object to write data. Just make - // sure that we have transport objects to proceed. This is - // perfectly valid assert - ACE_ASSERT (this->transport () != 0); - // Let the transport that it is going to be used (void) this->transport ()->update_transport (); @@ -281,7 +189,7 @@ TAO_Connection_Handler::handle_output_eh ( return_value = this->transport ()->handle_output (); - this->pos_io_hook(return_value); + this->pos_io_hook (return_value); if (return_value != 0) { resume_handle.set_flag (TAO_Resume_Handle::TAO_HANDLE_LEAVE_SUSPENDED); @@ -294,11 +202,6 @@ int TAO_Connection_Handler::handle_input_eh ( ACE_HANDLE h, ACE_Event_Handler * eh) { - // We are going to use the transport object to read data. Just make - // sure that we have transport objects to proceed. This is - // perfectly valid assert - ACE_ASSERT (this->transport () != 0); - // Let the transport know that it is used (void) this->transport ()->update_transport (); @@ -308,20 +211,13 @@ TAO_Connection_Handler::handle_input_eh ( size_t t_id = this->transport ()->id (); - - // Increase the reference count on the upcall that have passed us. - // - // REFCNT: Matches decr_refcount() in this function... - long refcount = this->incr_refcount (); - ACE_ASSERT (refcount > 0); - if (TAO_debug_level > 6) { ACE_HANDLE handle = eh->get_handle(); ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - Connection_Handler[%d]::handle_input, " - "handle = %d/%d, refcount = %d\n", - t_id, handle, h, refcount)); + "handle = %d/%d\n", + t_id, handle, h)); } TAO_Resume_Handle resume_handle (this->orb_core (), @@ -331,220 +227,114 @@ TAO_Connection_Handler::handle_input_eh ( this->pre_io_hook (return_value); if (return_value != 0) - { - // REFCNT: Matches incr_refcount() at the beginning... - refcount = this->decr_refcount (); - ACE_ASSERT (refcount >= 0); - return return_value; - } - - - return_value = this->transport ()->handle_input_i (resume_handle); + return return_value; - this->pos_io_hook(return_value); + return_value = this->transport ()->handle_input (resume_handle); - // REFCNT: Matches incr_refcount() at the beginning... - refcount = this->decr_refcount (); - ACE_ASSERT (refcount >= 0); + this->pos_io_hook (return_value); if (TAO_debug_level > 6) { ACE_HANDLE handle = eh->get_handle (); ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - Connection_Handler[%d]::handle_input, " - "handle = %d/%d, refcount = %d, retval = %d\n", - t_id, handle, h, refcount, return_value)); - } - - if (return_value == -1 || refcount == 0) - { - // This is really a odd case. We could have a race condition if - // we dont do this. Looks like this what happens - // - imagine we have more than 1 server threads - // - The server has got more than one connection from the - // clients - // - The clients make requests and they start dissappearing. - // - The connections start getting closed - // - at that point one of the server threads is woken up to - // and handle_input () is called. - // - the handle_input sees no data and so is about return a -1. - // - if the handle is resumed, it looks like the oen more thread - // gets access to the handle and the handle_input is called by - // another thread. - // - at that point of time if the thread returning -1 to the - // reactor starts closing down the handler, bad things start - // happening. - // Looks subtle though. After adding this I dont see anything - // bad happenin and so let us stick with it... - resume_handle.set_flag (TAO_Resume_Handle::TAO_HANDLE_LEAVE_SUSPENDED); + "handle = %d/%d, retval = %d\n", + t_id, handle, h, return_value)); } return return_value; } int -TAO_Connection_Handler::close_connection_eh (ACE_Event_Handler * eh) +TAO_Connection_Handler::close_connection_eh (ACE_Event_Handler *eh) { - // Perform a double checked locking on the underlying ACE_HANDLE + this->transport ()->send_connection_closed_notifications (); + + // Save the ID for debugging messages ACE_HANDLE handle = eh->get_handle (); + size_t id = this->transport ()->id (); + if (TAO_debug_level) + { + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - Connection_Handler[%d]::" + "close_connection, purging entry from cache\n", + handle)); + } + this->transport ()->purge_entry (); - // If the handle is ACE_INVALID_HANDLE then there is no work to be - // done in this function, and we return immediately. Returning 0 - // indicates the caller (handle_close() most likely), that there is - // no work to be done. - if (handle == ACE_INVALID_HANDLE) + // @@ This seems silly, but if we have no reason to be in the + // reactor, then we dont remove ourselves. + if (this->transport ()->wait_strategy ()->is_registered ()) { - return 0; + ACE_Reactor *eh_reactor = eh->reactor (); + + // These checks are valid as long as the ORB_Core is not + // shutdown. It is good to have these checks and they are valid + // for most of the cases. Please see below for exceptions + if (this->orb_core_->has_shutdown () == 0) + { + // The exception when these are not valid is for + // RTCORBA. With RTCORBA on, you can threads in different + // lanes creating handlers and registering them with reactor + // in those respective lanes. These threads could then even + // go away leaving the task of reclaiming these resources to + // the main thread. For the main thread that takes the + // responsibility of finalizing () the lanes and the pools, + // the calls and comparison make no sense. + ACE_Reactor * reactor = + this->transport()->orb_core()->reactor (); + ACE_ASSERT (eh_reactor == 0 || eh_reactor == reactor); + + ACE_Reactor * orb_core_reactor = this->orb_core_->reactor (); + ACE_ASSERT (reactor == orb_core_reactor); + + if (eh_reactor == 0) + eh_reactor = reactor; + + ACE_UNUSED_ARG (orb_core_reactor); + } + + // The Reactor must not be null, otherwise something else is + // horribly broken. + ACE_ASSERT (eh_reactor != 0); + + if (TAO_debug_level) + { + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - Connection_Handler[%d]::" + "close_connection, removing from the reactor\n", + handle)); + } + + eh_reactor->remove_handler (handle, + ACE_Event_Handler::ALL_EVENTS_MASK | + ACE_Event_Handler::DONT_CALL); + + // Also cancel any timers, we may create those for time-limited + // buffering + if (TAO_debug_level) + { + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - Connection_Handler[%d]::" + "close_connection, cancel all timers\n", + handle)); + } + + eh_reactor->cancel_timer (eh); + + // @@ This seems silly, the reactor is a much better authority to + // find out if a handle is registered... + this->transport ()->wait_strategy ()->is_registered (0); } - size_t id = 0; - { - ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0); - - handle = eh->get_handle (); - - // Double-checked locking. - if(handle == ACE_INVALID_HANDLE) - { - return 0; - } - - // Before closing the socket we need to remove ourselves from the - // Reactor. Sounds silly, as supposedly handle_close() was called - // *BY* the Reactor, but the Reactor calls handle_close() with - // only the masks implied by the handle_XXX() call that returned - // -1, and it does *NOT* remove the Event Handler from all masks. - // Furthermore, this method is also called outside the Reactor - // event loop, for example, when an I/O error is detected during a - // write(). - - // The following assertion is true because: - // - // - // 1) When a connection handler is initialized Transport is not zero - // and the handle is *NOT* ACE_INVALID_HANDLE. - // 2) The code here is run only once, if we get to this point the - // handle was not ACE_INVALID_HANDLE - // 3) this->transport() is only reset after we run this code - // successfully - // - // Or: for this code to run the handle must have changed state from - // something valid to ACE_INVALID_HANDLE, and the transport() field - // will not be changed before that state transition. - // - ACE_ASSERT (this->transport () != 0); - - // Save the ID for debugging messages - id = this->transport()->id (); - if (TAO_debug_level) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Connection_Handler[%d]::" - "close_connection, purging entry from cache\n", - handle)); - } - this->transport ()->purge_entry (); - - // @@ This seems silly, but if we have no reason to be in the - // reactor, then we dont remove ourselves. - if (this->transport ()->wait_strategy ()->is_registered ()) - { - ACE_Reactor * eh_reactor = eh->reactor (); - - // These checks are valid as long as the ORB_Core is not - // shutdown. It is good to have these checks and they are valid - // for most of the cases. Please see below for exceptions - if (this->orb_core_->has_shutdown () == 0) - { - // The exception when these are not valid is for RTCORBA. With - // RTCORBA on, you can threads in different lanes creating - // handlers and registering them with reactor in those - // respective lanes. These threads could then even go away - // leaving the task of reclaiming these resources to the main - // thread. For the main thread that takes the responsibility - // of finalizing () the lanes and the pools, the calls and - // comparison make no sense. - ACE_Reactor * reactor = - this->transport()->orb_core()->reactor (); - ACE_ASSERT (eh_reactor == 0 || eh_reactor == reactor); - - ACE_Reactor * orb_core_reactor = this->orb_core_->reactor (); - ACE_ASSERT (reactor == orb_core_reactor); - - if (eh_reactor == 0) - eh_reactor = reactor; - - ACE_UNUSED_ARG (orb_core_reactor); - } - - // The Reactor must not be null, otherwise something else is - // horribly broken. - ACE_ASSERT (eh_reactor != 0); - - if (TAO_debug_level) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Connection_Handler[%d]::" - "close_connection, removing from the reactor\n", - handle)); - } - - int r = - eh_reactor->remove_handler (handle, - (ACE_Event_Handler::ALL_EVENTS_MASK - | ACE_Event_Handler::DONT_CALL)); - if(r == -1 && TAO_debug_level) - { - ACE_ERROR ((LM_ERROR, - "TAO (%P|%t) - Connection_Handler[%d]::" - "close_connection, problem in remove_handler (%d)\n", - handle, r)); - } - - // Also cancel any timers, we may create those for time-limited - // buffering - if (TAO_debug_level) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Connection_Handler[%d]::" - "close_connection, cancel all timers and refcount [%d]\n", - handle, reference_count_)); - } - r = eh_reactor->cancel_timer (eh); - if (r == -1 && TAO_debug_level) - { - ACE_ERROR ((LM_ERROR, - "TAO (%P|%t) - Connection_Handler[%d]::" - "close_connection, error cancelling timers\n", - handle)); - } - - // @@ This seems silly, the reactor is a much better authority to - // find out if a handle is registered... - this->transport ()->wait_strategy ()->is_registered (0); - } - - this->state_changed (TAO_LF_Event::LFS_CONNECTION_CLOSED); - } - - ACE_ASSERT (this->transport () != 0); - - // Signal the transport that we will no longer have - // a reference to it. This will eventually call - // TAO_Transport::release (). - this->transport (0); - - // The Reactor (or the Connector) holds an implicit reference. - // REFCNT: Matches start count - // REFCNT: only this or handle_input_eh() are called - long refcount = this->decr_refcount (); + this->state_changed (TAO_LF_Event::LFS_CONNECTION_CLOSED); if (TAO_debug_level) { ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - Connection_Handler[%d]::" - "close_connection, refcount = %d\n", - id, refcount)); + "close_connection\n", + id)); } return 1; diff --git a/TAO/tao/Connection_Handler.h b/TAO/tao/Connection_Handler.h index 6401e86aca6..9394e52c1ac 100644 --- a/TAO/tao/Connection_Handler.h +++ b/TAO/tao/Connection_Handler.h @@ -17,12 +17,12 @@ #include "ace/pre.h" #include "LF_CH_Event.h" +#include "ace/Event_Handler.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ - class TAO_ORB_Core; class TAO_ORB_Core_TSS_Resources; class TAO_Transport; @@ -51,23 +51,23 @@ public: /// Constructor TAO_Connection_Handler (TAO_ORB_Core *orb_core); + /// Destructor + virtual ~TAO_Connection_Handler (void); + /// Return the underlying transport object TAO_Transport *transport (void); /// Set the underlying transport object void transport (TAO_Transport* transport); - /// Is the state final? - int is_finalized (void); + /// Is the handler closed? + int is_closed (void); - /// Increment and decrement the refcount. The object is deleted when - /// the refcount reaches zero. - long incr_refcount (void); - long decr_refcount (void); + /// Is the handler open? + int is_open (void); - /// Set the handler in <CODE>LF_EVENT_CONNECTION_CLOSE_WAIT </CODE> - /// state - void connection_close_wait (void); + /// Is the handler in the process of being connected? + int is_connecting (void); /// Close the underlying connection. /** @@ -96,13 +96,6 @@ public: protected: - /// Destructor - /** - * Protected destructor to enforce proper memory management through - * the reference counting mechanism. - */ - virtual ~TAO_Connection_Handler (void); - /// Return our TAO_ORB_Core pointer TAO_ORB_Core *orb_core (void); @@ -125,11 +118,6 @@ protected: * place. */ - /// Implement the handle_close() callback - virtual int handle_close_eh (ACE_HANDLE h, - unsigned long reactor_mask, - ACE_Event_Handler * eh); - /// Implement the handle_output() callback int handle_output_eh (ACE_HANDLE h, ACE_Event_Handler * eh); @@ -140,8 +128,7 @@ protected: /// also Event_Handlers. int close_connection_eh (ACE_Event_Handler * eh); - /// Release the OS resources related to this handler, used in - /// handle_close_eh() + /// Release the OS resources related to this handler. virtual int release_os_resources (void); /// Pre-invocation hook for I/O operations (handle_input() & @@ -170,12 +157,6 @@ private: /// Cached tss resources of the ORB that activated this object. TAO_ORB_Core_TSS_Resources *tss_resources_; - /// Pretty obvious - long reference_count_; - - /// Lock for the reference count - ACE_Lock *refcount_lock_; - /// Internal state lock, needs to be separate from the reference /// count / pending upcalls lock because they interleave. ACE_Lock * lock_; diff --git a/TAO/tao/Connection_Handler.inl b/TAO/tao/Connection_Handler.inl index 7de61103ad9..3562b10159a 100644 --- a/TAO/tao/Connection_Handler.inl +++ b/TAO/tao/Connection_Handler.inl @@ -20,23 +20,20 @@ TAO_Connection_Handler::transport (void) return this->transport_; } -#if 0 -// NOTE: Not used ACE_INLINE int -TAO_Connection_Handler::is_connect_complete (void) const +TAO_Connection_Handler::is_closed (void) { - return this->successful () || this->error_detected (); + return this->state_ == TAO_LF_Event::LFS_CONNECTION_CLOSED; } ACE_INLINE int -TAO_Connection_Handler::is_connect_successful (void) const +TAO_Connection_Handler::is_open (void) { - return (this->error_detected () == 0); + return this->state_ == TAO_LF_Event::LFS_SUCCESS; } -#endif /*if 0*/ ACE_INLINE int -TAO_Connection_Handler::is_finalized (void) +TAO_Connection_Handler::is_connecting (void) { - return this->is_state_final (); + return this->state_ == TAO_LF_Event::LFS_CONNECTION_WAIT; } diff --git a/TAO/tao/Connector_Impl.cpp b/TAO/tao/Connector_Impl.cpp index a4bb4cee8c0..577427054c0 100644 --- a/TAO/tao/Connector_Impl.cpp +++ b/TAO/tao/Connector_Impl.cpp @@ -39,12 +39,11 @@ TAO_Connect_Creation_Strategy<SVC_HANDLER>::make_svc_handler (SVC_HANDLER *&sh) this->arg_), -1); - // Add a reference count. Why is this needed? We need this to make - // sure that the connector doesnt delete this handler when we are - // waiting for non-blocking connects to complete. + // We add to the #REFCOUNT# since the Connector needs this. See + // Connector::make_connection() for details. + sh->add_reference (); - // REFCNT: matches decr_refcount() in XXX_Connector::make_connection() - sh->incr_refcount (); + // At this point, the #REFCOUNT# is two. return 0; } diff --git a/TAO/tao/IIOP_Connection_Handler.cpp b/TAO/tao/IIOP_Connection_Handler.cpp index 9ea68fc555f..46c61744cdb 100644 --- a/TAO/tao/IIOP_Connection_Handler.cpp +++ b/TAO/tao/IIOP_Connection_Handler.cpp @@ -34,7 +34,7 @@ TAO_IIOP_Connection_Handler::TAO_IIOP_Connection_Handler (ACE_Thread_Manager *t) // Creation_Strategy requires a constructor with that signature, we // don't use that implementation, but some (most?) compilers // instantiate it anyway. - ACE_ASSERT (this->orb_core () != 0); + ACE_ASSERT (0); } @@ -54,7 +54,6 @@ TAO_IIOP_Connection_Handler::TAO_IIOP_Connection_Handler ( // store this pointer (indirectly increment ref count) this->transport (specific_transport); - TAO_Transport::release (specific_transport); } TAO_IIOP_Connection_Handler::TAO_IIOP_Connection_Handler (TAO_ORB_Core *orb_core, @@ -67,12 +66,11 @@ TAO_IIOP_Connection_Handler::TAO_IIOP_Connection_Handler (TAO_ORB_Core *orb_core { } - TAO_IIOP_Connection_Handler::~TAO_IIOP_Connection_Handler (void) { + delete this->transport (); } - int TAO_IIOP_Connection_Handler::open_handler (void *v) { @@ -134,7 +132,6 @@ TAO_IIOP_Connection_Handler::open (void*) return -1; } - if (TAO_debug_level > 0) { ACE_TCHAR client[MAXHOSTNAMELEN + 16]; @@ -158,10 +155,6 @@ TAO_IIOP_Connection_Handler::open (void*) return 0; } - - - - int TAO_IIOP_Connection_Handler::resume_handler (void) { @@ -177,26 +170,63 @@ TAO_IIOP_Connection_Handler::close_connection (void) int TAO_IIOP_Connection_Handler::handle_input (ACE_HANDLE h) { - return this->handle_input_eh (h, this); + int result = + this->handle_input_eh (h, this); + + if (result == -1) + { + this->close_connection (); + return 0; + } + + return result; } int TAO_IIOP_Connection_Handler::handle_output (ACE_HANDLE handle) { - return this->handle_output_eh (handle, this); + int result = + this->handle_output_eh (handle, this); + + if (result == -1) + { + this->close_connection (); + return 0; + } + + return result; +} + +int +TAO_IIOP_Connection_Handler::handle_timeout (const ACE_Time_Value &, + const void *) +{ + // We don't use this upcall for I/O. This is only used by the + // Connector to indicate that the connection timedout. Therefore, + // we should call close(). + return this->close (); } int -TAO_IIOP_Connection_Handler::handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask rm) +TAO_IIOP_Connection_Handler::handle_close (ACE_HANDLE, + ACE_Reactor_Mask) { - return this->handle_close_eh (handle, rm, this); + ACE_ASSERT (0); + return 0; +} + +int +TAO_IIOP_Connection_Handler::close (u_long) +{ + this->state_changed (TAO_LF_Event::LFS_CONNECTION_CLOSED); + this->transport ()->remove_reference (); + return 0; } int TAO_IIOP_Connection_Handler::release_os_resources (void) { - return this->peer().close (); + return this->peer ().close (); } int diff --git a/TAO/tao/IIOP_Connection_Handler.h b/TAO/tao/IIOP_Connection_Handler.h index fe7d26c3881..57a562fd0ea 100644 --- a/TAO/tao/IIOP_Connection_Handler.h +++ b/TAO/tao/IIOP_Connection_Handler.h @@ -83,7 +83,7 @@ class TAO_Export TAO_IIOP_Connection_Handler : public TAO_IIOP_SVC_HANDLER, public: - TAO_IIOP_Connection_Handler (ACE_Thread_Manager* t = 0); + TAO_IIOP_Connection_Handler (ACE_Thread_Manager * = 0); /// Constructor. <arg> parameter is used by the Acceptor to pass the /// protocol configuration properties for this connection. @@ -99,6 +99,10 @@ public: /// connected. Argument is unused. virtual int open (void *); + /// Close called by the Acceptor or Connector when connection + /// establishment fails. + int close (u_long = 0); + //@{ /** @name Event Handler overloads */ @@ -107,6 +111,8 @@ public: virtual int handle_input (ACE_HANDLE); virtual int handle_output (ACE_HANDLE); virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask); + virtual int handle_timeout (const ACE_Time_Value ¤t_time, + const void *act = 0); //@} /// Add ourselves to Cache. diff --git a/TAO/tao/IIOP_Connector.cpp b/TAO/tao/IIOP_Connector.cpp index feaaeede5f9..fa3c81b0d21 100644 --- a/TAO/tao/IIOP_Connector.cpp +++ b/TAO/tao/IIOP_Connector.cpp @@ -15,25 +15,17 @@ #include "ace/Strategies_T.h" - ACE_RCSID (TAO, IIOP_Connector, "$Id$") - #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class TAO_Connect_Concurrency_Strategy<TAO_IIOP_Connection_Handler>; template class TAO_Connect_Creation_Strategy<TAO_IIOP_Connection_Handler>; template class ACE_Strategy_Connector<TAO_IIOP_Connection_Handler, ACE_SOCK_CONNECTOR>; template class ACE_Connect_Strategy<TAO_IIOP_Connection_Handler, ACE_SOCK_CONNECTOR>; template class ACE_Connector<TAO_IIOP_Connection_Handler, ACE_SOCK_CONNECTOR>; -template class ACE_Svc_Tuple<TAO_IIOP_Connection_Handler>; - -template class ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<TAO_IIOP_Connection_Handler> *, TAO_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<TAO_IIOP_Connection_Handler> *, TAO_SYNCH_RW_MUTEX>; -template class ACE_Map_Entry<ACE_HANDLE,ACE_Svc_Tuple<TAO_IIOP_Connection_Handler>*>; -template class ACE_Map_Iterator<ACE_HANDLE,ACE_Svc_Tuple<TAO_IIOP_Connection_Handler>*,TAO_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<ACE_HANDLE,ACE_Svc_Tuple<TAO_IIOP_Connection_Handler>*,TAO_SYNCH_RW_MUTEX>; +template class ACE_NonBlocking_Connect_Handler<TAO_IIOP_Connection_Handler>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) @@ -42,17 +34,10 @@ template class ACE_Map_Reverse_Iterator<ACE_HANDLE,ACE_Svc_Tuple<TAO_IIOP_Connec #pragma instantiate ACE_Strategy_Connector<TAO_IIOP_Connection_Handler, ACE_SOCK_CONNECTOR> #pragma instantiate ACE_Connect_Strategy<TAO_IIOP_Connection_Handler, ACE_SOCK_CONNECTOR> #pragma instantiate ACE_Connector<TAO_IIOP_Connection_Handler, ACE_SOCK_CONNECTOR> -#pragma instantiate ACE_Svc_Tuple<TAO_IIOP_Connection_Handler> - -#pragma instantiate ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<TAO_IIOP_Connection_Handler> *, TAO_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<TAO_IIOP_Connection_Handler> *, TAO_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Entry<ACE_HANDLE,ACE_Svc_Tuple<TAO_IIOP_Connection_Handler>*> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE,ACE_Svc_Tuple<TAO_IIOP_Connection_Handler>*,TAO_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_HANDLE,ACE_Svc_Tuple<TAO_IIOP_Connection_Handler>*,TAO_SYNCH_RW_MUTEX> +#pragma instantiate ACE_NonBlocking_Connect_Handler<TAO_IIOP_Connection_Handler> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - TAO_IIOP_Connector::TAO_IIOP_Connector (CORBA::Boolean flag) : TAO_Connector (IOP::TAG_INTERNET_IOP), lite_flag_ (flag), @@ -154,130 +139,214 @@ TAO_IIOP_Connector::make_connection (TAO_GIOP_Invocation *invocation, TAO_IIOP_Endpoint *iiop_endpoint = this->remote_endpoint (desc->endpoint ()); - if (iiop_endpoint == 0) - return -1; - - const ACE_INET_Addr &remote_address = - iiop_endpoint->object_addr (); - - if (TAO_debug_level > 2) - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - IIOP_Connector::make_connection, " - "to <%s:%d>\n", - iiop_endpoint->host(), iiop_endpoint->port())); - - // Get the right synch options - ACE_Synch_Options synch_options; - - this->active_connect_strategy_->synch_options (max_wait_time, - synch_options); - - TAO_IIOP_Connection_Handler *svc_handler = 0; - - // Active connect - int result = this->base_connector_.connect (svc_handler, - remote_address, - synch_options); - - - if (result == -1 && errno == EWOULDBLOCK) - { - if (TAO_debug_level > 2) - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - IIOP_Connector::make_connection, " - "going to wait for connection completion on local" - "handle [%d]\n", - svc_handler->get_handle ())); - - result = - this->active_connect_strategy_->wait (svc_handler, - max_wait_time); - - if (TAO_debug_level > 2) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - IIOP_Connector::make_connection" - "wait done for handle[%d], result = %d\n", - svc_handler->get_handle (), result)); - } - - } - - int status = - svc_handler->is_finalized (); - - // Reduce the refcount to the svc_handler that we have. The - // increment to the handler is done in make_svc_handler (). Now - // that we dont need the reference to it anymore we can decrement - // the refcount whether the connection is successful ot not. - - // REFCNT: Matches with TAO_Connect_Strategy<>::make_svc_handler() - long refcount = svc_handler->decr_refcount (); + if (iiop_endpoint == 0) + return -1; - ACE_ASSERT (refcount >= 0); + const ACE_INET_Addr &remote_address = + iiop_endpoint->object_addr (); + + if (TAO_debug_level > 2) + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - IIOP_Connector::make_connection, " + "to <%s:%d>\n", + iiop_endpoint->host(), iiop_endpoint->port())); + + // Get the right synch options + ACE_Synch_Options synch_options; + + this->active_connect_strategy_->synch_options (max_wait_time, + synch_options); + + TAO_IIOP_Connection_Handler *svc_handler = 0; + + // Connect. + int result = + this->base_connector_.connect (svc_handler, + remote_address, + synch_options); + + // The connect() method creates the service handler and bumps the + // #REFCOUNT# up one extra. There are three possibilities from + // calling connect(): (a) connection succeeds immediately - in this + // case, the #REFCOUNT# on the handler is two; (b) connection + // completion is pending - in this case, the #REFCOUNT# on the + // handler is also two; (c) connection fails immediately - in this + // case, the #REFCOUNT# on the handler is one since close() gets + // called on the handler. + // + // The extra reference count in + // TAO_Connect_Creation_Strategy::make_svc_handler() is needed in + // the case when connection completion is pending and we are going + // to wait on a variable in the handler to changes, signifying + // success or failure. Note, that this increment cannot be done + // once the connect() returns since this might be too late if + // another thread pick up the completion and potentially deletes the + // handler before we get a chance to increment the reference count. + + // No immediate result. Wait for completion. + if (result == -1 && errno == EWOULDBLOCK) + { + if (TAO_debug_level > 2) + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - IIOP_Connector::make_connection, " + "going to wait for connection completion on local" + "handle [%d]\n", + svc_handler->get_handle ())); + + // Wait for connection completion. No need to specify timeout + // to wait() since the correct timeout was passed to the + // Connector. The Connector will close the handler in the case + // of timeouts, so the event will complete (either success or + // failure) within timeout. + result = + this->active_connect_strategy_->wait (svc_handler, + 0); + + if (TAO_debug_level > 2) + { + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - IIOP_Connector::make_connection" + "wait done for handle[%d], result = %d\n", + svc_handler->get_handle (), result)); + } + + // There are three possibilities when wait() returns: (a) + // connection succeeded; (b) connection failed; (c) wait() + // failed because of some other error. It is easy to deal with + // (a) and (b). (c) is tricky since the connection is still + // pending and may get completed by some other thread. The + // following code deals with (c). + + // Check if the handler has been closed. + int closed = + svc_handler->is_closed (); + + // In case of failures and close() has not be called. + if (result == -1 && + !closed) + { + // First, cancel from connector. + this->base_connector_.cancel (svc_handler); + + // Double check to make sure the handler has not been closed + // yet. This double check is required to ensure that the + // connection handler was not closed yet by some other + // thread since it was still registered with the connector. + // Once connector.cancel() has been processed, we are + // assured that the connector will no longer open/close this + // handler. + closed = + svc_handler->is_closed (); + + // If closed, there is nothing to do here. If not closed, + // it was either opened or is still pending. + if (!closed) + { + // Check if the handler has been opened. + int open = + svc_handler->is_open (); + + // Some other thread was able to open the handler even + // though wait failed for this thread. + if (open) + // Overwrite <result>. + result = 0; + else + { + // Assert that it is still connecting. + ACE_ASSERT (svc_handler->is_connecting ()); + + // Force close the handler now. + svc_handler->close (); + } + } + } + } - ACE_UNUSED_ARG (refcount); + // Irrespective of success or failure, remove the extra #REFCOUNT#. + svc_handler->remove_reference (); - if (result == -1) - { - // Give users a clue to the problem. - if (TAO_debug_level) - { - ACE_DEBUG ((LM_ERROR, - "TAO (%P|%t) - IIOP_Connector::make_connection, " - "connection to <%s:%d> failed (%p)\n", - iiop_endpoint->host (), iiop_endpoint->port (), - "errno")); - } + // In case of errors. + if (result == -1) + { + // Give users a clue to the problem. + if (TAO_debug_level) + { + ACE_DEBUG ((LM_ERROR, + "TAO (%P|%t) - IIOP_Connector::make_connection, " + "connection to <%s:%d> failed (%p)\n", + iiop_endpoint->host (), iiop_endpoint->port (), + "errno")); + } + + return -1; + } - (void) this->active_connect_strategy_->post_failed_connect (svc_handler, - status); + // At this point, the connection has be successfully connected. + // #REFCOUNT# is one. + if (TAO_debug_level > 2) + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - IIOP_Connector::make_connection, " + "new connection to <%s:%d> on Transport[%d]\n", + iiop_endpoint->host (), iiop_endpoint->port (), + svc_handler->peer ().get_handle ())); + + TAO_Transport *transport = + svc_handler->transport (); + + // Add the handler to Cache + int retval = + this->orb_core ()->lane_resources ().transport_cache ().cache_transport (desc, + transport); + + // Failure in adding to cache. + if (retval != 0) + { + // Close the handler. + svc_handler->close (); - return -1; - } + if (TAO_debug_level > 0) + { + ACE_ERROR ((LM_ERROR, + "TAO (%P|%t) - IIOP_Connector::make_connection, " + "could not add the new connection to cache\n")); + } - if (TAO_debug_level > 2) - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - IIOP_Connector::make_connection, " - "new connection to <%s:%d> on Transport[%d]\n", - iiop_endpoint->host (), iiop_endpoint->port (), - svc_handler->peer ().get_handle ())); + return -1; + } - TAO_Transport *base_transport = - TAO_Transport::_duplicate (svc_handler->transport ()); + // If the wait strategy wants us to be registered with the reactor + // then we do so. If registeration is required and it succeeds, + // #REFCOUNT# becomes two. + retval = transport->wait_strategy ()->register_handler (); - // Add the handler to Cache - int retval = - this->orb_core ()->lane_resources ().transport_cache ().cache_transport (desc, - base_transport); + // Registration failures. + if (retval != 0) + { + // Purge from the connection cache. + transport->purge_entry (); - if (retval != 0 && TAO_debug_level > 0) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - IIOP_Connector::make_connection, " - "could not add the new connection to cache\n")); - } + // Close the handler. + svc_handler->close (); - // If the wait strategy wants us to be registered with the reactor - // then we do so. - retval = base_transport->wait_strategy ()->register_handler (); + if (TAO_debug_level > 0) + { + ACE_ERROR ((LM_ERROR, + "TAO (%P|%t) - IIOP_Connector::make_connection, " + "could not register the new connection in the reactor\n")); + } - if (retval != 0 && TAO_debug_level > 0) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - IIOP_Connector::make_connection, " - "could not register the new connection in the reactor\n")); - } + return -1; + } - // Handover the transport pointer to the Invocation class. - TAO_Transport *&transport = invocation->transport (); - transport = base_transport; + // Handover the transport pointer to the Invocation class. + TAO_Transport *&invocation_transport = + invocation->transport (); + invocation_transport = transport; - return 0; + return 0; } - - TAO_Profile * TAO_IIOP_Connector::create_profile (TAO_InputCDR& cdr) { diff --git a/TAO/tao/IIOP_Transport.cpp b/TAO/tao/IIOP_Transport.cpp index 716ec4f1cde..522a04233b6 100644 --- a/TAO/tao/IIOP_Transport.cpp +++ b/TAO/tao/IIOP_Transport.cpp @@ -35,13 +35,6 @@ TAO_IIOP_Transport::TAO_IIOP_Transport (TAO_IIOP_Connection_Handler *handler, , connection_handler_ (handler) , messaging_object_ (0) { - if (connection_handler_ != 0) - { - // REFCNT: Matches one of - // TAO_Transport::connection_handler_close() or - // TAO_Transport::close_connection_shared. - this->connection_handler_->incr_refcount(); - } if (flag) { // Use the lite version of the protocol @@ -58,7 +51,6 @@ TAO_IIOP_Transport::TAO_IIOP_Transport (TAO_IIOP_Connection_Handler *handler, TAO_IIOP_Transport::~TAO_IIOP_Transport (void) { - ACE_ASSERT(this->connection_handler_ == 0); delete this->messaging_object_; } @@ -81,9 +73,9 @@ TAO_IIOP_Transport::messaging_object (void) } ssize_t -TAO_IIOP_Transport::send_i (iovec *iov, int iovcnt, - size_t &bytes_transferred, - const ACE_Time_Value *max_wait_time) +TAO_IIOP_Transport::send (iovec *iov, int iovcnt, + size_t &bytes_transferred, + const ACE_Time_Value *max_wait_time) { ssize_t retval = this->connection_handler_->peer ().sendv (iov, iovcnt, max_wait_time); @@ -94,9 +86,9 @@ TAO_IIOP_Transport::send_i (iovec *iov, int iovcnt, } ssize_t -TAO_IIOP_Transport::recv_i (char *buf, - size_t len, - const ACE_Time_Value *max_wait_time) +TAO_IIOP_Transport::recv (char *buf, + size_t len, + const ACE_Time_Value *max_wait_time) { ssize_t n = this->connection_handler_->peer ().recv (buf, len, @@ -121,7 +113,6 @@ TAO_IIOP_Transport::recv_i (char *buf, if (errno == EWOULDBLOCK) return 0; - return -1; } @@ -138,32 +129,6 @@ TAO_IIOP_Transport::recv_i (char *buf, } int -TAO_IIOP_Transport::register_handler_i (void) -{ - if (TAO_debug_level > 4) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - IIOP_Transport[%d]::register_handler\n", - this->id ())); - } - - ACE_Reactor *r = this->orb_core_->reactor (); - - if (r == this->connection_handler_->reactor ()) - return 0; - - // Set the flag in the Connection Handler and in the Wait Strategy - // @@Maybe we should set these flags after registering with the - // reactor. What if the registration fails??? - this->ws_->is_registered (1); - - // Register the handler with the reactor - return r->register_handler (this->connection_handler_, - ACE_Event_Handler::READ_MASK); -} - - -int TAO_IIOP_Transport::send_request (TAO_Stub *stub, TAO_ORB_Core *orb_core, TAO_OutputCDR &stream, @@ -261,9 +226,6 @@ TAO_IIOP_Transport::send_message_shared ( { ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->handler_lock_, -1); - if (this->check_event_handler_i ("IIOP_Transport::send_message_shared") == -1) - return -1; - if (TAO_debug_level > 6) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - ") @@ -271,8 +233,7 @@ TAO_IIOP_Transport::send_message_shared ( ACE_TEXT ("enable_network_priority = %d\n"), this->connection_handler_->enable_network_priority ())); - if (this->connection_handler_ != 0) - this->connection_handler_->set_dscp_codepoint (); + this->connection_handler_->set_dscp_codepoint (); r = this->send_message_shared_i (stub, message_semantics, message_block, max_wait_time); @@ -309,7 +270,6 @@ TAO_IIOP_Transport::generate_request_header (TAO_Operation_Details &opdetails, // setup opdetails.modify_request_id (this->bidirectional_flag ()); - return TAO_Transport::generate_request_header (opdetails, spec, msg); @@ -341,17 +301,6 @@ TAO_IIOP_Transport::tear_listen_point_list (TAO_InputCDR &cdr) // 1 (i.e., non-originating side) this->bidirectional_flag (1); - // Just make sure that the connection handler is sane before we go - // head and do anything with it. - ACE_GUARD_RETURN (ACE_Lock, - ace_mon, - *this->handler_lock_, - -1); - - if (this->check_event_handler_i ("IIOP_Transport::tear_listen_point_list") - == -1) - return -1; - return this->connection_handler_->process_listen_point_list (listen_list); } @@ -421,28 +370,16 @@ TAO_IIOP_Transport::get_listen_point ( // Get the local address of the connection ACE_INET_Addr local_addr; - { - // Just make sure that the connection handler is sane before we go - // head and do anything with it. - ACE_GUARD_RETURN (ACE_Lock, - ace_mon, - *this->handler_lock_, - -1); - - if (this->check_event_handler_i ("IIOP_Transport::get_listen_point") - == -1) - return -1; - if (this->connection_handler_->peer ().get_local_addr (local_addr) - == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("(%P|%t) Could not resolve local ") - ACE_TEXT ("host address in ") - ACE_TEXT ("get_listen_point()\n")), - -1); - } - } + if (this->connection_handler_->peer ().get_local_addr (local_addr) + == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("(%P|%t) Could not resolve local ") + ACE_TEXT ("host address in ") + ACE_TEXT ("get_listen_point()\n")), + -1); + } // Note: Looks like there is no point in sending the list of // endpoints on interfaces on which this connection has not @@ -484,33 +421,12 @@ TAO_IIOP_Transport::get_listen_point ( return 1; } -TAO_Connection_Handler * -TAO_IIOP_Transport::invalidate_event_handler_i (void) -{ - TAO_Connection_Handler * eh = this->connection_handler_; - this->connection_handler_ = 0; - return eh; -} - void TAO_IIOP_Transport::update_protocol_properties (int snd_buf_sz, int rcv_buf_sz, int no_delay, int enable_nw_prio) { - // Just make sure that the connection handler is sane before we go - // head and do anything with it. - ACE_GUARD (ACE_Lock, - ace_mon, - *this->handler_lock_); - - if (this->check_event_handler_i ( - "IIOP_Transport::update_protocol_properties") == -1) - return; - - /// Making an outbound call holding a lock. This is not suposed to - /// be done. But it would be dangerous to leave the lock since the - /// connection handler could dissappear. this->connection_handler_->update_protocol_properties ( snd_buf_sz, rcv_buf_sz, diff --git a/TAO/tao/IIOP_Transport.h b/TAO/tao/IIOP_Transport.h index 820f7e67e97..1670858789b 100644 --- a/TAO/tao/IIOP_Transport.h +++ b/TAO/tao/IIOP_Transport.h @@ -70,20 +70,17 @@ protected: //@{ virtual ACE_Event_Handler * event_handler_i (void); - virtual TAO_Connection_Handler * invalidate_event_handler_i (void); /// Access the underlying messaging object virtual TAO_Pluggable_Messaging *messaging_object (void); - virtual ssize_t send_i (iovec *iov, int iovcnt, - size_t &bytes_transferred, - const ACE_Time_Value *timeout = 0); + virtual ssize_t send (iovec *iov, int iovcnt, + size_t &bytes_transferred, + const ACE_Time_Value *timeout = 0); - virtual ssize_t recv_i (char *buf, - size_t len, - const ACE_Time_Value *s = 0); - - virtual int register_handler_i (void); + virtual ssize_t recv (char *buf, + size_t len, + const ACE_Time_Value *s = 0); virtual int send_message_shared (TAO_Stub *stub, int message_semantics, diff --git a/TAO/tao/Invocation.cpp b/TAO/tao/Invocation.cpp index 46af924c2ea..9561555ce18 100644 --- a/TAO/tao/Invocation.cpp +++ b/TAO/tao/Invocation.cpp @@ -147,7 +147,8 @@ TAO_GIOP_Invocation::~TAO_GIOP_Invocation (void) /// Ossama remove this when you are done.. if (this->profile_) this->profile_->_decr_refcnt (); - TAO_Transport::release (this->transport_); + if (this->transport_) + this->transport_->remove_reference (); } // The public API involves creating an invocation, starting it, filling @@ -236,13 +237,10 @@ TAO_GIOP_Invocation::perform_call (TAO_Transport_Descriptor_Interface &desc if (this->transport_ != 0) { this->transport_->make_idle (); + this->transport_->remove_reference (); + this->transport_ = 0; } - // Release the transport prior to connecting. - // In most cases the transport_ will already be zero. - TAO_Transport::release (this->transport_); - this->transport_ = 0; - // Get a pointer to the connector registry, which might be in // thread-specific storage, depending on the concurrency model. TAO_Connector_Registry *conn_reg = @@ -494,8 +492,7 @@ TAO_GIOP_Invocation::close_connection (void) // false error reports to applications. this->transport_->close_connection (); - // this->transport_->idle (); - TAO_Transport::release (this->transport_); + this->transport_->remove_reference (); this->transport_ = 0; this->endpoint_ = 0; diff --git a/TAO/tao/LF_CH_Event.cpp b/TAO/tao/LF_CH_Event.cpp index 700871bf95d..907e58821a2 100644 --- a/TAO/tao/LF_CH_Event.cpp +++ b/TAO/tao/LF_CH_Event.cpp @@ -48,23 +48,13 @@ TAO_LF_CH_Event::state_changed_i (int new_state) } else if (this->state_ == TAO_LF_Event::LFS_SUCCESS) { - if (new_state == TAO_LF_Event::LFS_CONNECTION_CLOSE_WAIT - || new_state == TAO_LF_Event::LFS_CONNECTION_CLOSED) + if (new_state == TAO_LF_Event::LFS_CONNECTION_CLOSED) { this->prev_state_ = this->state_; this->state_ = new_state; } return; } - else if (this->state_ == TAO_LF_Event::LFS_CONNECTION_CLOSE_WAIT) - { - if (new_state == TAO_LF_Event::LFS_CONNECTION_CLOSED) - { - // Dont reset the previous state. We could have come only - // from SUCESS. Let that state be preserved. - this->state_ = new_state; - } - } else if (this->state_ == TAO_LF_Event::LFS_TIMEOUT) { if (new_state == TAO_LF_Event::LFS_CONNECTION_CLOSED) @@ -91,8 +81,6 @@ TAO_LF_CH_Event::error_detected (void) const { if (this->prev_state_ == TAO_LF_Event::LFS_CONNECTION_WAIT) return this->state_ == TAO_LF_Event::LFS_CONNECTION_CLOSED; - else if (this->prev_state_ == TAO_LF_Event::LFS_CONNECTION_CLOSE_WAIT) - return (this->state_ != TAO_LF_Event::LFS_CONNECTION_CLOSED); return 0; } diff --git a/TAO/tao/LF_CH_Event.h b/TAO/tao/LF_CH_Event.h index 587874266b4..bbc54d64363 100644 --- a/TAO/tao/LF_CH_Event.h +++ b/TAO/tao/LF_CH_Event.h @@ -75,27 +75,21 @@ private: * * LFS_TIMEOUT - The event has timed out. * - * LFS_CONNECTION_CLOSE_WAIT - A temporary state before complete - * connection closure. An event - * handler in this state is supposed to - * be getting ready for closure. - * * LFS_CONNECTION_CLOSED - The connection was closed since * an error occured while trying to * establish connection * * Event State Diagram * ------------------- - * |----> CLOSED <-| - * | ^ | - * | | | - * IDLE ---> CONNECTION_WAIT-| | CLOSE_WAIT - * | | ^ - * | | | - * |----> SUCESS---> + * |----> CLOSED + * | ^ + * | | + * IDLE ---> CONNECTION_WAIT--| | + * | | + * | | + * |----> SUCESS * - * Timeouts can occur while waiting for connections or during - * CLOSE_WAIT state. + * Timeouts can occur while waiting for connections. * */ virtual void state_changed_i (int new_state); diff --git a/TAO/tao/LF_Connect_Strategy.cpp b/TAO/tao/LF_Connect_Strategy.cpp index b69fe08fc5d..f641d87813a 100644 --- a/TAO/tao/LF_Connect_Strategy.cpp +++ b/TAO/tao/LF_Connect_Strategy.cpp @@ -68,11 +68,8 @@ TAO_LF_Connect_Strategy::wait (TAO_Connection_Handler *ch, max_wait_time); // Set the result. - if (!ch->successful () && result != -1) + if (ch->error_detected () && result != -1) result = -1; - // @@todo We need to use a auto_ptr<>-like object here! - // TAO_Transport::release(transport); - return result; } diff --git a/TAO/tao/LF_Event.h b/TAO/tao/LF_Event.h index c6d919a333a..6dd77f6e23b 100644 --- a/TAO/tao/LF_Event.h +++ b/TAO/tao/LF_Event.h @@ -89,9 +89,6 @@ public: LFS_FAILURE, /// The event has timed out LFS_TIMEOUT, - /// The event is waiting for connection closure. This is a - /// temporary state - LFS_CONNECTION_CLOSE_WAIT, /// The connection was closed. LFS_CONNECTION_CLOSED }; diff --git a/TAO/tao/Makefile.bor b/TAO/tao/Makefile.bor index 0ca53ad1279..6766c6a1b36 100644 --- a/TAO/tao/Makefile.bor +++ b/TAO/tao/Makefile.bor @@ -61,7 +61,6 @@ OBJFILES = \ $(OBJDIR)\Default_Collocation_Resolver.obj \ $(OBJDIR)\Connection_Purging_Strategy.obj \ $(OBJDIR)\Connection_Handler.obj \ - $(OBJDIR)\Notify_Handler.obj \ $(OBJDIR)\Thread_Per_Connection_Handler.obj \ $(OBJDIR)\Connector_Impl.obj \ $(OBJDIR)\Connector_Registry.obj \ diff --git a/TAO/tao/Makefile.tao b/TAO/tao/Makefile.tao index 7f02bc8a0e6..b926ce56dac 100644 --- a/TAO/tao/Makefile.tao +++ b/TAO/tao/Makefile.tao @@ -92,7 +92,6 @@ PLUGGABLE_PROTOCOLS_FILES = \ Transport_Connector \ Transport \ Incoming_Message_Queue \ - Notify_Handler \ Resume_Handle \ Profile \ Endpoint \ @@ -1326,7 +1325,7 @@ realclean: Queued_Message.inl Asynch_Queued_Message.h Flushing_Strategy.h \ Thread_Lane_Resources.h \ Thread_Lane_Resources.i \ - debug.h Resume_Handle.h Resume_Handle.inl Notify_Handler.h \ + debug.h Resume_Handle.h Resume_Handle.inl \ Codeset_Manager.h \ CONV_FRAMEC.h \ Codeset_Translator_Factory.h \ @@ -1607,296 +1606,6 @@ realclean: $(ACE_ROOT)/ace/Thread_Manager.i \ ORB_Core.i debug.h -.obj/Notify_Handler.o .obj/Notify_Handler.so .shobj/Notify_Handler.o .shobj/Notify_Handler.so: Notify_Handler.cpp Notify_Handler.h \ - $(ACE_ROOT)/ace/pre.h \ - TAO_Export.h \ - $(ACE_ROOT)/ace/post.h \ - $(ACE_ROOT)/ace/ace_wchar.h \ - $(ACE_ROOT)/ace/ace_wchar.inl \ - $(ACE_ROOT)/ace/Event_Handler.h \ - $(ACE_ROOT)/ace/ACE_export.h \ - $(ACE_ROOT)/ace/OS.h \ - $(ACE_ROOT)/ace/OS_Dirent.h \ - $(ACE_ROOT)/ace/OS_Export.h \ - $(ACE_ROOT)/ace/OS_Errno.h \ - $(ACE_ROOT)/ace/OS_Errno.inl \ - $(ACE_ROOT)/ace/OS_Dirent.inl \ - $(ACE_ROOT)/ace/OS_String.h \ - $(ACE_ROOT)/ace/Basic_Types.h \ - $(ACE_ROOT)/ace/Basic_Types.i \ - $(ACE_ROOT)/ace/OS_String.inl \ - $(ACE_ROOT)/ace/OS_Memory.h \ - $(ACE_ROOT)/ace/OS_Memory.inl \ - $(ACE_ROOT)/ace/OS_TLI.h \ - $(ACE_ROOT)/ace/OS_TLI.inl \ - $(ACE_ROOT)/ace/Time_Value.h \ - $(ACE_ROOT)/ace/Time_Value.inl \ - $(ACE_ROOT)/ace/Default_Constants.h \ - $(ACE_ROOT)/ace/Global_Macros.h \ - $(ACE_ROOT)/ace/Min_Max.h \ - $(ACE_ROOT)/ace/streams.h \ - $(ACE_ROOT)/ace/Trace.h \ - $(ACE_ROOT)/ace/OS.i \ - $(ACE_ROOT)/ace/Event_Handler.i \ - Connection_Handler.h LF_CH_Event.h LF_Event.h LF_Event.inl \ - LF_Invocation_Event.inl \ - Connection_Handler.inl \ - Transport.h corbafwd.h \ - $(ACE_ROOT)/ace/CDR_Base.h \ - $(ACE_ROOT)/ace/CDR_Base.inl \ - orbconf.h \ - TAO_Export.h \ - corbafwd.i \ - Exception.h \ - corbafwd.h \ - $(ACE_ROOT)/ace/CORBA_macros.h \ - $(ACE_ROOT)/ace/Exception_Macros.h \ - $(ACE_ROOT)/ace/SStringfwd.h \ - $(ACE_ROOT)/ace/iosfwd.h \ - Exception.i \ - Transport_Descriptor_Interface.h \ - Transport_Descriptor_Interface.inl \ - Transport_Cache_Manager.h \ - Cache_Entries.h \ - Transport_Descriptor_Interface.h \ - $(ACE_ROOT)/ace/Recyclable.h \ - $(ACE_ROOT)/ace/Recyclable.inl \ - Cache_Entries.inl \ - $(ACE_ROOT)/ace/Hash_Map_Manager_T.h \ - $(ACE_ROOT)/ace/Functor.h \ - $(ACE_ROOT)/ace/ACE.h \ - $(ACE_ROOT)/ace/Flag_Manip.h \ - $(ACE_ROOT)/ace/Flag_Manip.i \ - $(ACE_ROOT)/ace/Handle_Ops.h \ - $(ACE_ROOT)/ace/Handle_Ops.i \ - $(ACE_ROOT)/ace/Lib_Find.h \ - $(ACE_ROOT)/ace/Lib_Find.i \ - $(ACE_ROOT)/ace/Init_ACE.h \ - $(ACE_ROOT)/ace/Init_ACE.i \ - $(ACE_ROOT)/ace/Sock_Connect.h \ - $(ACE_ROOT)/ace/Sock_Connect.i \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Functor.i \ - $(ACE_ROOT)/ace/Functor_T.h \ - $(ACE_ROOT)/ace/Functor_T.i \ - $(ACE_ROOT)/ace/Functor_T.cpp \ - $(ACE_ROOT)/ace/Log_Msg.h \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/OS_Log_Msg_Attributes.h \ - $(ACE_ROOT)/ace/OS_Log_Msg_Attributes.inl \ - $(ACE_ROOT)/ace/Hash_Map_Manager_T.i \ - $(ACE_ROOT)/ace/Synch.h \ - $(ACE_ROOT)/ace/Synch.i \ - $(ACE_ROOT)/ace/Synch_T.h \ - $(ACE_ROOT)/ace/Synch_T.i \ - $(ACE_ROOT)/ace/Thread.h \ - $(ACE_ROOT)/ace/Thread_Adapter.h \ - $(ACE_ROOT)/ace/Base_Thread_Adapter.h \ - $(ACE_ROOT)/ace/Base_Thread_Adapter.inl \ - $(ACE_ROOT)/ace/Thread_Adapter.inl \ - $(ACE_ROOT)/ace/Thread.i \ - $(ACE_ROOT)/ace/Synch_T.cpp \ - $(ACE_ROOT)/ace/Hash_Map_Manager_T.cpp \ - $(ACE_ROOT)/ace/Service_Config.h \ - $(ACE_ROOT)/ace/Unbounded_Queue.h \ - $(ACE_ROOT)/ace/Node.h \ - $(ACE_ROOT)/ace/Node.cpp \ - $(ACE_ROOT)/ace/Unbounded_Queue.inl \ - $(ACE_ROOT)/ace/Unbounded_Queue.cpp \ - $(ACE_ROOT)/ace/Malloc_Base.h \ - $(ACE_ROOT)/ace/Unbounded_Set.h \ - $(ACE_ROOT)/ace/Unbounded_Set.inl \ - $(ACE_ROOT)/ace/Unbounded_Set.cpp \ - $(ACE_ROOT)/ace/SString.h \ - $(ACE_ROOT)/ace/String_Base.h \ - $(ACE_ROOT)/ace/String_Base_Const.h \ - $(ACE_ROOT)/ace/String_Base.i \ - $(ACE_ROOT)/ace/String_Base.cpp \ - $(ACE_ROOT)/ace/Malloc.h \ - $(ACE_ROOT)/ace/Malloc.i \ - $(ACE_ROOT)/ace/Malloc_T.h \ - $(ACE_ROOT)/ace/Malloc_Allocator.h \ - $(ACE_ROOT)/ace/Malloc_Allocator.i \ - $(ACE_ROOT)/ace/Free_List.h \ - $(ACE_ROOT)/ace/Free_List.i \ - $(ACE_ROOT)/ace/Free_List.cpp \ - $(ACE_ROOT)/ace/Malloc_T.i \ - $(ACE_ROOT)/ace/Malloc_T.cpp \ - $(ACE_ROOT)/ace/Memory_Pool.h \ - $(ACE_ROOT)/ace/Signal.h \ - $(ACE_ROOT)/ace/Signal.i \ - $(ACE_ROOT)/ace/Mem_Map.h \ - $(ACE_ROOT)/ace/Mem_Map.i \ - $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ - $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ - $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ - $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ - $(ACE_ROOT)/ace/Memory_Pool.i \ - $(ACE_ROOT)/ace/Auto_Ptr.h \ - $(ACE_ROOT)/ace/Auto_Ptr.i \ - $(ACE_ROOT)/ace/Auto_Ptr.cpp \ - $(ACE_ROOT)/ace/SString.i \ - $(ACE_ROOT)/ace/XML_Svc_Conf.h \ - $(ACE_ROOT)/ace/Service_Config.i \ - $(ACE_ROOT)/ace/Reactor.h \ - $(ACE_ROOT)/ace/Handle_Set.h \ - $(ACE_ROOT)/ace/Handle_Set.i \ - $(ACE_ROOT)/ace/Timer_Queue.h \ - $(ACE_ROOT)/ace/Timer_Queue_T.h \ - $(ACE_ROOT)/ace/Test_and_Set.h \ - $(ACE_ROOT)/ace/Test_and_Set.i \ - $(ACE_ROOT)/ace/Test_and_Set.cpp \ - $(ACE_ROOT)/ace/Timer_Queue_T.i \ - $(ACE_ROOT)/ace/Timer_Queue_T.cpp \ - $(ACE_ROOT)/ace/Reactor.i \ - $(ACE_ROOT)/ace/Reactor_Impl.h \ - $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \ - Transport_Cache_Manager.inl \ - Transport_Timer.h Incoming_Message_Queue.h Pluggable_Messaging_Utils.h \ - IOP_IORC.h \ - OctetSeqC.h \ - Sequence.h \ - Managed_Types.h \ - Managed_Types.i \ - $(ACE_ROOT)/ace/Message_Block.h \ - $(ACE_ROOT)/ace/Message_Block.i \ - $(ACE_ROOT)/ace/Message_Block_T.h \ - $(ACE_ROOT)/ace/Message_Block_T.i \ - $(ACE_ROOT)/ace/Message_Block_T.cpp \ - Sequence.i \ - Sequence_T.h \ - Sequence_T.i \ - Sequence_T.cpp \ - Typecode.h \ - Exception.h \ - Pseudo_VarOut_T.h \ - Pseudo_VarOut_T.inl \ - Pseudo_VarOut_T.cpp \ - Typecode.i \ - Environment.h \ - Environment.i \ - Seq_Var_T.h \ - Seq_Var_T.inl \ - Seq_Var_T.cpp \ - Seq_Out_T.h \ - Seq_Out_T.inl \ - Seq_Out_T.cpp \ - OctetSeqC.i \ - VarOut_T.h \ - VarOut_T.inl \ - VarOut_T.cpp \ - CDR.h \ - $(ACE_ROOT)/ace/CDR_Stream.h \ - $(ACE_ROOT)/ace/CDR_Stream.i \ - CDR.i \ - IOP_IORC.i \ - Pluggable_Messaging_Utils.i \ - Incoming_Message_Queue.inl Synch_Refcountable.h \ - $(ACE_ROOT)/ace/Refcountable.h \ - $(ACE_ROOT)/ace/Refcountable.inl \ - Synch_Refcountable.inl Transport.inl ORB_Core.h ORB.h ServicesC.h \ - ServicesC.i CORBA_String.h \ - CORBA_String.inl \ - ObjectIdListC.h ObjectIdListC.i objectid.h PolicyC.h CurrentC.h \ - Object.h \ - Policy_ForwardC.h \ - Objref_VarOut_T.h \ - varbase.h \ - Objref_VarOut_T.inl \ - Objref_VarOut_T.cpp \ - Policy_ForwardC.i \ - Object_KeyC.h \ - Object_KeyC.i \ - Object.i \ - Any_Impl_T.h \ - Any.h \ - Any.i \ - Any_Impl_T.inl \ - Any_Impl_T.cpp \ - Marshal.h \ - Marshal.i \ - debug.h \ - CurrentC.i Policy_ForwardC.h Remote_Object_Proxy_Impl.h \ - Object_Proxy_Impl.h \ - PolicyC.i \ - ORB.i \ - Environment.h Policy_Manager.h \ - Policy_Set.h \ - PolicyC.h \ - Policy_Set.i \ - LocalObject.h \ - LocalObject.i \ - Policy_Manager.i \ - Resource_Factory.h \ - $(ACE_ROOT)/ace/Service_Object.h \ - $(ACE_ROOT)/ace/Shared_Object.h \ - $(ACE_ROOT)/ace/Shared_Object.i \ - $(ACE_ROOT)/ace/DLL.h \ - $(ACE_ROOT)/ace/Service_Object.i \ - CONV_FRAMEC.h CONV_FRAMEC.i params.h \ - params.i \ - TAO_Singleton_Manager.h \ - TAO_Singleton_Manager.inl \ - TAO_Singleton.h \ - TAO_Singleton.inl \ - TAO_Singleton.cpp \ - TAO_Singleton.h \ - $(ACE_ROOT)/ace/Object_Manager.h \ - $(ACE_ROOT)/ace/Object_Manager.i \ - $(ACE_ROOT)/ace/Managed_Object.h \ - $(ACE_ROOT)/ace/Managed_Object.i \ - $(ACE_ROOT)/ace/Managed_Object.cpp \ - TAO_Singleton_Manager.h \ - Adapter.h Adapter.i PolicyFactory_Registry.h PortableInterceptorC.h \ - PI_ForwardC.h OctetSeqC.h StringSeqC.h Sequence.h StringSeqC.i \ - PI_ForwardC.i DynamicC.h \ - Any_Dual_Impl_T.h \ - Any_Dual_Impl_T.inl \ - Any_Dual_Impl_T.cpp \ - DynamicC.i Messaging_SyncScopeC.h Messaging_SyncScopeC.i IOPC.h \ - IOP_CodecC.h \ - IOP_CodecC.i \ - IOPC.i PortableInterceptorC.i \ - $(ACE_ROOT)/ace/Map_Manager.h \ - $(ACE_ROOT)/ace/Map_Manager.i \ - $(ACE_ROOT)/ace/Map_Manager.cpp \ - Parser_Registry.h \ - Parser_Registry.i \ - Service_Callbacks.h \ - IOPC.h \ - Service_Callbacks.i \ - Fault_Tolerance_Service.h \ - Fault_Tolerance_Service.i \ - Cleanup_Func_Registry.h \ - $(ACE_ROOT)/ace/Array_Base.h \ - $(ACE_ROOT)/ace/Array_Base.inl \ - $(ACE_ROOT)/ace/Array_Base.cpp \ - Cleanup_Func_Registry.inl Object_Ref_Table.h ObjectKey_Table.h \ - $(ACE_ROOT)/ace/RB_Tree.h \ - $(ACE_ROOT)/ace/RB_Tree.i \ - $(ACE_ROOT)/ace/RB_Tree.cpp \ - Interceptor_List.h Interceptor_List.inl PICurrent.h LocalObject.h \ - PICurrent.inl \ - $(ACE_ROOT)/ace/Thread_Manager.h \ - $(ACE_ROOT)/ace/Thread_Exit.h \ - $(ACE_ROOT)/ace/Thread_Control.h \ - $(ACE_ROOT)/ace/Thread_Control.inl \ - $(ACE_ROOT)/ace/Containers.h \ - $(ACE_ROOT)/ace/Containers.i \ - $(ACE_ROOT)/ace/Containers_T.h \ - $(ACE_ROOT)/ace/Containers_T.i \ - $(ACE_ROOT)/ace/Containers_T.cpp \ - $(ACE_ROOT)/ace/Singleton.h \ - $(ACE_ROOT)/ace/Singleton.i \ - $(ACE_ROOT)/ace/Singleton.cpp \ - $(ACE_ROOT)/ace/Framework_Component.h \ - $(ACE_ROOT)/ace/Framework_Component.inl \ - $(ACE_ROOT)/ace/Framework_Component_T.h \ - $(ACE_ROOT)/ace/Framework_Component_T.inl \ - $(ACE_ROOT)/ace/Framework_Component_T.cpp \ - $(ACE_ROOT)/ace/Thread_Manager.i \ - ORB_Core.i Resume_Handle.h Resume_Handle.inl - .obj/Resume_Handle.o .obj/Resume_Handle.so .shobj/Resume_Handle.o .shobj/Resume_Handle.so: Resume_Handle.cpp Resume_Handle.h \ $(ACE_ROOT)/ace/pre.h \ TAO_Export.h \ diff --git a/TAO/tao/Notify_Handler.cpp b/TAO/tao/Notify_Handler.cpp deleted file mode 100644 index 22011d19569..00000000000 --- a/TAO/tao/Notify_Handler.cpp +++ /dev/null @@ -1,116 +0,0 @@ -#include "Notify_Handler.h" -#include "Connection_Handler.h" -#include "Transport.h" -#include "ORB_Core.h" -#include "ace/Malloc_T.h" -#include "Resume_Handle.h" - -ACE_RCSID (tao, - Notify_Handler, - "$Id$") - -TAO_Notify_Handler::TAO_Notify_Handler (TAO_Transport *t, - ACE_HANDLE h, - ACE_Allocator *alloc) - : ACE_Event_Handler (t->orb_core ()->reactor ()), - // REFCNT: Matches with Notify_Handler::~Notify_Handler() - t_ (TAO_Transport::_duplicate (t)), - h_ (h), - allocator_ (alloc) -{ -} - -TAO_Notify_Handler::TAO_Notify_Handler (TAO_Connection_Handler *ch, - ACE_Allocator *alloc) - : ACE_Event_Handler (ch->transport ()->orb_core ()->reactor ()), - // REFCNT: Matches with Notify_Handler::~Notify_Handler() - t_ (ch->transport ()), - h_ (ACE_INVALID_HANDLE), - allocator_ (alloc) -{ - // This constructor should *never* get called, it is just here to - // for backward comptibility. - ACE_ASSERT (ch == 0); -} - -TAO_Notify_Handler::~TAO_Notify_Handler (void) -{ - TAO_Transport::release (this->t_); -} - - -/*static*/ TAO_Notify_Handler * -TAO_Notify_Handler::create_handler (TAO_Connection_Handler *, - ACE_Allocator *) -{ - return 0; -} - -/*static*/ TAO_Notify_Handler * -TAO_Notify_Handler::create_handler (TAO_Transport *t, - ACE_HANDLE h, - ACE_Allocator *alloc) -{ - TAO_Notify_Handler *nh = 0; - - if (alloc) - { - ACE_NEW_MALLOC_RETURN (nh, - ACE_static_cast ( - TAO_Notify_Handler *, - alloc->malloc (sizeof (TAO_Notify_Handler))), - TAO_Notify_Handler (t, - h, - alloc), - 0); - - return nh; - } - - return 0; -} - - -/*static*/ void -TAO_Notify_Handler::destroy_handler (TAO_Notify_Handler *nh) -{ - if (nh->allocator_) - { - ACE_DES_FREE (nh, - nh->allocator_->free, - TAO_Notify_Handler); - } - - return; -} - - -int -TAO_Notify_Handler::handle_input (ACE_HANDLE) -{ - // NOTE: We will do what the Connection_Handler will do with some - // exceptions though.. Quite a few things done are not required - // by the Notify_Handler at all. - - // Let the transport know that it is used - (void) this->t_->update_transport (); - - TAO_Resume_Handle resume_handle (this->t_->orb_core (), - this->h_); - - // Does return value matter? Not is my opinion. - (void) this->t_->handle_input_i (resume_handle); - - // Yes, we are wantedly returning this so that handle_close () would - // be called - return -1; -} - - -int -TAO_Notify_Handler::handle_close (ACE_HANDLE /*fd*/, - ACE_Reactor_Mask /*close_mask*/) -{ - TAO_Notify_Handler::destroy_handler (this); - return 0; -} diff --git a/TAO/tao/Notify_Handler.h b/TAO/tao/Notify_Handler.h deleted file mode 100644 index ebf9b9cc4de..00000000000 --- a/TAO/tao/Notify_Handler.h +++ /dev/null @@ -1,99 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Notify_Handler.h - * - * $Id$ - * - * @author Balchanadran Natarajan <bala@cs.wustl.edu> - */ -//============================================================================= - -#ifndef TAO_NOTIFY_HANDLER_H -#define TAO_NOTIFY_HANDLER_H -#include "ace/pre.h" - -#include "TAO_Export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Event_Handler.h" -#include "ace/Global_Macros.h" - -class TAO_Transport; -class ACE_Allocator; -class TAO_Connection_Handler; - -/** - * @class TAO_Notify_Handler - * - * @brief Represents the handler used by the notify calls to the - * reactor within the ORB. - * - * Cluttering the *IOP handlers with the job of handling notify calls - * introduces problems as mentioned in [BUG 1230]. This special - * handler can help to avoid that problem by splitting the - * responsibilities between actual connection handling and notify - * handling that is done underneath the ORB. - */ -class TAO_Export TAO_Notify_Handler: public ACE_Event_Handler -{ -public: - - /// Dtor - ~TAO_Notify_Handler (void); - - /// NOTE: Needs to be deprecated. Just here for backward - /// compatibility - static TAO_Notify_Handler *create_handler (TAO_Connection_Handler *ch, - ACE_Allocator *alloc); - - /// Static method to create an instance of this object in the - /// memory pool - static TAO_Notify_Handler *create_handler (TAO_Transport *t, - ACE_HANDLE h, - ACE_Allocator *alloc); - - /// Static method to destroy an instance of this object - static void destroy_handler (TAO_Notify_Handler *nh); - - /// The standard handle_input method, it just redirects to the - /// connection handler - virtual int handle_input (ACE_HANDLE fd); - virtual int handle_close (ACE_HANDLE fd, - ACE_Reactor_Mask close_mask); - -protected: - - /// NOTE: Needs to be deprecated. - TAO_Notify_Handler (TAO_Connection_Handler *ch, - ACE_Allocator *alloc); - - /// Ctor - TAO_Notify_Handler (TAO_Transport *t, - ACE_HANDLE h, - ACE_Allocator *alloc); - -private: - - /// Preventing default ctor's. - ACE_UNIMPLEMENTED_FUNC (TAO_Notify_Handler (void)) - -private: - /// Our copy of the TAO_TRansport, reference count incremented - /// and stored. - TAO_Transport *t_; - - /// The handle that we should be concerened with - ACE_HANDLE h_; - - /// Our allocator - ACE_Allocator *allocator_; -}; - - -#include "ace/post.h" -#endif /*TAO_NOTIFY_HANDLER_H*/ diff --git a/TAO/tao/PortableServer/AMH_Response_Handler.cpp b/TAO/tao/PortableServer/AMH_Response_Handler.cpp index fbf1707511c..143241ec685 100644 --- a/TAO/tao/PortableServer/AMH_Response_Handler.cpp +++ b/TAO/tao/PortableServer/AMH_Response_Handler.cpp @@ -16,12 +16,13 @@ TAO_AMH_Response_Handler (TAO_ServerRequest &server_request) : mesg_base_ (server_request.mesg_base_) , request_id_ (server_request.request_id_) , response_expected_ (server_request.response_expected_) - , transport_ (TAO_Transport::_duplicate (server_request.transport ())) + , transport_ (server_request.transport ()) , orb_core_ (server_request.orb_core ()) , argument_flag_ (1) , exception_type_ (TAO_GIOP_NO_EXCEPTION) , reply_status_ (TAO_RS_UNINITIALIZED) { + this->transport_->add_reference (); } TAO_AMH_Response_Handler::~TAO_AMH_Response_Handler (void) @@ -34,10 +35,10 @@ TAO_AMH_Response_Handler::~TAO_AMH_Response_Handler (void) if (this->response_expected_ == 0) //oneway ? { // if client is not expecting anything, don't send anything - TAO_Transport::release (this->transport_); + this->transport_->remove_reference (); return; } - + // If the ResponseHandler is being destroyed before a reply has // been sent to the client, we send a system exception // CORBA::NO_RESPONSE, with minor code to indicate the problem. @@ -55,17 +56,17 @@ TAO_AMH_Response_Handler::~TAO_AMH_Response_Handler (void) this->_tao_rh_send_exception (ex ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - TAO_Transport::release (this->transport_); + this->transport_->remove_reference (); } ACE_CATCHALL { - TAO_Transport::release (this->transport_); + this->transport_->remove_reference (); } ACE_ENDTRY; } else { - TAO_Transport::release (this->transport_); + this->transport_->remove_reference (); } } } @@ -140,7 +141,7 @@ TAO_AMH_Response_Handler::_tao_rh_send_reply (ACE_ENV_SINGLE_ARG_DECL) } // Send the message. - int result = this->transport_->send_message (this->_tao_out, + int result = this->transport_->send_message (this->_tao_out, 0, TAO_Transport::TAO_REPLY); @@ -180,7 +181,7 @@ TAO_AMH_Response_Handler::_tao_rh_send_exception (CORBA::Exception &ex } this->reply_status_ = TAO_RS_SENDING; } - + TAO_Pluggable_Reply_Params_Base reply_params; reply_params.request_id_ = this->request_id_; reply_params.svc_ctx_.length (0); @@ -192,14 +193,14 @@ TAO_AMH_Response_Handler::_tao_rh_send_exception (CORBA::Exception &ex // ExceptionHolder information. if (CORBA::SystemException::_downcast (&ex)) reply_params.reply_status_ = TAO_GIOP_SYSTEM_EXCEPTION; - + if (this->mesg_base_->generate_exception_reply (this->_tao_out, reply_params, ex) == -1) { ACE_THROW (CORBA::INTERNAL ()); } - + // Send the Exception if (this->transport_->send_message (this->_tao_out, 0, @@ -209,7 +210,7 @@ TAO_AMH_Response_Handler::_tao_rh_send_exception (CORBA::Exception &ex ACE_TEXT ("TAO: (%P|%t|%N|%l): ") ACE_TEXT ("TAO_AMH_Response_Handler: could not send exception reply\n"))); } - + { ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->mutex_); this->reply_status_ = TAO_RS_SENT; diff --git a/TAO/tao/Strategies/DIOP_Acceptor.cpp b/TAO/tao/Strategies/DIOP_Acceptor.cpp index 741c9e3834a..eff267c20f1 100644 --- a/TAO/tao/Strategies/DIOP_Acceptor.cpp +++ b/TAO/tao/Strategies/DIOP_Acceptor.cpp @@ -18,8 +18,8 @@ #include "DIOP_Acceptor.i" #endif /* __ACE_INLINE__ */ -ACE_RCSID (tao, - DIOP_Acceptor, +ACE_RCSID (tao, + DIOP_Acceptor, "$Id$") TAO_DIOP_Acceptor::TAO_DIOP_Acceptor (CORBA::Boolean flag) @@ -228,13 +228,12 @@ TAO_DIOP_Acceptor::close (void) if (this->connection_handler_->get_handle () != ACE_INVALID_HANDLE) { this->connection_handler_->reactor ()->remove_handler (this->connection_handler_, - ACE_Event_Handler::READ_MASK); - } - else - { - this->connection_handler_->handle_close (ACE_INVALID_HANDLE, - ACE_Event_Handler::ALL_EVENTS_MASK); + ACE_Event_Handler::READ_MASK | + ACE_Event_Handler::DONT_CALL); } + + this->connection_handler_->remove_reference (); + this->connection_handler_ = 0; } return 0; diff --git a/TAO/tao/Strategies/DIOP_Connection_Handler.cpp b/TAO/tao/Strategies/DIOP_Connection_Handler.cpp index 21be6692f27..0fb564fd24e 100644 --- a/TAO/tao/Strategies/DIOP_Connection_Handler.cpp +++ b/TAO/tao/Strategies/DIOP_Connection_Handler.cpp @@ -34,7 +34,7 @@ TAO_DIOP_Connection_Handler::TAO_DIOP_Connection_Handler (ACE_Thread_Manager *t) // Creation_Strategy requires a constructor with that signature, we // don't use that implementation, but some (most?) compilers // instantiate it anyway. - ACE_ASSERT (this->orb_core () != 0); + ACE_ASSERT (0); } @@ -52,12 +52,12 @@ TAO_DIOP_Connection_Handler::TAO_DIOP_Connection_Handler (TAO_ORB_Core *orb_core // store this pointer (indirectly increment ref count) this->transport (specific_transport); - TAO_Transport::release (specific_transport); } TAO_DIOP_Connection_Handler::~TAO_DIOP_Connection_Handler (void) { + delete this->transport (); this->udp_socket_.close (); } @@ -166,67 +166,64 @@ TAO_DIOP_Connection_Handler::close_connection (void) int TAO_DIOP_Connection_Handler::handle_input (ACE_HANDLE h) { - return this->handle_input_eh (h, this); + int result = + this->handle_input_eh (h, this); + + if (result == -1) + { + this->close_connection (); + return 0; + } + + return result; } int TAO_DIOP_Connection_Handler::handle_output (ACE_HANDLE handle) { - return this->handle_output_eh (handle, this); + int result = + this->handle_output_eh (handle, this); + + if (result == -1) + { + this->close_connection (); + return 0; + } + + return result; } int -TAO_DIOP_Connection_Handler::handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask rm) +TAO_DIOP_Connection_Handler::handle_timeout (const ACE_Time_Value &, + const void *) { - return this->handle_close_eh (handle, rm, this); + // We don't use this upcall from the Reactor. However, we should + // override this since the base class returns -1 which will result + // in handle_close() getting called. + return 0; } int -TAO_DIOP_Connection_Handler::release_os_resources (void) +TAO_DIOP_Connection_Handler::handle_close (ACE_HANDLE, + ACE_Reactor_Mask) { - return this->peer().close (); + ACE_ASSERT (0); + return 0; } -// @@ Frank: Hopefully this isn't needed -/* int -TAO_DIOP_Connection_Handler::process_listen_point_list ( - DIOP::ListenPointList &listen_list) +TAO_DIOP_Connection_Handler::close (u_long) { - // Get the size of the list - CORBA::ULong len = listen_list.length (); - - for (CORBA::ULong i = 0; i < len; ++ i) - { - DIOP::ListenPoint listen_point = listen_list[i]; - ACE_INET_Addr addr (listen_point.port, - listen_point.host.in ()); - - - // Construct an DIOP_Endpoint object - TAO_DIOP_Endpoint endpoint (addr, - 0); - - // Construct a property object - TAO_Base_Transport_Property prop (&endpoint); - - // Mark the connection as bidirectional - prop.set_bidir_flag (1); - - // The property for this handler has changed. Recache the - // handler with this property - int retval = this->transport ()->recache_transport (&prop); - if (retval == -1) - return retval; - - // Make the handler idle and ready for use - this->transport ()->make_idle (); - } - + this->state_changed (TAO_LF_Event::LFS_CONNECTION_CLOSED); + this->transport ()->remove_reference (); return 0; } -*/ + +int +TAO_DIOP_Connection_Handler::release_os_resources (void) +{ + return this->peer().close (); +} // **************************************************************** diff --git a/TAO/tao/Strategies/DIOP_Connection_Handler.h b/TAO/tao/Strategies/DIOP_Connection_Handler.h index 4fbf5155a7a..e234b8e74b7 100644 --- a/TAO/tao/Strategies/DIOP_Connection_Handler.h +++ b/TAO/tao/Strategies/DIOP_Connection_Handler.h @@ -102,6 +102,10 @@ public: virtual int open_handler (void *); //@} + /// Close called by the Acceptor or Connector when connection + /// establishment fails. + int close (u_long = 0); + //@{ /** @name Event Handler overloads */ @@ -110,6 +114,8 @@ public: virtual int handle_input (ACE_HANDLE); virtual int handle_output (ACE_HANDLE); virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask); + virtual int handle_timeout (const ACE_Time_Value ¤t_time, + const void *act = 0); //@} /// Add ourselves to Cache. diff --git a/TAO/tao/Strategies/DIOP_Connector.cpp b/TAO/tao/Strategies/DIOP_Connector.cpp index cdfa8da9826..6eebb705664 100644 --- a/TAO/tao/Strategies/DIOP_Connector.cpp +++ b/TAO/tao/Strategies/DIOP_Connector.cpp @@ -24,30 +24,16 @@ ACE_RCSID (DIOP, #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Svc_Tuple<TAO_DIOP_Connection_Handler>; -template class ACE_Map_Manager<int, ACE_Svc_Tuple<TAO_DIOP_Connection_Handler> *, TAO_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator_Base<int, ACE_Svc_Tuple<TAO_DIOP_Connection_Handler> *, TAO_SYNCH_RW_MUTEX>; -template class ACE_Map_Entry<int,ACE_Svc_Tuple<TAO_DIOP_Connection_Handler>*>; - +template class ACE_NonBlocking_Connect_Handler<TAO_DIOP_Connection_Handler>; template class ACE_Map_Entry<ACE_INET_Addr, TAO_DIOP_Connection_Handler *>; - -template class ACE_Map_Iterator<int,ACE_Svc_Tuple<TAO_DIOP_Connection_Handler>*,TAO_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<int,ACE_Svc_Tuple<TAO_DIOP_Connection_Handler>*,TAO_SYNCH_RW_MUTEX>; template class ACE_Hash_Map_Iterator_Base_Ex < ACE_INET_Addr, TAO_DIOP_Connection_Handler *, ACE_Hash < ACE_INET_Addr >, ACE_Equal_To < ACE_INET_Addr >, ACE_Null_Mutex >; template class ACE_Hash_Map_Iterator_Ex<ACE_INET_Addr, TAO_DIOP_Connection_Handler *, ACE_Hash<ACE_INET_Addr>, ACE_Equal_To<ACE_INET_Addr>, ACE_Null_Mutex>; template class ACE_Hash_Map_Reverse_Iterator_Ex<ACE_INET_Addr, TAO_DIOP_Connection_Handler *, ACE_Hash<ACE_INET_Addr>, ACE_Equal_To<ACE_INET_Addr>, ACE_Null_Mutex>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Svc_Tuple<TAO_DIOP_Connection_Handler> -#pragma instantiate ACE_Map_Manager<int, ACE_Svc_Tuple<TAO_DIOP_Connection_Handler> *, TAO_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator_Base<int, ACE_Svc_Tuple<TAO_DIOP_Connection_Handler> *, TAO_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Entry<int,ACE_Svc_Tuple<TAO_DIOP_Connection_Handler>*> +#pragma instantiate ACE_NonBlocking_Connect_Handler<TAO_DIOP_Connection_Handler> #pragma instantiate ACE_Map_Entry<ACE_INET_Addr, TAO_DIOP_Connection_Handler *> - -#pragma instantiate ACE_Map_Iterator<int,ACE_Svc_Tuple<TAO_DIOP_Connection_Handler>*,TAO_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<int,ACE_Svc_Tuple<TAO_DIOP_Connection_Handler>*,TAO_SYNCH_RW_MUTEX> - #pragma instantiate ACE_Hash_Map_Iterator_Base_Ex < ACE_INET_Addr,TAO_DIOP_Connection_Handler *, ACE_Hash < ACE_INET_Addr >, ACE_Equal_To < ACE_INET_Addr >, ACE_Null_Mutex > #pragma instantiate ACE_Hash_Map_Iterator_Ex<ACE_INET_Addr, TAO_DIOP_Connection_Handler *, ACE_Hash<ACE_INET_Addr>, ACE_Equal_To<ACE_INET_Addr>, ACE_Null_Mutex> #pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ACE_INET_Addr, TAO_DIOP_Connection_Handler *, ACE_Hash<ACE_INET_Addr>, ACE_Equal_To<ACE_INET_Addr>, ACE_Null_Mutex> @@ -86,7 +72,7 @@ TAO_DIOP_Connector::close (void) while (!iter.done ()) { - (*iter).int_id_->decr_refcount(); + (*iter).int_id_->remove_reference (); iter++; } @@ -170,8 +156,8 @@ TAO_DIOP_Connector::make_connection (TAO_GIOP_Invocation *invocation, } // @@ Michael: We do not use regular connection management. - - transport = TAO_Transport::_duplicate (svc_handler->transport ()); + svc_handler->add_reference (); + transport = svc_handler->transport (); return 0; } diff --git a/TAO/tao/Strategies/DIOP_Transport.cpp b/TAO/tao/Strategies/DIOP_Transport.cpp index ea03fd05281..d4edd4c8c80 100644 --- a/TAO/tao/Strategies/DIOP_Transport.cpp +++ b/TAO/tao/Strategies/DIOP_Transport.cpp @@ -36,13 +36,6 @@ TAO_DIOP_Transport::TAO_DIOP_Transport (TAO_DIOP_Connection_Handler *handler, , connection_handler_ (handler) , messaging_object_ (0) { - if (connection_handler_ != 0) - { - // REFCNT: Matches one of - // TAO_Transport::connection_handler_close() or - // TAO_Transport::close_connection_shared. - this->connection_handler_->incr_refcount(); - } // @@ Michael: Set the input CDR size to ACE_MAX_DGRAM_SIZE so that // we read the whole UDP packet on a single read. if (flag) @@ -63,7 +56,6 @@ TAO_DIOP_Transport::TAO_DIOP_Transport (TAO_DIOP_Connection_Handler *handler, TAO_DIOP_Transport::~TAO_DIOP_Transport (void) { - ACE_ASSERT(this->connection_handler_ == 0); delete this->messaging_object_; } @@ -86,9 +78,9 @@ TAO_DIOP_Transport::messaging_object (void) } ssize_t -TAO_DIOP_Transport::send_i (iovec *iov, int iovcnt, - size_t &bytes_transferred, - const ACE_Time_Value *) +TAO_DIOP_Transport::send (iovec *iov, int iovcnt, + size_t &bytes_transferred, + const ACE_Time_Value *) { const ACE_INET_Addr &addr = this->connection_handler_->addr (); @@ -109,9 +101,9 @@ TAO_DIOP_Transport::send_i (iovec *iov, int iovcnt, } ssize_t -TAO_DIOP_Transport::recv_i (char *buf, - size_t len, - const ACE_Time_Value * /* max_wait_time */) +TAO_DIOP_Transport::recv (char *buf, + size_t len, + const ACE_Time_Value * /* max_wait_time */) { ACE_INET_Addr from_addr; @@ -136,7 +128,7 @@ TAO_DIOP_Transport::recv_i (char *buf, ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - %p \n"), ACE_TEXT ("TAO - read message failure ") - ACE_TEXT ("recv_i () \n"))); + ACE_TEXT ("recv () \n"))); } // Error handling @@ -161,9 +153,9 @@ TAO_DIOP_Transport::recv_i (char *buf, } int -TAO_DIOP_Transport::handle_input_i (TAO_Resume_Handle &rh, - ACE_Time_Value *max_wait_time, - int /*block*/) +TAO_DIOP_Transport::handle_input (TAO_Resume_Handle &rh, + ACE_Time_Value *max_wait_time, + int /*block*/) { // If there are no messages then we can go ahead to read from the // handle for further reading.. @@ -236,7 +228,7 @@ TAO_DIOP_Transport::handle_input_i (TAO_Resume_Handle &rh, int -TAO_DIOP_Transport::register_handler_i (void) +TAO_DIOP_Transport::register_handler (void) { // @@ Michael: // @@ -318,173 +310,4 @@ TAO_DIOP_Transport::messaging_init (CORBA::Octet major, return 1; } -// @@ Frank: Hopefully DIOP doesn't need this -/* -int -TAO_DIOP_Transport::tear_listen_point_list (TAO_InputCDR &cdr) -{ - CORBA::Boolean byte_order; - if ((cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0) - return -1; - - cdr.reset_byte_order (ACE_static_cast(int,byte_order)); - - DIOP::ListenPointList listen_list; - if ((cdr >> listen_list) == 0) - return -1; - - // As we have received a bidirectional information, set the flag to - // 1 - this->bidirectional_flag (1); - return this->connection_handler_->process_listen_point_list (listen_list); -} -*/ - - - -// @@ Frank: Hopefully DIOP doesn't need this -/* -void -TAO_DIOP_Transport::set_bidir_context_info (TAO_Operation_Details &opdetails) -{ - - // Get a handle on to the acceptor registry - TAO_Acceptor_Registry * ar = - this->orb_core ()->acceptor_registry (); - - - // Get the first acceptor in the registry - TAO_AcceptorSetIterator acceptor = ar->begin (); - - DIOP::ListenPointList listen_point_list; - - for (; - acceptor != ar->end (); - acceptor++) - { - // Check whether it is a DIOP acceptor - if ((*acceptor)->tag () == TAO_TAG_UDP_PROFILE) - { - this->get_listen_point (listen_point_list, - *acceptor); - } - } - - // We have the ListenPointList at this point. Create a output CDR - // stream at this point - TAO_OutputCDR cdr; - - // Marshall the information into the stream - if ((cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)== 0) - || (cdr << listen_point_list) == 0) - return; - - // Add this info in to the svc_list - opdetails.service_context ().set_context (IOP::BI_DIR_DIOP, - cdr); - - return; -} - - -int -TAO_DIOP_Transport::get_listen_point ( - DIOP::ListenPointList &listen_point_list, - TAO_Acceptor *acceptor) -{ - TAO_DIOP_Acceptor *iiop_acceptor = - ACE_dynamic_cast (TAO_DIOP_Acceptor *, - acceptor ); - - // Get the array of endpoints serviced by <iiop_acceptor> - const ACE_INET_Addr *endpoint_addr = - iiop_acceptor->endpoints (); - - // Get the count - size_t count = - iiop_acceptor->endpoint_count (); - - // Get the local address of the connection - ACE_INET_Addr local_addr; - - if (this->connection_handler_->peer ().get_local_addr (local_addr) - == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("(%P|%t) Could not resolve local host") - ACE_TEXT (" address in set_bidir_context_info () \n")), - -1); - } - - - // Note: Looks like there is no point in sending the list of - // endpoints on interfaces on which this connection has not - // been established. If this is wrong, please correct me. - char *local_interface = 0; - - // Get the hostname for the local address - if (iiop_acceptor->hostname (this->orb_core_, - local_addr, - local_interface) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("(%P|%t) Could not resolve local host") - ACE_TEXT (" name \n")), - -1); - } - - ACE_INET_Addr *tmp_addr = ACE_const_cast (ACE_INET_Addr *, - endpoint_addr); - - for (size_t index = 0; - index <= count; - index++) - { - // Get the listen point on that acceptor if it has the same - // interface on which this connection is established - char *acceptor_interface = 0; - - if (iiop_acceptor->hostname (this->orb_core_, - tmp_addr[index], - acceptor_interface) == -1) - continue; - - // @@ This is very bad for performance, but it is a one time - // affair - if (ACE_OS::strcmp (local_interface, - acceptor_interface) == 0) - { - // We have the connection and the acceptor endpoint on the - // same interface - DIOP::ListenPoint point; - point.host = CORBA::string_dup (local_interface); - point.port = endpoint_addr[index].get_port_number (); - - // Get the count of the number of elements - CORBA::ULong len = listen_point_list.length (); - - // Increase the length by 1 - listen_point_list.length (len + 1); - - // Add the new length to the list - listen_point_list[len] = point; - } - - // @@ This is bad.... - CORBA::string_free (acceptor_interface); - } - - CORBA::string_free (local_interface); - return 1; -} -*/ - -TAO_Connection_Handler * -TAO_DIOP_Transport::invalidate_event_handler_i (void) -{ - TAO_Connection_Handler * eh = this->connection_handler_; - this->connection_handler_ = 0; - return eh; -} - #endif /* TAO_HAS_DIOP && TAO_HAS_DIOP != 0 */ diff --git a/TAO/tao/Strategies/DIOP_Transport.h b/TAO/tao/Strategies/DIOP_Transport.h index c47c60d1a93..1ffe7064ff2 100644 --- a/TAO/tao/Strategies/DIOP_Transport.h +++ b/TAO/tao/Strategies/DIOP_Transport.h @@ -63,9 +63,9 @@ public: ~TAO_DIOP_Transport (void); /// Look for the documentation in Transport.h. - virtual int handle_input_i (TAO_Resume_Handle &rh, - ACE_Time_Value *max_wait_time = 0, - int block = 0); + virtual int handle_input (TAO_Resume_Handle &rh, + ACE_Time_Value *max_wait_time = 0, + int block = 0); protected: /** @name Overridden Template Methods * @@ -75,21 +75,20 @@ protected: virtual ACE_Event_Handler * event_handler_i (void); virtual TAO_Connection_Handler *connection_handler_i (void); - virtual TAO_Connection_Handler * invalidate_event_handler_i (void); virtual TAO_Pluggable_Messaging *messaging_object (void); /// Write the complete Message_Block chain to the connection. - virtual ssize_t send_i (iovec *iov, int iovcnt, - size_t &bytes_transferred, - const ACE_Time_Value *max_wait_time); + virtual ssize_t send (iovec *iov, int iovcnt, + size_t &bytes_transferred, + const ACE_Time_Value *max_wait_time); /// Read len bytes from into buf. - virtual ssize_t recv_i (char *buf, - size_t len, - const ACE_Time_Value *s = 0); + virtual ssize_t recv (char *buf, + size_t len, + const ACE_Time_Value *s = 0); - virtual int register_handler_i (void); + virtual int register_handler (void); ///@} public: diff --git a/TAO/tao/Strategies/SCIOP_Connection_Handler.cpp b/TAO/tao/Strategies/SCIOP_Connection_Handler.cpp index 187dae6aaa6..dcd9b6e9967 100644 --- a/TAO/tao/Strategies/SCIOP_Connection_Handler.cpp +++ b/TAO/tao/Strategies/SCIOP_Connection_Handler.cpp @@ -39,7 +39,7 @@ TAO_SCIOP_Connection_Handler::TAO_SCIOP_Connection_Handler (ACE_Thread_Manager * // Creation_Strategy requires a constructor with that signature, we // don't use that implementation, but some (most?) compilers // instantiate it anyway. - ACE_ASSERT (this->orb_core () != 0); + ACE_ASSERT (0); } @@ -57,7 +57,6 @@ TAO_SCIOP_Connection_Handler::TAO_SCIOP_Connection_Handler (TAO_ORB_Core *orb_co // store this pointer (indirectly increment ref count) this->transport (specific_transport); - TAO_Transport::release (specific_transport); } TAO_SCIOP_Connection_Handler::TAO_SCIOP_Connection_Handler (TAO_ORB_Core *orb_core, @@ -73,6 +72,7 @@ TAO_SCIOP_Connection_Handler::TAO_SCIOP_Connection_Handler (TAO_ORB_Core *orb_co TAO_SCIOP_Connection_Handler::~TAO_SCIOP_Connection_Handler (void) { + delete this->transport (); } int @@ -174,20 +174,57 @@ TAO_SCIOP_Connection_Handler::close_connection (void) int TAO_SCIOP_Connection_Handler::handle_input (ACE_HANDLE h) { - return this->handle_input_eh (h, this); + int result = + this->handle_input_eh (h, this); + + if (result == -1) + { + this->close_connection (); + return 0; + } + + return result; } int TAO_SCIOP_Connection_Handler::handle_output (ACE_HANDLE handle) { - return this->handle_output_eh (handle, this); + int result = + this->handle_output_eh (handle, this); + + if (result == -1) + { + this->close_connection (); + return 0; + } + + return result; +} + +int +TAO_SCIOP_Connection_Handler::handle_timeout (const ACE_Time_Value &, + const void *) +{ + // We don't use this upcall for I/O. This is only used by the + // Connector to indicate that the connection timedout. Therefore, + // we should call close(). + return this->close (); } int -TAO_SCIOP_Connection_Handler::handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask rm) +TAO_SCIOP_Connection_Handler::handle_close (ACE_HANDLE, + ACE_Reactor_Mask) { - return this->handle_close_eh (handle, rm, this); + ACE_ASSERT (0); + return 0; +} + +int +TAO_SCIOP_Connection_Handler::close (u_long) +{ + this->state_changed (TAO_LF_Event::LFS_CONNECTION_CLOSED); + this->transport ()->remove_reference (); + return 0; } int diff --git a/TAO/tao/Strategies/SCIOP_Connection_Handler.h b/TAO/tao/Strategies/SCIOP_Connection_Handler.h index 2d7b694793e..b3492dc1504 100644 --- a/TAO/tao/Strategies/SCIOP_Connection_Handler.h +++ b/TAO/tao/Strategies/SCIOP_Connection_Handler.h @@ -96,8 +96,9 @@ public: */ -class TAO_Strategies_Export TAO_SCIOP_Connection_Handler : public TAO_SCIOP_SVC_HANDLER, - public TAO_Connection_Handler +class TAO_Strategies_Export TAO_SCIOP_Connection_Handler + : public TAO_SCIOP_SVC_HANDLER, + public TAO_Connection_Handler { public: @@ -121,6 +122,10 @@ public: virtual int open_handler (void *); //@} + /// Close called by the Acceptor or Connector when connection + /// establishment fails. + int close (u_long = 0); + //@{ /** @name Event Handler overloads */ @@ -129,6 +134,8 @@ public: virtual int handle_input (ACE_HANDLE); virtual int handle_output (ACE_HANDLE); virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask); + virtual int handle_timeout (const ACE_Time_Value ¤t_time, + const void *act = 0); //@} /// Add ourselves to Cache. diff --git a/TAO/tao/Strategies/SCIOP_Connector.cpp b/TAO/tao/Strategies/SCIOP_Connector.cpp index 2be650999a0..24aaccf8eed 100644 --- a/TAO/tao/Strategies/SCIOP_Connector.cpp +++ b/TAO/tao/Strategies/SCIOP_Connector.cpp @@ -157,124 +157,205 @@ TAO_SCIOP_Connector::make_connection (TAO_GIOP_Invocation *invocation, TAO_SCIOP_Endpoint *sciop_endpoint = this->remote_endpoint (desc->endpoint ()); - if (sciop_endpoint == 0) - return -1; - - const ACE_INET_Addr &remote_address = - sciop_endpoint->object_addr (); + if (sciop_endpoint == 0) + return -1; - if (TAO_debug_level > 2) - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - SCIOP_Connector::make_connection, " - "to <%s:%d>\n", - sciop_endpoint->host(), sciop_endpoint->port())); + const ACE_INET_Addr &remote_address = + sciop_endpoint->object_addr (); - // Get the right synch options - ACE_Synch_Options synch_options; + if (TAO_debug_level > 2) + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - SCIOP_Connector::make_connection, " + "to <%s:%d>\n", + sciop_endpoint->host(), sciop_endpoint->port())); - this->active_connect_strategy_->synch_options (max_wait_time, - synch_options); + // Get the right synch options + ACE_Synch_Options synch_options; - TAO_SCIOP_Connection_Handler *svc_handler = 0; + this->active_connect_strategy_->synch_options (max_wait_time, + synch_options); - // Active connect - int result = this->base_connector_.connect (svc_handler, - remote_address, - synch_options); + TAO_SCIOP_Connection_Handler *svc_handler = 0; - if (result == -1 && errno == EWOULDBLOCK) - { - if (TAO_debug_level > 2) - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - SCIOP_Connector::make_connection, " - "going to wait for connection completion on local" - "handle [%d]\n", - svc_handler->get_handle ())); - - result = - this->active_connect_strategy_->wait (svc_handler, - max_wait_time); - - if (TAO_debug_level > 2) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - SCIOP_Connector::make_connection" - "wait done for handle[%d], result = %d\n", - svc_handler->get_handle (), result)); - } + // Connect. + int result = this->base_connector_.connect (svc_handler, + remote_address, + synch_options); - } - - int status = - svc_handler->is_finalized (); - - // Reduce the refcount to the svc_handler that we have. The - // increment to the handler is done in make_svc_handler (). Now - // that we dont need the reference to it anymore we can decrement - // the refcount whether the connection is successful ot not. - // REFCNT: Matches with TAO_Connect_Strategy<>::make_svc_handler() - long refcount = svc_handler->decr_refcount (); - - ACE_ASSERT (refcount >= 0); - - ACE_UNUSED_ARG (refcount); + // This call creates the service handler and bumps the #REFCOUNT# up + // one extra. There are three possibilities: (a) connection + // succeeds immediately - in this case, the #REFCOUNT# on the + // handler is two; (b) connection completion is pending - in this + // case, the #REFCOUNT# on the handler is also two; (c) connection + // fails immediately - in this case, the #REFCOUNT# on the handler + // is one since close() gets called on the handler. + // + // The extra reference count in + // TAO_Connect_Creation_Strategy::make_svc_handler() is needed in + // the case when connection completion is pending and we are going + // to wait on a variable in the handler to changes, signifying + // success or failure. Note, that this increment cannot be done + // once the connect() returns since this might be too late if + // another thread pick up the completion and potentially deletes the + // handler before we get a chance to increment the reference count. + + // No immediate result. Wait for completion. + if (result == -1 && errno == EWOULDBLOCK) + { + if (TAO_debug_level > 2) + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - SCIOP_Connector::make_connection, " + "going to wait for connection completion on local" + "handle [%d]\n", + svc_handler->get_handle ())); + + // Wait for connection completion. No need to specify timeout + // to wait() since the correct timeout was passed to the + // Connector. The Connector will close the handler in the case + // of timeouts, so the event will complete (either success or + // failure) within timeout. + result = + this->active_connect_strategy_->wait (svc_handler, + 0); + + if (TAO_debug_level > 2) + { + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - SCIOP_Connector::make_connection" + "wait done for handle[%d], result = %d\n", + svc_handler->get_handle (), result)); + } + + // There are three possibilities when wait() returns: (a) + // connection succeeded; (b) connection failed; (c) wait() + // failed because of some other error. It is easy to deal with + // (a) and (b). (c) is tricky since the connection is still + // pending and may get completed by some other thread. The + // following code deals with (c). + + // Check if the handler has been closed. + int closed = + svc_handler->is_closed (); + + // In case of failures and close() has not be called. + if (result == -1 && + !closed) + { + // First, cancel from connector. + this->base_connector_.cancel (svc_handler); + + // Double check to make sure the handler has not been closed + // yet. This double check is required to ensure that the + // connection handler was not closed yet by some other + // thread since it was still registered with the connector. + // Once connector.cancel() has been processed, we are + // assured that the connector will no longer open/close this + // handler. + closed = + svc_handler->is_closed (); + + // If closed, there is nothing to do here. If not closed, + // it was either opened or is still pending. + if (!closed) + { + // Check if the handler has been opened. + int open = + svc_handler->is_open (); + + // Some other thread was able to open the handler even + // though wait failed for this thread. + if (open) + // Overwrite <result>. + result = 0; + else + { + // Assert that it is still connecting. + ACE_ASSERT (svc_handler->is_connecting ()); + + // Force close the handler now. + svc_handler->close (); + } + } + } + } - if (result == -1) - { - // Give users a clue to the problem. - if (TAO_debug_level) - { - ACE_DEBUG ((LM_ERROR, - "TAO (%P|%t) - SCIOP_Connector::make_connection, " - "connection to <%s:%d> failed (%p)\n", - sciop_endpoint->host (), sciop_endpoint->port (), - "errno")); - } + // Irrespective of success or failure, remove the extra #REFCOUNT#. + svc_handler->remove_reference (); - (void) this->active_connect_strategy_->post_failed_connect (svc_handler, - status); + // In case of errors. + if (result == -1) + { + // Give users a clue to the problem. + if (TAO_debug_level) + { + ACE_DEBUG ((LM_ERROR, + "TAO (%P|%t) - SCIOP_Connector::make_connection, " + "connection to <%s:%d> failed (%p)\n", + sciop_endpoint->host (), sciop_endpoint->port (), + "errno")); + } + + return -1; + } - return -1; - } + // At this point, the connection has be successfully connected. + // #REFCOUNT# is one. + if (TAO_debug_level > 2) + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - SCIOP_Connector::make_connection, " + "new connection to <%s:%d> on Transport[%d]\n", + sciop_endpoint->host (), sciop_endpoint->port (), + svc_handler->peer ().get_handle ())); + + TAO_Transport *transport = + svc_handler->transport (); + + // Add the handler to Cache + int retval = + this->orb_core ()->lane_resources ().transport_cache ().cache_transport (desc, + base_transport); + + // Failure in adding to cache. + if (retval != 0) + { + // Close the handler. + svc_handler->close (); - if (TAO_debug_level > 2) - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - SCIOP_Connector::make_connection, " - "new connection to <%s:%d> on Transport[%d]\n", - sciop_endpoint->host (), sciop_endpoint->port (), - svc_handler->peer ().get_handle ())); + if (TAO_debug_level > 0) + { + ACE_ERROR ((LM_ERROR, + "TAO (%P|%t) - SCIOP_Connector::make_connection, " + "could not add the new connection to cache\n")); + } - TAO_Transport *base_transport = - TAO_Transport::_duplicate (svc_handler->transport ()); + return -1; + } - // Add the handler to Cache - int retval = - this->orb_core ()->lane_resources ().transport_cache ().cache_transport (desc, - base_transport); + // Registration failures. + if (retval != 0) + { + // Purge from the connection cache. + transport->purge_entry (); - if (retval != 0 && TAO_debug_level > 0) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - SCIOP_Connector::make_connection, " - "could not add the new connection to cache\n")); - } + // Close the handler. + svc_handler->close (); - // If the wait strategy wants us to be registered with the reactor - // then we do so. - retval = base_transport->wait_strategy ()->register_handler (); + if (TAO_debug_level > 0) + { + ACE_ERROR ((LM_ERROR, + "TAO (%P|%t) - SCIOP_Connector::make_connection, " + "could not register the new connection in the reactor\n")); + } - if (retval != 0 && TAO_debug_level > 0) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - SCIOP_Connector::make_connection, " - "could not register the new connection in the reactor\n")); - } + return -1; + } - // Handover the transport pointer to the Invocation class. - TAO_Transport *&transport = invocation->transport (); - transport = base_transport; + // Handover the transport pointer to the Invocation class. + TAO_Transport *&invocation_transport = + invocation->transport (); + invocation_transport = transport; - return 0; + return 0; } diff --git a/TAO/tao/Strategies/SCIOP_Transport.cpp b/TAO/tao/Strategies/SCIOP_Transport.cpp index 75cde3d8814..14eec2c17c2 100644 --- a/TAO/tao/Strategies/SCIOP_Transport.cpp +++ b/TAO/tao/Strategies/SCIOP_Transport.cpp @@ -41,13 +41,6 @@ TAO_SCIOP_Transport::TAO_SCIOP_Transport (TAO_SCIOP_Connection_Handler *handler, , connection_handler_ (handler) , messaging_object_ (0) { - if (connection_handler_ != 0) - { - // REFCNT: Matches one of - // TAO_Transport::connection_handler_close() or - // TAO_Transport::close_connection_shared. - this->connection_handler_->incr_refcount(); - } if (flag) { // Use the lite version of the protocol @@ -64,7 +57,6 @@ TAO_SCIOP_Transport::TAO_SCIOP_Transport (TAO_SCIOP_Connection_Handler *handler, TAO_SCIOP_Transport::~TAO_SCIOP_Transport (void) { - ACE_ASSERT(this->connection_handler_ == 0); delete this->messaging_object_; } @@ -87,9 +79,9 @@ TAO_SCIOP_Transport::messaging_object (void) } ssize_t -TAO_SCIOP_Transport::send_i (iovec *iov, int iovcnt, - size_t &bytes_transferred, - const ACE_Time_Value *max_wait_time) +TAO_SCIOP_Transport::send (iovec *iov, int iovcnt, + size_t &bytes_transferred, + const ACE_Time_Value *max_wait_time) { ssize_t retval = this->connection_handler_->peer ().sendv (iov, iovcnt, max_wait_time); @@ -100,9 +92,9 @@ TAO_SCIOP_Transport::send_i (iovec *iov, int iovcnt, } ssize_t -TAO_SCIOP_Transport::recv_i (char *buf, - size_t len, - const ACE_Time_Value *max_wait_time) +TAO_SCIOP_Transport::recv (char *buf, + size_t len, + const ACE_Time_Value *max_wait_time) { ssize_t n = this->connection_handler_->peer ().recv (buf, len, @@ -115,7 +107,7 @@ TAO_SCIOP_Transport::recv_i (char *buf, errno != ETIME) { ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) - SCIOP_Transport[%d]::recv_i, ") + ACE_TEXT ("TAO (%P|%t) - SCIOP_Transport[%d]::recv, ") ACE_TEXT ("read failure - %m\n"), this->id ())); } @@ -143,32 +135,6 @@ TAO_SCIOP_Transport::recv_i (char *buf, } int -TAO_SCIOP_Transport::register_handler_i (void) -{ - if (TAO_debug_level > 4) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - SCIOP_Transport[%d]::register_handler\n", - this->id ())); - } - - ACE_Reactor *r = this->orb_core_->reactor (); - - if (r == this->connection_handler_->reactor ()) - return 0; - - // Set the flag in the Connection Handler and in the Wait Strategy - // @@Maybe we should set these flags after registering with the - // reactor. What if the registration fails??? - this->ws_->is_registered (1); - - // Register the handler with the reactor - return r->register_handler (this->connection_handler_, - ACE_Event_Handler::READ_MASK); -} - - -int TAO_SCIOP_Transport::send_request (TAO_Stub *stub, TAO_ORB_Core *orb_core, TAO_OutputCDR &stream, @@ -184,12 +150,6 @@ TAO_SCIOP_Transport::send_request (TAO_Stub *stub, if (tph != 0) { - ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->handler_lock_, -1); - - if (this->check_event_handler_i ("SCIOP_Transport::send_request") - == -1) - return -1; - const char protocol[] = "sciop"; const char * protocol_type = protocol; @@ -270,9 +230,6 @@ TAO_SCIOP_Transport::send_message_shared (TAO_Stub *stub, { ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->handler_lock_, -1); - if (this->check_event_handler_i ("SCIOP_Transport::send_message_shared") == -1) - return -1; - if (TAO_debug_level > 6) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - ") @@ -350,17 +307,6 @@ TAO_SCIOP_Transport::tear_listen_point_list (TAO_InputCDR &cdr) // 1 (i.e., non-originating side) this->bidirectional_flag (1); - // Just make sure that the connection handler is sane before we go - // head and do anything with it. - ACE_GUARD_RETURN (ACE_Lock, - ace_mon, - *this->handler_lock_, - -1); - - if (this->check_event_handler_i ("SCIOP_Transport::tear_listen_point_list") - == -1) - return -1; - return this->connection_handler_->process_listen_point_list (listen_list); } @@ -430,29 +376,17 @@ TAO_SCIOP_Transport::get_listen_point ( // Get the local address of the connection ACE_INET_Addr local_addr; - { - // Just make sure that the connection handler is sane before we go - // head and do anything with it. - ACE_GUARD_RETURN (ACE_Lock, - ace_mon, - *this->handler_lock_, - -1); - - if (this->check_event_handler_i ("IIOP_Transport::get_listen_point") - == -1) - return -1; - - if (this->connection_handler_->peer ().get_local_addr (local_addr) - == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("(%P|%t) Could not resolve local ") - ACE_TEXT ("host address in ") - ACE_TEXT ("get_listen_point()\n")), - -1); - } - } - + + if (this->connection_handler_->peer ().get_local_addr (local_addr) + == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("(%P|%t) Could not resolve local ") + ACE_TEXT ("host address in ") + ACE_TEXT ("get_listen_point()\n")), + -1); + } + // Note: Looks like there is no point in sending the list of // endpoints on interfaces on which this connection has not // been established. If this is wrong, please correct me. @@ -493,12 +427,4 @@ TAO_SCIOP_Transport::get_listen_point ( return 1; } -TAO_Connection_Handler * -TAO_SCIOP_Transport::invalidate_event_handler_i (void) -{ - TAO_Connection_Handler * eh = this->connection_handler_; - this->connection_handler_ = 0; - return eh; -} - #endif /* TAO_HAS_SCIOP == 1 */ diff --git a/TAO/tao/Strategies/SCIOP_Transport.h b/TAO/tao/Strategies/SCIOP_Transport.h index fe3905ae174..770be64e55d 100644 --- a/TAO/tao/Strategies/SCIOP_Transport.h +++ b/TAO/tao/Strategies/SCIOP_Transport.h @@ -70,25 +70,22 @@ protected: //@{ virtual ACE_Event_Handler * event_handler_i (void); - virtual TAO_Connection_Handler * invalidate_event_handler_i (void); /// Access the underlying messaging object virtual TAO_Pluggable_Messaging *messaging_object (void); - virtual ssize_t send_i (iovec *iov, int iovcnt, - size_t &bytes_transferred, - const ACE_Time_Value *timeout = 0); + virtual ssize_t send (iovec *iov, int iovcnt, + size_t &bytes_transferred, + const ACE_Time_Value *timeout = 0); - virtual ssize_t recv_i (char *buf, - size_t len, - const ACE_Time_Value *s = 0); - - virtual int register_handler_i (void); + virtual ssize_t recv (char *buf, + size_t len, + const ACE_Time_Value *s = 0); virtual int send_message_shared (TAO_Stub *stub, - int message_semantics, - const ACE_Message_Block *message_block, - ACE_Time_Value *max_wait_time); + int message_semantics, + const ACE_Message_Block *message_block, + ACE_Time_Value *max_wait_time); public: @@ -151,4 +148,3 @@ private: #include "ace/post.h" #endif /* TAO_SCIOP_TRANSPORT_H */ - diff --git a/TAO/tao/Strategies/SHMIOP_Connection_Handler.cpp b/TAO/tao/Strategies/SHMIOP_Connection_Handler.cpp index 6ff58729342..826317a92c9 100644 --- a/TAO/tao/Strategies/SHMIOP_Connection_Handler.cpp +++ b/TAO/tao/Strategies/SHMIOP_Connection_Handler.cpp @@ -31,7 +31,7 @@ TAO_SHMIOP_Connection_Handler::TAO_SHMIOP_Connection_Handler (ACE_Thread_Manager // Creation_Strategy requires a constructor with that signature, we // don't use that implementation, but some (most?) compilers // instantiate it anyway. - ACE_ASSERT (this->orb_core () != 0); + ACE_ASSERT (0); } @@ -47,12 +47,12 @@ TAO_SHMIOP_Connection_Handler::TAO_SHMIOP_Connection_Handler (TAO_ORB_Core *orb_ // store this pointer (indirectly increment ref count) this->transport (specific_transport); - TAO_Transport::release (specific_transport); } TAO_SHMIOP_Connection_Handler::~TAO_SHMIOP_Connection_Handler (void) { + delete this->transport (); } int @@ -133,20 +133,57 @@ TAO_SHMIOP_Connection_Handler::close_connection (void) int TAO_SHMIOP_Connection_Handler::handle_input (ACE_HANDLE h) { - return this->handle_input_eh (h, this); + int result = + this->handle_input_eh (h, this); + + if (result == -1) + { + this->close_connection (); + return 0; + } + + return result; } int TAO_SHMIOP_Connection_Handler::handle_output (ACE_HANDLE handle) { - return this->handle_output_eh (handle, this); + int result = + this->handle_output_eh (handle, this); + + if (result == -1) + { + this->close_connection (); + return 0; + } + + return result; +} + +int +TAO_SHMIOP_Connection_Handler::handle_timeout (const ACE_Time_Value &, + const void *) +{ + // We don't use this upcall for I/O. This is only used by the + // Connector to indicate that the connection timedout. Therefore, + // we should call close(). + return this->close (); } int -TAO_SHMIOP_Connection_Handler::handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask rm) +TAO_SHMIOP_Connection_Handler::handle_close (ACE_HANDLE, + ACE_Reactor_Mask) { - return this->handle_close_eh (handle, rm, this); + ACE_ASSERT (0); + return 0; +} + +int +TAO_SHMIOP_Connection_Handler::close (u_long) +{ + this->state_changed (TAO_LF_Event::LFS_CONNECTION_CLOSED); + this->transport ()->remove_reference (); + return 0; } int diff --git a/TAO/tao/Strategies/SHMIOP_Connection_Handler.h b/TAO/tao/Strategies/SHMIOP_Connection_Handler.h index fd1d046a43b..12562a37adf 100644 --- a/TAO/tao/Strategies/SHMIOP_Connection_Handler.h +++ b/TAO/tao/Strategies/SHMIOP_Connection_Handler.h @@ -71,6 +71,10 @@ public: virtual int open_handler (void *); //@} + /// Close called by the Acceptor or Connector when connection + /// establishment fails. + int close (u_long = 0); + //@{ /** @name Event Handler overloads */ @@ -79,6 +83,8 @@ public: virtual int handle_input (ACE_HANDLE); virtual int handle_output (ACE_HANDLE); virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask); + virtual int handle_timeout (const ACE_Time_Value ¤t_time, + const void *act = 0); //@} /// Add ourselves to Cache. diff --git a/TAO/tao/Strategies/SHMIOP_Connector.cpp b/TAO/tao/Strategies/SHMIOP_Connector.cpp index 4a4d28a04c4..24f53525d68 100644 --- a/TAO/tao/Strategies/SHMIOP_Connector.cpp +++ b/TAO/tao/Strategies/SHMIOP_Connector.cpp @@ -29,13 +29,7 @@ template class TAO_Connect_Creation_Strategy<TAO_SHMIOP_Connection_Handler>; template class ACE_Strategy_Connector<TAO_SHMIOP_Connection_Handler, ACE_MEM_CONNECTOR>; template class ACE_Connect_Strategy<TAO_SHMIOP_Connection_Handler, ACE_MEM_CONNECTOR>; template class ACE_Connector<TAO_SHMIOP_Connection_Handler, ACE_MEM_CONNECTOR>; -template class ACE_Svc_Tuple<TAO_SHMIOP_Connection_Handler>; - -template class ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<TAO_SHMIOP_Connection_Handler> *, TAO_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<TAO_SHMIOP_Connection_Handler> *, TAO_SYNCH_RW_MUTEX>; -template class ACE_Map_Entry<ACE_HANDLE,ACE_Svc_Tuple<TAO_SHMIOP_Connection_Handler>*>; -template class ACE_Map_Iterator<ACE_HANDLE,ACE_Svc_Tuple<TAO_SHMIOP_Connection_Handler>*,TAO_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<ACE_HANDLE,ACE_Svc_Tuple<TAO_SHMIOP_Connection_Handler>*,TAO_SYNCH_RW_MUTEX>; +template class ACE_NonBlocking_Connect_Handler<TAO_SHMIOP_Connection_Handler>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) @@ -44,13 +38,7 @@ template class ACE_Map_Reverse_Iterator<ACE_HANDLE,ACE_Svc_Tuple<TAO_SHMIOP_Conn #pragma instantiate ACE_Strategy_Connector<TAO_SHMIOP_Connection_Handler, ACE_MEM_CONNECTOR> #pragma instantiate ACE_Connect_Strategy<TAO_SHMIOP_Connection_Handler, ACE_MEM_CONNECTOR> #pragma instantiate ACE_Connector<TAO_SHMIOP_Connection_Handler, ACE_MEM_CONNECTOR> -#pragma instantiate ACE_Svc_Tuple<TAO_SHMIOP_Connection_Handler> - -#pragma instantiate ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<TAO_SHMIOP_Connection_Handler> *, TAO_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<TAO_SHMIOP_Connection_Handler> *, TAO_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Entry<ACE_HANDLE,ACE_Svc_Tuple<TAO_SHMIOP_Connection_Handler>*> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE,ACE_Svc_Tuple<TAO_SHMIOP_Connection_Handler>*,TAO_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_HANDLE,ACE_Svc_Tuple<TAO_SHMIOP_Connection_Handler>*,TAO_SYNCH_RW_MUTEX> +#pragma instantiate ACE_NonBlocking_Connect_Handler<TAO_SHMIOP_Connection_Handler> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ @@ -145,7 +133,7 @@ TAO_SHMIOP_Connector::set_validate_endpoint (TAO_Endpoint *endpoint) if (TAO_debug_level > 0) { ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("TAO (%P|%t) IIOP connection failed.\n") + ACE_LIB_TEXT ("TAO (%P|%t) SHMIOP connection failed.\n") ACE_LIB_TEXT ("TAO (%P|%t) This is most likely ") ACE_LIB_TEXT ("due to a hostname lookup ") ACE_LIB_TEXT ("failure.\n"))); @@ -177,9 +165,6 @@ TAO_SHMIOP_Connector::make_connection (TAO_GIOP_Invocation *invocation, const ACE_INET_Addr &remote_address = shmiop_endpoint->object_addr (); - - TAO_SHMIOP_Connection_Handler *svc_handler = 0; - if (TAO_debug_level > 2) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) SHMIOP_Connector::connect ") @@ -191,27 +176,25 @@ TAO_SHMIOP_Connector::make_connection (TAO_GIOP_Invocation *invocation, this->active_connect_strategy_->synch_options (max_wait_time, synch_options); + TAO_SHMIOP_Connection_Handler *svc_handler = 0; + + // Connect. int result = this->base_connector_.connect (svc_handler, remote_address, synch_options); - int status = svc_handler->is_finalized (); - // Reduce the refcount to the svc_handler that we have. The - // increment to the handler is done in make_svc_handler (). Now - // that we dont need the reference to it anymore we can decrement - // the refcount whether the connection is successful ot not. - long refcount = svc_handler->decr_refcount (); - - ACE_ASSERT (refcount >= 0); - ACE_UNUSED_ARG (refcount); + // This call creates the service handler and bumps the #REFCOUNT# up + // one extra. There are two possibilities: (a) connection succeeds + // immediately - in this case, the #REFCOUNT# on the handler is two; + // (b) connection fails immediately - in this case, the #REFCOUNT# + // on the handler is one since close() gets called on the handler. + // We always use a blocking connection so the connection is never + // pending. - // = We dont do a wait since we know that we are doing a blocking - // connect - if (TAO_debug_level > 4) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) SHMIOP_Connector::connect ") - ACE_TEXT ("The result is <%d> \n"), result)); + // Irrespective of success or failure, remove the extra #REFCOUNT#. + svc_handler->remove_reference (); + // In case of errors. if (result == -1) { // Give users a clue to the problem. @@ -227,47 +210,74 @@ TAO_SHMIOP_Connector::make_connection (TAO_GIOP_Invocation *invocation, ACE_TEXT ("errno"))); } - (void) this->active_connect_strategy_->post_failed_connect (svc_handler, - status); - return -1; } - TAO_Transport *base_transport = - TAO_Transport::_duplicate (svc_handler->transport ()); + // At this point, the connection has be successfully connected. + // #REFCOUNT# is one. + if (TAO_debug_level > 2) + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - SHMIOP_Connector::make_connection, " + "new connection to <%s:%d> on Transport[%d]\n", + shmiop_endpoint->host (), shmiop_endpoint->port (), + svc_handler->peer ().get_handle ())); + + TAO_Transport *transport = + svc_handler->transport (); // Add the handler to Cache int retval = this->orb_core ()->lane_resources ().transport_cache ().cache_transport (desc, - base_transport); + transport); - if (retval != 0 && TAO_debug_level > 0) + // Failure in adding to cache. + if (retval != 0) { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) SHMIOP_Connector::connect ") - ACE_TEXT ("could not add the new connection to Cache \n"))); - } + // Close the handler. + svc_handler->close (); + if (TAO_debug_level > 0) + { + ACE_ERROR ((LM_ERROR, + "TAO (%P|%t) - SHMIOP_Connector::make_connection, " + "could not add the new connection to cache\n")); + } + + return -1; + } // If the wait strategy wants us to be registered with the reactor - // then we do so. - retval = base_transport->wait_strategy ()->register_handler (); + // then we do so. If registeration is required and it succeeds, + // #REFCOUNT# becomes two. + retval = transport->wait_strategy ()->register_handler (); - if (retval != 0 && TAO_debug_level > 0) + // Registration failures. + if (retval != 0) { - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("(%P|%t) IIOP_Connector::connect ") - ACE_LIB_TEXT ("could not add the new connection to reactor \n"))); + // Purge from the connection cache. + transport->purge_entry (); + + // Close the handler. + svc_handler->close (); + + if (TAO_debug_level > 0) + { + ACE_ERROR ((LM_ERROR, + "TAO (%P|%t) - SHMIOP_Connector::make_connection, " + "could not register the new connection in the reactor\n")); + } + + return -1; } // Handover the transport pointer to the Invocation class. - TAO_Transport *&transport = invocation->transport (); - transport = base_transport; + TAO_Transport *&invocation_transport = + invocation->transport (); + invocation_transport = transport; return 0; } - TAO_Profile * TAO_SHMIOP_Connector::create_profile (TAO_InputCDR& cdr) { diff --git a/TAO/tao/Strategies/SHMIOP_Transport.cpp b/TAO/tao/Strategies/SHMIOP_Transport.cpp index 4151467e50f..77ef4957f7c 100644 --- a/TAO/tao/Strategies/SHMIOP_Transport.cpp +++ b/TAO/tao/Strategies/SHMIOP_Transport.cpp @@ -34,13 +34,6 @@ TAO_SHMIOP_Transport::TAO_SHMIOP_Transport (TAO_SHMIOP_Connection_Handler *handl connection_handler_ (handler), messaging_object_ (0) { - if (connection_handler_ != 0) - { - // REFCNT: Matches one of - // TAO_Transport::connection_handler_close() or - // TAO_Transport::close_connection_shared. - this->connection_handler_->incr_refcount(); - } if (flag) { // Use the lite version of the protocol @@ -57,7 +50,6 @@ TAO_SHMIOP_Transport::TAO_SHMIOP_Transport (TAO_SHMIOP_Connection_Handler *handl TAO_SHMIOP_Transport::~TAO_SHMIOP_Transport (void) { - ACE_ASSERT(this->connection_handler_ == 0); delete this->messaging_object_; } @@ -81,9 +73,9 @@ TAO_SHMIOP_Transport::messaging_object (void) ssize_t -TAO_SHMIOP_Transport::send_i (iovec *iov, int iovcnt, - size_t &bytes_transferred, - const ACE_Time_Value *max_wait_time) +TAO_SHMIOP_Transport::send (iovec *iov, int iovcnt, + size_t &bytes_transferred, + const ACE_Time_Value *max_wait_time) { bytes_transferred = 0; for (int i = 0; i < iovcnt; ++i) @@ -101,9 +93,9 @@ TAO_SHMIOP_Transport::send_i (iovec *iov, int iovcnt, } ssize_t -TAO_SHMIOP_Transport::recv_i (char *buf, - size_t len, - const ACE_Time_Value *max_wait_time) +TAO_SHMIOP_Transport::recv (char *buf, + size_t len, + const ACE_Time_Value *max_wait_time) { ssize_t n = 0; @@ -200,32 +192,6 @@ TAO_SHMIOP_Transport::consolidate_message (ACE_Message_Block &incoming, return this->process_parsed_messages (&pqd, rh); } - -int -TAO_SHMIOP_Transport::register_handler_i (void) -{ - if (TAO_debug_level > 4) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - SHMIOP_Transport::register_handler %d\n", - this->id ())); - } - // @@ It seems like this method should go away, the right reactor is - // picked at object creation time. - ACE_Reactor *r = this->orb_core_->reactor (); - - if (r == this->connection_handler_->reactor ()) - return 0; - - // Set the flag in the Connection Handler - this->ws_->is_registered (1); - - // Register the handler with the reactor - return r->register_handler (this->connection_handler_, - ACE_Event_Handler::READ_MASK); -} - - int TAO_SHMIOP_Transport::send_request (TAO_Stub *stub, TAO_ORB_Core *orb_core, @@ -292,12 +258,4 @@ TAO_SHMIOP_Transport::messaging_init (CORBA::Octet major, return 1; } -TAO_Connection_Handler * -TAO_SHMIOP_Transport::invalidate_event_handler_i (void) -{ - TAO_Connection_Handler * eh = this->connection_handler_; - this->connection_handler_ = 0; - return eh; -} - #endif /* TAO_HAS_SHMIOP && TAO_HAS_SHMIOP != 0 */ diff --git a/TAO/tao/Strategies/SHMIOP_Transport.h b/TAO/tao/Strategies/SHMIOP_Transport.h index b41197303ae..a0089bae8a0 100644 --- a/TAO/tao/Strategies/SHMIOP_Transport.h +++ b/TAO/tao/Strategies/SHMIOP_Transport.h @@ -69,26 +69,23 @@ protected: //@{ virtual ACE_Event_Handler * event_handler_i (void); virtual TAO_Connection_Handler *connection_handler_i (void); - virtual TAO_Connection_Handler * invalidate_event_handler_i (void); virtual TAO_Pluggable_Messaging *messaging_object (void); /// Write the complete Message_Block chain to the connection. - virtual ssize_t send_i (iovec *iov, int iovcnt, - size_t &bytes_transferred, - const ACE_Time_Value *timeout = 0); + virtual ssize_t send (iovec *iov, int iovcnt, + size_t &bytes_transferred, + const ACE_Time_Value *timeout = 0); /// Read len bytes from into buf. - virtual ssize_t recv_i (char *buf, - size_t len, - const ACE_Time_Value *s = 0); + virtual ssize_t recv (char *buf, + size_t len, + const ACE_Time_Value *s = 0); virtual int consolidate_message (ACE_Message_Block &incoming, ssize_t missing_data, TAO_Resume_Handle &rh, ACE_Time_Value *max_wait_time); - virtual int register_handler_i (void); - //@} public: diff --git a/TAO/tao/Strategies/UIOP_Connection_Handler.cpp b/TAO/tao/Strategies/UIOP_Connection_Handler.cpp index ca1b2f1b95a..3ca211a4c57 100644 --- a/TAO/tao/Strategies/UIOP_Connection_Handler.cpp +++ b/TAO/tao/Strategies/UIOP_Connection_Handler.cpp @@ -34,7 +34,7 @@ TAO_UIOP_Connection_Handler::TAO_UIOP_Connection_Handler (ACE_Thread_Manager *t) // Creation_Strategy requires a constructor with that signature, we // don't use that implementation, but some (most?) compilers // instantiate it anyway. - ACE_ASSERT (this->orb_core () != 0); + ACE_ASSERT (0); } @@ -47,17 +47,17 @@ TAO_UIOP_Connection_Handler::TAO_UIOP_Connection_Handler (TAO_ORB_Core *orb_core (TAO_UIOP_Properties *, arg)) { TAO_UIOP_Transport* specific_transport = 0; - ACE_NEW(specific_transport, - TAO_UIOP_Transport(this, orb_core, flag)); + ACE_NEW (specific_transport, + TAO_UIOP_Transport(this, orb_core, flag)); // store this pointer (indirectly increment ref count) - this->transport(specific_transport); - TAO_Transport::release (specific_transport); + this->transport (specific_transport); } TAO_UIOP_Connection_Handler::~TAO_UIOP_Connection_Handler (void) { + delete this->transport (); } int @@ -116,20 +116,57 @@ TAO_UIOP_Connection_Handler::close_connection (void) int TAO_UIOP_Connection_Handler::handle_input (ACE_HANDLE h) { - return this->handle_input_eh (h, this); + int result = + this->handle_input_eh (h, this); + + if (result == -1) + { + this->close_connection (); + return 0; + } + + return result; } int TAO_UIOP_Connection_Handler::handle_output (ACE_HANDLE handle) { - return this->handle_output_eh (handle, this); + int result = + this->handle_output_eh (handle, this); + + if (result == -1) + { + this->close_connection (); + return 0; + } + + return result; +} + +int +TAO_UIOP_Connection_Handler::handle_timeout (const ACE_Time_Value &, + const void *) +{ + // We don't use this upcall for I/O. This is only used by the + // Connector to indicate that the connection timedout. Therefore, + // we should call close(). + return this->close (); } int -TAO_UIOP_Connection_Handler::handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask rm) +TAO_UIOP_Connection_Handler::handle_close (ACE_HANDLE, + ACE_Reactor_Mask) { - return this->handle_close_eh (handle, rm, this); + ACE_ASSERT (0); + return 0; +} + +int +TAO_UIOP_Connection_Handler::close (u_long) +{ + this->state_changed (TAO_LF_Event::LFS_CONNECTION_CLOSED); + this->transport ()->remove_reference (); + return 0; } int diff --git a/TAO/tao/Strategies/UIOP_Connection_Handler.h b/TAO/tao/Strategies/UIOP_Connection_Handler.h index 1d5e1e212c5..da6216ab196 100644 --- a/TAO/tao/Strategies/UIOP_Connection_Handler.h +++ b/TAO/tao/Strategies/UIOP_Connection_Handler.h @@ -87,6 +87,10 @@ public: virtual int open_handler (void *); //@} + /// Close called by the Acceptor or Connector when connection + /// establishment fails. + int close (u_long = 0); + //@{ /** @name Event Handler overloads */ @@ -96,6 +100,8 @@ public: virtual int handle_input (ACE_HANDLE); virtual int handle_output (ACE_HANDLE); virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask); + virtual int handle_timeout (const ACE_Time_Value ¤t_time, + const void *act = 0); //@} diff --git a/TAO/tao/Strategies/UIOP_Connector.cpp b/TAO/tao/Strategies/UIOP_Connector.cpp index 1991c150ba1..f16a36bddfd 100644 --- a/TAO/tao/Strategies/UIOP_Connector.cpp +++ b/TAO/tao/Strategies/UIOP_Connector.cpp @@ -23,13 +23,7 @@ template class TAO_Connect_Creation_Strategy<TAO_UIOP_Connection_Handler>; template class ACE_Strategy_Connector<TAO_UIOP_Connection_Handler, ACE_LSOCK_CONNECTOR>; template class ACE_Connect_Strategy<TAO_UIOP_Connection_Handler, ACE_LSOCK_CONNECTOR>; template class ACE_Connector<TAO_UIOP_Connection_Handler, ACE_LSOCK_CONNECTOR>; -template class ACE_Svc_Tuple<TAO_UIOP_Connection_Handler>; - -template class ACE_Map_Manager<int, ACE_Svc_Tuple<TAO_UIOP_Connection_Handler> *, TAO_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator_Base<int, ACE_Svc_Tuple<TAO_UIOP_Connection_Handler> *, TAO_SYNCH_RW_MUTEX>; -template class ACE_Map_Entry<int,ACE_Svc_Tuple<TAO_UIOP_Connection_Handler>*>; -template class ACE_Map_Iterator<int,ACE_Svc_Tuple<TAO_UIOP_Connection_Handler>*,TAO_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<int,ACE_Svc_Tuple<TAO_UIOP_Connection_Handler>*,TAO_SYNCH_RW_MUTEX>; +template class ACE_NonBlocking_Connect_Handler<TAO_UIOP_Connection_Handler>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) @@ -41,13 +35,7 @@ template class ACE_Map_Reverse_Iterator<int,ACE_Svc_Tuple<TAO_UIOP_Connection_Ha #pragma instantiate ACE_Strategy_Connector<TAO_UIOP_Connection_Handler, ACE_LSOCK_CONNECTOR> #pragma instantiate ACE_Connect_Strategy<TAO_UIOP_Connection_Handler, ACE_LSOCK_CONNECTOR> #pragma instantiate ACE_Connector<TAO_UIOP_Connection_Handler, ACE_LSOCK_CONNECTOR> -#pragma instantiate ACE_Svc_Tuple<TAO_UIOP_Connection_Handler> - -#pragma instantiate ACE_Map_Manager<int, ACE_Svc_Tuple<TAO_UIOP_Connection_Handler> *, TAO_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator_Base<int, ACE_Svc_Tuple<TAO_UIOP_Connection_Handler> *, TAO_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Entry<int,ACE_Svc_Tuple<TAO_UIOP_Connection_Handler>*> -#pragma instantiate ACE_Map_Iterator<int,ACE_Svc_Tuple<TAO_UIOP_Connection_Handler>*,TAO_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<int,ACE_Svc_Tuple<TAO_UIOP_Connection_Handler>*,TAO_SYNCH_RW_MUTEX> +#pragma instantiate ACE_NonBlocking_Connect_Handler<TAO_UIOP_Connection_Handler> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ @@ -167,6 +155,7 @@ TAO_UIOP_Connector::make_connection (TAO_GIOP_Invocation *invocation, ACE_TEXT ("(%P|%t) UIOP_Connector::connect ") ACE_TEXT ("making a new connection \n"))); + // Get the right synch options ACE_Synch_Options synch_options; this->active_connect_strategy_->synch_options (max_wait_time, @@ -174,11 +163,30 @@ TAO_UIOP_Connector::make_connection (TAO_GIOP_Invocation *invocation, TAO_UIOP_Connection_Handler *svc_handler = 0; + // Connect. int result = this->base_connector_.connect (svc_handler, remote_address, synch_options); + // This call creates the service handler and bumps the #REFCOUNT# up + // one extra. There are three possibilities: (a) connection + // succeeds immediately - in this case, the #REFCOUNT# on the + // handler is two; (b) connection completion is pending - in this + // case, the #REFCOUNT# on the handler is also two; (c) connection + // fails immediately - in this case, the #REFCOUNT# on the handler + // is one since close() gets called on the handler. + // + // The extra reference count in + // TAO_Connect_Creation_Strategy::make_svc_handler() is needed in + // the case when connection completion is pending and we are going + // to wait on a variable in the handler to changes, signifying + // success or failure. Note, that this increment cannot be done + // once the connect() returns since this might be too late if + // another thread pick up the completion and potentially deletes the + // handler before we get a chance to increment the reference count. + + // No immediate result. Wait for completion. if (result == -1 && errno == EWOULDBLOCK) { if (TAO_debug_level > 2) @@ -187,9 +195,15 @@ TAO_UIOP_Connector::make_connection (TAO_GIOP_Invocation *invocation, "going to wait for connection completion on local" "handle [%d]\n", svc_handler->get_handle ())); + + // Wait for connection completion. No need to specify timeout + // to wait() since the correct timeout was passed to the + // Connector. The Connector will close the handler in the case + // of timeouts, so the event will complete (either success or + // failure) within timeout. result = this->active_connect_strategy_->wait (svc_handler, - max_wait_time); + 0); if (TAO_debug_level > 2) { @@ -198,26 +212,64 @@ TAO_UIOP_Connector::make_connection (TAO_GIOP_Invocation *invocation, "wait done for handle[%d], result = %d\n", svc_handler->get_handle (), result)); } - } - - int status = - svc_handler->is_finalized (); + // There are three possibilities when wait() returns: (a) + // connection succeeded; (b) connection failed; (c) wait() + // failed because of some other error. It is easy to deal with + // (a) and (b). (c) is tricky since the connection is still + // pending and may get completed by some other thread. The + // following code deals with (c). - // Reduce the refcount to the svc_handler that we have. The - // increment to the handler is done in make_svc_handler (). Now - // that we dont need the reference to it anymore we can decrement - // the refcount whether the connection is successful ot not. - long refcount = svc_handler->decr_refcount (); + // Check if the handler has been closed. + int closed = + svc_handler->is_finalized (); - ACE_ASSERT (refcount >= 0); - ACE_UNUSED_ARG (refcount); + // In case of failures and close() has not be called. + if (result == -1 && + !closed) + { + // First, cancel from connector. + this->base_connector_.cancel (svc_handler); + + // Double check to make sure the handler has not been + // closed yet. This double check is required to ensure + // that the connection handler was not closed yet by some + // other thread since it was still registered with the + // connector. Once connector.cancel() has been processed, + // we are assured that the connector will no longer + // open/close this handler. + closed = + svc_handler->is_closed (); + + // If closed, there is nothing to do here. If not closed, + // it was either opened or is still pending. + if (!closed) + { + // Check if the handler has been opened. + int open = + svc_handler->is_open (); + + // Some other thread was able to open the handler even + // though wait failed for this thread. + if (open) + // Overwrite <result>. + result = 0; + else + { + // Assert that it is still connecting. + ACE_ASSERT (svc_handler->is_connecting ()); + + // Force close the handler now. + svc_handler->close (); + } + } + } + } - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) UIOP_Connector::connect ") - ACE_TEXT ("The result is <%d> \n"), result)); + // Irrespective of success or failure, remove the extra #REFCOUNT#. + svc_handler->remove_reference (); + // In case of errors. if (result == -1) { // Give users a clue to the problem. @@ -232,46 +284,67 @@ TAO_UIOP_Connector::make_connection (TAO_GIOP_Invocation *invocation, ACE_TEXT ("errno"))); } - (void) this->active_connect_strategy_->post_failed_connect (svc_handler, - status); return -1; } - TAO_Transport *base_transport = - TAO_Transport::_duplicate (svc_handler->transport ()); + // At this point, the connection has be successfully connected. + // #REFCOUNT# is one. + + TAO_Transport *transport = + svc_handler->transport (); // Add the handler to Cache int retval = this->orb_core ()->lane_resources ().transport_cache ().cache_transport (desc, - base_transport); - - if (retval != 0 && TAO_debug_level > 0) + transport); + // Failure in adding to cache. + if (retval != 0) { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) UIOP_Connector::connect ") - ACE_TEXT ("could not add the new connection to Cache \n"))); + // Close the handler. + svc_handler->close (); + + if (TAO_debug_level > 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) UIOP_Connector::connect ") + ACE_TEXT ("could not add the new connection to Cache \n"))); + } + + return -1; } // If the wait strategy wants us to be registered with the reactor - // then we do so. - retval = base_transport->wait_strategy ()->register_handler (); + // then we do so. If registeration is required and it succeeds, + // #REFCOUNT# becomes two. + retval = transport->wait_strategy ()->register_handler (); - if (retval != 0 && TAO_debug_level > 0) + // Registration failures. + if (retval != 0) { - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("(%P|%t) IIOP_Connector::connect ") - ACE_LIB_TEXT ("could not add the new connection to reactor \n"))); + // Purge from the connection cache. + transport->purge_entry (); + + // Close the handler. + svc_handler->close (); + + if (TAO_debug_level > 0) + { + ACE_ERROR ((LM_ERROR, + "TAO (%P|%t) - UIOP_Connector::make_connection, " + "could not register the new connection in the reactor\n")); + } + + return -1; } // Handover the transport pointer to the Invocation class. - TAO_Transport *&transport = invocation->transport (); - transport = base_transport; + TAO_Transport *&invocation_transport = + invocation->transport (); + invocation_transport = transport; return 0; } - - TAO_Profile * TAO_UIOP_Connector::create_profile (TAO_InputCDR& cdr) { diff --git a/TAO/tao/Strategies/UIOP_Transport.cpp b/TAO/tao/Strategies/UIOP_Transport.cpp index 3270f94f012..b5cfaf044dd 100644 --- a/TAO/tao/Strategies/UIOP_Transport.cpp +++ b/TAO/tao/Strategies/UIOP_Transport.cpp @@ -33,13 +33,6 @@ TAO_UIOP_Transport::TAO_UIOP_Transport (TAO_UIOP_Connection_Handler *handler, , connection_handler_ (handler) , messaging_object_ (0) { - if (connection_handler_ != 0) - { - // REFCNT: Matches one of - // TAO_Transport::connection_handler_close() or - // TAO_Transport::close_connection_shared. - this->connection_handler_->incr_refcount(); - } if (flag) { // Use the lite version of the protocol @@ -56,7 +49,6 @@ TAO_UIOP_Transport::TAO_UIOP_Transport (TAO_UIOP_Connection_Handler *handler, TAO_UIOP_Transport::~TAO_UIOP_Transport (void) { - ACE_ASSERT(this->connection_handler_ == 0); delete this->messaging_object_; } @@ -79,9 +71,9 @@ TAO_UIOP_Transport::messaging_object (void) } ssize_t -TAO_UIOP_Transport::send_i (iovec *iov, int iovcnt, - size_t &bytes_transferred, - const ACE_Time_Value *max_wait_time) +TAO_UIOP_Transport::send (iovec *iov, int iovcnt, + size_t &bytes_transferred, + const ACE_Time_Value *max_wait_time) { ssize_t retval = this->connection_handler_->peer ().sendv (iov, iovcnt, max_wait_time); @@ -92,9 +84,9 @@ TAO_UIOP_Transport::send_i (iovec *iov, int iovcnt, } ssize_t -TAO_UIOP_Transport::recv_i (char *buf, - size_t len, - const ACE_Time_Value *max_wait_time) +TAO_UIOP_Transport::recv (char *buf, + size_t len, + const ACE_Time_Value *max_wait_time) { ssize_t n = this->connection_handler_->peer ().recv (buf, len, @@ -109,7 +101,7 @@ TAO_UIOP_Transport::recv_i (char *buf, ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - %p \n"), ACE_TEXT ("TAO - read message failure ") - ACE_TEXT ("recv_i () \n"))); + ACE_TEXT ("recv () \n"))); } // Error handling @@ -130,31 +122,6 @@ TAO_UIOP_Transport::recv_i (char *buf, } int -TAO_UIOP_Transport::register_handler_i (void) -{ - if (TAO_debug_level > 4) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - UIOP_Transport::register_handler %d\n", - this->id ())); - } - // @@ It seems like this method should go away, the right reactor is - // picked at object creation time. - ACE_Reactor *r = this->orb_core_->reactor (); - - if (r == this->connection_handler_->reactor ()) - return 0; - - // Set the flag in the Connection Handler - this->ws_->is_registered (1); - - // Register the handler with the reactor - return r->register_handler (this->connection_handler_, - ACE_Event_Handler::READ_MASK); -} - - -int TAO_UIOP_Transport::send_request (TAO_Stub *stub, TAO_ORB_Core *orb_core, TAO_OutputCDR &stream, @@ -220,12 +187,4 @@ TAO_UIOP_Transport::messaging_init (CORBA::Octet major, return 1; } -TAO_Connection_Handler * -TAO_UIOP_Transport::invalidate_event_handler_i (void) -{ - TAO_Connection_Handler * eh = this->connection_handler_; - this->connection_handler_ = 0; - return eh; -} - #endif /* TAO_HAS_UIOP */ diff --git a/TAO/tao/Strategies/UIOP_Transport.h b/TAO/tao/Strategies/UIOP_Transport.h index cb504621570..1099d7e1bf0 100644 --- a/TAO/tao/Strategies/UIOP_Transport.h +++ b/TAO/tao/Strategies/UIOP_Transport.h @@ -68,20 +68,17 @@ protected: virtual ACE_Event_Handler * event_handler_i (void); virtual TAO_Connection_Handler *connection_handler_i (void); - virtual TAO_Connection_Handler * invalidate_event_handler_i (void); virtual TAO_Pluggable_Messaging *messaging_object (void); /// Write the complete Message_Block chain to the connection. - virtual ssize_t send_i (iovec *iov, int iovcnt, - size_t &bytes_transferred, - const ACE_Time_Value *timeout = 0); + virtual ssize_t send (iovec *iov, int iovcnt, + size_t &bytes_transferred, + const ACE_Time_Value *timeout = 0); /// Read len bytes from into buf. - virtual ssize_t recv_i (char *buf, - size_t len, - const ACE_Time_Value *s = 0); - - virtual int register_handler_i (void); + virtual ssize_t recv (char *buf, + size_t len, + const ACE_Time_Value *s = 0); public: /// @todo These methods IMHO should have more meaningful names. diff --git a/TAO/tao/TAO.dsp b/TAO/tao/TAO.dsp index 9b9c6708c55..f0a69a5809f 100644 --- a/TAO/tao/TAO.dsp +++ b/TAO/tao/TAO.dsp @@ -636,10 +636,6 @@ SOURCE=.\Muxed_TMS.cpp # End Source File
# Begin Source File
-SOURCE=.\Notify_Handler.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\NVList.cpp
# End Source File
# Begin Source File
@@ -1532,10 +1528,6 @@ SOURCE=.\Muxed_TMS.h # End Source File
# Begin Source File
-SOURCE=.\Notify_Handler.h
-# End Source File
-# Begin Source File
-
SOURCE=.\nvlist.h
# End Source File
# Begin Source File
diff --git a/TAO/tao/TAO_Static.dsp b/TAO/tao/TAO_Static.dsp index 75d6d7cae45..682cfaf45be 100644 --- a/TAO/tao/TAO_Static.dsp +++ b/TAO/tao/TAO_Static.dsp @@ -555,10 +555,6 @@ SOURCE=.\Muxed_TMS.cpp # End Source File
# Begin Source File
-SOURCE=.\Notify_Handler.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\NVList.cpp
# End Source File
# Begin Source File
@@ -1491,10 +1487,6 @@ SOURCE=.\Muxed_TMS.h # End Source File
# Begin Source File
-SOURCE=.\Notify_Handler.h
-# End Source File
-# Begin Source File
-
SOURCE=.\nvlist.h
# End Source File
# Begin Source File
diff --git a/TAO/tao/Thread_Lane_Resources.cpp b/TAO/tao/Thread_Lane_Resources.cpp index ff2b263fd1d..d0c9327755c 100644 --- a/TAO/tao/Thread_Lane_Resources.cpp +++ b/TAO/tao/Thread_Lane_Resources.cpp @@ -8,7 +8,9 @@ ACE_RCSID(tao, Thread_Lane_Resources, "$Id$") #include "tao/Acceptor_Registry.h" #include "tao/Transport_Cache_Manager.h" #include "tao/Leader_Follower.h" -#include "Connector_Registry.h" +#include "tao/Connection_Handler.h" +#include "tao/Transport.h" +#include "tao/Connector_Registry.h" #include "ace/Reactor.h" @@ -260,37 +262,28 @@ TAO_Thread_Lane_Resources::finalize (void) delete this->acceptor_registry_; } - // Set of file descriptors corresponding to open connections. This - // handle set is used to explicitly deregister the connection event - // handlers from the Reactor. This is particularly important for - // dynamically loaded ORBs where an application level reactor, such - // 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, unregistered); - - // Shutdown all open connections that are registered with the ORB - // Core. Note that the ACE_Event_Handler::DONT_CALL mask is NOT - // used here since the reactor should invoke each handle's - // corresponding ACE_Event_Handler::handle_close() method to ensure - // that the connection is shutdown gracefully prior to destroying - // the ORB Core. - if (handle_set.num_set () > 0) - (void) this->leader_follower ().reactor ()->remove_handler (handle_set, - ACE_Event_Handler::ALL_EVENTS_MASK); - if (!unregistered.is_empty ()) + // Set of handlers still in the connection cache. + TAO_Connection_Handler_Set handlers; + + // Close the transport cache and return the handlers that were still + // registered. The cache will decrease the #REFCOUNT# on the + // handler when it removes the handler from cache. However, + // #REFCOUNT# is increased when the handler is placed in the handler + // set. + this->transport_cache_->close (handlers); + + // Go through the handler set, closing the connections and removing + // the references. + TAO_Connection_Handler **handler = 0; + for (TAO_Connection_Handler_Set::iterator iter (handlers); + iter.next (handler); + iter.advance ()) { - 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); - } + // Connection is closed. Potential removal from the Reactor. + (*handler)->close_connection (); + + // #REFCOUNT# related to the handler set decreases. + (*handler)->transport ()->remove_reference (); } delete this->transport_cache_; diff --git a/TAO/tao/Thread_Per_Connection_Handler.cpp b/TAO/tao/Thread_Per_Connection_Handler.cpp index d69e6dcf0df..cc9d6edac94 100644 --- a/TAO/tao/Thread_Per_Connection_Handler.cpp +++ b/TAO/tao/Thread_Per_Connection_Handler.cpp @@ -13,14 +13,12 @@ TAO_Thread_Per_Connection_Handler::TAO_Thread_Per_Connection_Handler ( TAO_Connection_Handler *ch) : ch_ (ch) { - // REFCNT: Matches decr_refcount() in the destructor. - (void) this->ch_->incr_refcount (); + this->ch_->transport ()->add_reference (); } TAO_Thread_Per_Connection_Handler::~TAO_Thread_Per_Connection_Handler (void) { - // REFCNT: Matches incr_refcount() in the constructor. - (void) this->ch_->decr_refcount (); + this->ch_->transport ()->remove_reference (); } int diff --git a/TAO/tao/Transport.cpp b/TAO/tao/Transport.cpp index e07169bb109..6cfccf24bab 100644 --- a/TAO/tao/Transport.cpp +++ b/TAO/tao/Transport.cpp @@ -20,7 +20,6 @@ #include "Thread_Lane_Resources.h" #include "debug.h" #include "Resume_Handle.h" -#include "Notify_Handler.h" #include "ace/Message_Block.h" #include "ace/Reactor.h" @@ -96,16 +95,9 @@ dump_iov (iovec *iov, int iovcnt, size_t id, ACE_Log_Msg::instance ()->release (); } -/* - * Definitions for methods declared in the transport class - * - */ - -// Constructor. TAO_Transport::TAO_Transport (CORBA::ULong tag, TAO_ORB_Core *orb_core) - : TAO_Synch_Refcountable (orb_core->resource_factory ()->create_cached_connection_lock (), 1) - , tag_ (tag) + : tag_ (tag) , orb_core_ (orb_core) , cache_map_entry_ (0) , bidirectional_flag_ (-1) @@ -135,8 +127,6 @@ TAO_Transport::TAO_Transport (CORBA::ULong tag, TAO_Transport::~TAO_Transport (void) { - ACE_ASSERT(this->refcount() == 0); - delete this->ws_; delete this->tms_; @@ -145,122 +135,17 @@ TAO_Transport::~TAO_Transport (void) // By the time the destructor is reached all the connection stuff // *must* have been cleaned up - ACE_ASSERT(this->head_ == 0); - ACE_ASSERT(this->cache_map_entry_ == 0); -} - - -/* - * - * Public utility methods that are called by other classes. - * - */ -/*static*/ TAO_Transport* -TAO_Transport::_duplicate (TAO_Transport* transport) -{ - if (transport != 0) - { - transport->increment (); - } - return transport; -} - -/*static*/ void -TAO_Transport::release (TAO_Transport* transport) -{ - if (transport != 0) - { - int count = transport->decrement (); - - if (count == 0) - { - delete transport; - } - else if (count < 0) - { - ACE_ERROR ((LM_ERROR, - "TAO (%P|%t) - Transport[%d]::release, " - "reference count is less than zero: %d\n", - transport->id (), count)); - ACE_OS::abort (); - } - } + ACE_ASSERT (this->head_ == 0); + ACE_ASSERT (this->cache_map_entry_ == 0); } - void -TAO_Transport::provide_handle (ACE_Handle_Set &reactor_registered, - TAO_EventHandlerSet &unregistered) -{ - ACE_MT (ACE_GUARD (ACE_Lock, - guard, - *this->handler_lock_)); - ACE_Event_Handler *eh = this->event_handler_i (); - - if (eh != 0) - { - if (this->ws_->is_registered ()) - { - reactor_registered.set_bit (eh->get_handle ()); - } - else - { - unregistered.insert (eh); - } - } -} - - -int -TAO_Transport::register_handler (void) -{ - ACE_MT (ACE_GUARD_RETURN (ACE_Lock, - guard, - *this->handler_lock_, - -1)); - if (this->check_event_handler_i ("Transport::register_handler") == -1) - return -1; - - return this->register_handler_i (); -} - - -ssize_t -TAO_Transport::send (iovec *iov, int iovcnt, - size_t &bytes_transferred, - const ACE_Time_Value *timeout) -{ - ACE_MT (ACE_GUARD_RETURN (ACE_Lock, - guard, - *this->handler_lock_, - -1)); - - if (this->check_event_handler_i ("Transport::send") == -1) - return -1; - - // now call the template method - return this->send_i (iov, iovcnt, bytes_transferred, timeout); -} - - -ssize_t -TAO_Transport::recv (char *buffer, - size_t len, - const ACE_Time_Value *timeout) +TAO_Transport::provide_handler (TAO_Connection_Handler_Set &handlers) { - ACE_MT (ACE_GUARD_RETURN (ACE_Lock, - guard, - *this->handler_lock_, - -1)); - - if (this->check_event_handler_i ("Transport::recv") == -1) - return -1; - - // now call the template method - return this->recv_i (buffer, len, timeout); + this->add_reference (); + handlers.insert (this->connection_handler_i ()); } - int TAO_Transport::idle_after_send (void) { @@ -282,8 +167,32 @@ TAO_Transport::tear_listen_point_list (TAO_InputCDR &) void TAO_Transport::close_connection (void) { - TAO_Connection_Handler * eh = this->invalidate_event_handler (); - this->close_connection_shared (1, eh); + this->connection_handler_i ()->close_connection (); +} + +int +TAO_Transport::register_handler (void) +{ + if (TAO_debug_level > 4) + { + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - Transport[%d]::register_handler\n", + this->id ())); + } + + ACE_Reactor *r = this->orb_core_->reactor (); + + if (r == this->event_handler_i ()->reactor ()) + return 0; + + // Set the flag in the Connection Handler and in the Wait Strategy + // @@Maybe we should set these flags after registering with the + // reactor. What if the registration fails??? + this->ws_->is_registered (1); + + // Register the handler with the reactor + return r->register_handler (this->event_handler_i (), + ACE_Event_Handler::READ_MASK); } int @@ -308,7 +217,6 @@ TAO_Transport::generate_locate_request ( return 0; } - int TAO_Transport::generate_request_header ( TAO_Operation_Details &opdetails, @@ -318,8 +226,8 @@ TAO_Transport::generate_request_header ( // codeset service context is only supposed to be sent in the first request // on a particular connection. if (this->first_request_) - this->orb_core()->codeset_manager()-> - generate_service_context( opdetails, *this ); + this->orb_core ()->codeset_manager ()-> + generate_service_context (opdetails, *this); if (this->messaging_object ()->generate_request_header (opdetails, spec, @@ -337,32 +245,6 @@ TAO_Transport::generate_request_header ( return 0; } - -/* - * NOTE: Some of these calls looks like ideal fodder for - * inlining. But, please note that the calls made within the method - * are not inlined. This would increase closure cost on the - * compiler. - */ -void -TAO_Transport::connection_handler_closing (void) -{ - // The connection has closed, we must invalidate the handler to - // ensure that any attempt to use this transport results in an - // error. Basically all the other methods in the Transport - // cooperate via check_event_handler_i() - - TAO_Connection_Handler * eh = this->invalidate_event_handler (); - this->send_connection_closed_notifications (); - - if (eh != 0) - { - // REFCNT: Matches incr_refcnt in XXX_Transport::XXX_Transport - // REFCNT: Only one of this or close_connection_shared() run - eh->decr_refcount(); - } -} - // @@TODO: Ideally the following should be inline. int TAO_Transport::recache_transport (TAO_Transport_Descriptor_Interface *desc) @@ -378,7 +260,7 @@ TAO_Transport::recache_transport (TAO_Transport_Descriptor_Interface *desc) void TAO_Transport::purge_entry (void) { - (void) this->transport_cache_manager ().purge_entry (this->cache_map_entry_); + this->transport_cache_manager ().purge_entry (this->cache_map_entry_); } int @@ -393,7 +275,6 @@ TAO_Transport::update_transport (void) return this->transport_cache_manager ().update_entry (this->cache_map_entry_); } - /* * * Methods called and used in the output path of the ORB. @@ -427,7 +308,6 @@ TAO_Transport::handle_output (void) return retval; } - int TAO_Transport::send_message_block_chain (const ACE_Message_Block *mb, size_t &bytes_transferred, @@ -435,9 +315,6 @@ TAO_Transport::send_message_block_chain (const ACE_Message_Block *mb, { ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->handler_lock_, -1); - if (this->check_event_handler_i ("Transport::send_message_block_chain") == -1) - return -1; - return this->send_message_block_chain_i (mb, bytes_transferred, max_wait_time); @@ -490,22 +367,22 @@ TAO_Transport::send_message_shared (TAO_Stub *stub, const ACE_Message_Block *message_block, ACE_Time_Value *max_wait_time) { - int r; + int result; + { ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->handler_lock_, -1); - if (this->check_event_handler_i ("Transport::send_message_shared") == -1) - return -1; - - r = this->send_message_shared_i (stub, message_semantics, - message_block, max_wait_time); - } - if (r == -1) - { - this->close_connection (); + result = + this->send_message_shared_i (stub, message_semantics, + message_block, max_wait_time); } - return r; + if (result == -1) + { + this->close_connection (); + } + + return result; } int @@ -686,74 +563,6 @@ TAO_Transport::send_synch_message_helper_i (TAO_Synch_Queued_Message &synch_mess return 0; } - -void -TAO_Transport::close_connection_i (void) -{ - TAO_Connection_Handler * eh = this->invalidate_event_handler_i (); - this->close_connection_shared (1, eh); -} - -void -TAO_Transport::close_connection_no_purge (void) -{ - TAO_Connection_Handler * eh = this->invalidate_event_handler (); - - this->close_connection_shared (0, - eh); -} - -void -TAO_Transport::close_connection_shared (int purge, - TAO_Connection_Handler * eh) -{ - // Purge the entry - if (purge) - { - this->transport_cache_manager ().purge_entry (this->cache_map_entry_); - } - - if (eh == 0) - { - // The connection was already closed - return; - } - - // Set the event handler in the connection close wait state. - (void) eh->connection_close_wait (); - - // NOTE: If the wait strategy is in blocking mode, then there is no - // chance that it could be inside the reactor. We can safely skip - // driving the LF. If <purge> is 0, then we are cleaned up by the - // cache. So no point in driving the LF either. - if (this->ws_->non_blocking () && purge) - { - // NOTE: This is a work around for BUG 1020. We drive the leader - // follower for a predetermined amount of time. Ideally this - // needs to be an ORB option. But this is just the first - // cut. Doing that will be a todo.. - - ACE_Time_Value tv (ACE_DEFAULT_TIMEOUT, 0); - this->orb_core_->leader_follower ().wait_for_event (eh, - this, - &tv); - - } - - // We need to explicitly shut it down to avoid memory leaks. - if (!eh->successful () || - !this->ws_->non_blocking ()) - { - eh->close_connection (); - } - - this->send_connection_closed_notifications (); - - // REFCNT: Matches incr_refcnt in XXX_Transport::XXX_Transport - // REFCNT: Only one of this or connection_handler_closing() run - eh->decr_refcount (); -} - int TAO_Transport::queue_is_empty_i (void) { @@ -765,12 +574,7 @@ int TAO_Transport::schedule_output_i (void) { ACE_Event_Handler *eh = this->event_handler_i (); - if (eh == 0) - return -1; - ACE_Reactor *reactor = eh->reactor (); - if (reactor == 0) - return -1; if (TAO_debug_level > 3) { @@ -786,12 +590,7 @@ int TAO_Transport::cancel_output_i (void) { ACE_Event_Handler *eh = this->event_handler_i (); - if (eh == 0) - return -1; - ACE_Reactor *reactor = eh->reactor (); - if (reactor == 0) - return -1; if (TAO_debug_level > 3) { @@ -857,14 +656,11 @@ TAO_Transport::drain_queue (void) int TAO_Transport::drain_queue_helper (int &iovcnt, iovec iov[]) { - if (this->check_event_handler_i ("Transport::drain_queue_helper") == -1) - return -1; - size_t byte_count = 0; // ... send the message ... ssize_t retval = - this->send_i (iov, iovcnt, byte_count); + this->send (iov, iovcnt, byte_count); if (TAO_debug_level == 5) { @@ -896,7 +692,7 @@ TAO_Transport::drain_queue_helper (int &iovcnt, iovec iov[]) ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - Transport[%d]::drain_queue_helper, " "error during %p\n", - this->id (), "send_i()")); + this->id (), "send()")); } if (errno == EWOULDBLOCK) return 0; @@ -981,14 +777,8 @@ TAO_Transport::drain_queue_i (void) if (this->flush_timer_pending ()) { ACE_Event_Handler *eh = this->event_handler_i (); - if (eh != 0) - { - ACE_Reactor *reactor = eh->reactor (); - if (reactor != 0) - { - (void) reactor->cancel_timer (this->flush_timer_id_); - } - } + ACE_Reactor *reactor = eh->reactor (); + reactor->cancel_timer (this->flush_timer_id_); this->reset_flush_timer (); } return 1; @@ -1063,25 +853,19 @@ TAO_Transport::check_buffering_constraints_i (TAO_Stub *stub, if (set_timer) { ACE_Event_Handler *eh = this->event_handler_i (); - if (eh != 0) - { - ACE_Reactor *reactor = eh->reactor (); - if (reactor != 0) - { - this->current_deadline_ = new_deadline; - ACE_Time_Value delay = - new_deadline - ACE_OS::gettimeofday (); + ACE_Reactor *reactor = eh->reactor (); + this->current_deadline_ = new_deadline; + ACE_Time_Value delay = + new_deadline - ACE_OS::gettimeofday (); - if (this->flush_timer_pending ()) - { - (void) reactor->cancel_timer (this->flush_timer_id_); - } - this->flush_timer_id_ = - reactor->schedule_timer (&this->transport_timer_, - &this->current_deadline_, - delay); - } + if (this->flush_timer_pending ()) + { + reactor->cancel_timer (this->flush_timer_id_); } + this->flush_timer_id_ = + reactor->schedule_timer (&this->transport_timer_, + &this->current_deadline_, + delay); } return constraints_reached; @@ -1099,14 +883,6 @@ TAO_Transport::report_invalid_event_handler (const char *caller) } } -TAO_Connection_Handler * -TAO_Transport::invalidate_event_handler (void) -{ - ACE_MT (ACE_GUARD_RETURN (ACE_Lock, guard, *this->handler_lock_, 0)); - - return this->invalidate_event_handler_i (); -} - void TAO_Transport::send_connection_closed_notifications (void) { @@ -1152,7 +928,6 @@ TAO_Transport::send_message_shared_i (TAO_Stub *stub, max_wait_time); } - // Let's figure out if the message should be queued without trying // to send first: int try_sending_first = 1; @@ -1287,8 +1062,6 @@ TAO_Transport::send_message_shared_i (TAO_Stub *stub, return 0; } - - /* * * All the methods relevant to the incoming data path of the ORB are @@ -1296,9 +1069,9 @@ TAO_Transport::send_message_shared_i (TAO_Stub *stub, * */ int -TAO_Transport::handle_input_i (TAO_Resume_Handle &rh, - ACE_Time_Value * max_wait_time, - int /*block*/) +TAO_Transport::handle_input (TAO_Resume_Handle &rh, + ACE_Time_Value * max_wait_time, + int /*block*/) { if (TAO_debug_level > 3) { @@ -1319,9 +1092,8 @@ TAO_Transport::handle_input_i (TAO_Resume_Handle &rh, "TAO (%P|%t) - Transport[%d]::handle_input_i, " "error while parsing the head of the queue\n", this->id())); - - this->send_connection_closed_notifications (); } + return retval; } @@ -1376,14 +1148,7 @@ TAO_Transport::handle_input_i (TAO_Resume_Handle &rh, // If there is an error return to the reactor.. if (n <= 0) - { - if (n == -1) - { - this->send_connection_closed_notifications (); - } - - return n; - } + return n; if (TAO_debug_level > 2) { @@ -1492,7 +1257,6 @@ TAO_Transport::parse_incoming_messages (ACE_Message_Block &block) "error in incoming message\n", this->id ())); - this->send_connection_closed_notifications (); return -1; } } @@ -1584,7 +1348,7 @@ TAO_Transport::consolidate_message (ACE_Message_Block &incoming, "error while trying to consolidate\n", this->id ())); } - this->send_connection_closed_notifications (); + return -1; } @@ -1936,8 +1700,6 @@ TAO_Transport::process_parsed_messages (TAO_Queued_Data *qd, "received CloseConnection message %p\n", this->id(), "")); - this->send_connection_closed_notifications (); - // Return a "-1" so that the next stage can take care of // closing connection and the necessary memory management. return -1; @@ -1945,17 +1707,6 @@ TAO_Transport::process_parsed_messages (TAO_Queued_Data *qd, else if (t == TAO_PLUGGABLE_MESSAGE_REQUEST || t == TAO_PLUGGABLE_MESSAGE_LOCATEREQUEST) { - // Ready to process a request. Increment the refcount of <this - // transport>. Theoretically, after handler resumption another - // thread can access this very same transport and can even close - // this. To have a valid Transport object for further processing - // we should increment the refcount. Please see Bug 1382 for - // more details. - // REFCNT: Matched by the release before returning. - - // This generic class takes care of everything. - TAO_Transport_Refcount_Guard rg (this); - // Let us resume the handle before we go ahead to process the // request. This will open up the handle for other threads. rh.resume_handle (); @@ -1964,9 +1715,6 @@ TAO_Transport::process_parsed_messages (TAO_Queued_Data *qd, this, qd) == -1) { - this->send_connection_closed_notifications (); - - // Return a "-1" so that the next stage can take care of // closing connection and the necessary memory management. return -1; @@ -1975,8 +1723,6 @@ TAO_Transport::process_parsed_messages (TAO_Queued_Data *qd, else if (t == TAO_PLUGGABLE_MESSAGE_REPLY || t == TAO_PLUGGABLE_MESSAGE_LOCATEREPLY) { - // Please see ..else if (XXX_REQUEST) for whys and whats.. - TAO_Transport_Refcount_Guard rg (this); rh.resume_handle (); // @@todo: Maybe the input_cdr can be constructed from the @@ -1993,7 +1739,6 @@ TAO_Transport::process_parsed_messages (TAO_Queued_Data *qd, "error in process_reply_message %p\n", this->id (), "")); - this->send_connection_closed_notifications (); return -1; } @@ -2009,7 +1754,6 @@ TAO_Transport::process_parsed_messages (TAO_Queued_Data *qd, "dispatch reply failed\n", this->id ())); - this->send_connection_closed_notifications (); return -1; } @@ -2160,25 +1904,10 @@ TAO_Transport::notify_reactor (void) ACE_Event_Handler *eh = this->event_handler_i (); - if (eh == 0) - return -1; - // Get the reactor associated with the event handler ACE_Reactor *reactor = this->orb_core ()->reactor (); - if (reactor == 0) - return -1; - - // NOTE: Instead of creating the handler seperately, it would be - // awesome if we could create the handler when we create the - // TAO_Queued_Data. That would save us an allocation. - TAO_Notify_Handler *nh = - TAO_Notify_Handler::create_handler ( - this, - eh->get_handle (), - this->orb_core ()->transport_message_buffer_allocator ()); - if (TAO_debug_level > 0) { ACE_DEBUG ((LM_DEBUG, @@ -2189,7 +1918,7 @@ TAO_Transport::notify_reactor (void) // Send a notification to the reactor... - int retval = reactor->notify (nh, + int retval = reactor->notify (eh, ACE_Event_Handler::READ_MASK); if (retval < 0 && TAO_debug_level > 2) @@ -2226,7 +1955,17 @@ TAO_Transport::assign_translators (TAO_InputCDR *inp, TAO_OutputCDR *outp) } } +ACE_Event_Handler::Reference_Count +TAO_Transport::add_reference (void) +{ + return this->event_handler_i ()->add_reference (); +} +ACE_Event_Handler::Reference_Count +TAO_Transport::remove_reference (void) +{ + return this->event_handler_i ()->remove_reference (); +} #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) diff --git a/TAO/tao/Transport.h b/TAO/tao/Transport.h index e78fa5ea664..d329759ac16 100644 --- a/TAO/tao/Transport.h +++ b/TAO/tao/Transport.h @@ -28,7 +28,6 @@ #include "Transport_Cache_Manager.h" #include "Transport_Timer.h" #include "Incoming_Message_Queue.h" -#include "Synch_Refcountable.h" class TAO_ORB_Core; class TAO_Target_Specification; @@ -209,7 +208,7 @@ class TAO_Stub; * http://deuce.doc.wustl.edu/cvsweb/ace-latest.cgi/ACE_wrappers/TAO/docs/pluggable_protocols/index.html * */ -class TAO_Export TAO_Transport : private TAO_Synch_Refcountable +class TAO_Export TAO_Transport { public: @@ -220,10 +219,6 @@ public: /// destructor virtual ~TAO_Transport (void); - // Maintain reference counting with these - static TAO_Transport* _duplicate (TAO_Transport* transport); - static void release (TAO_Transport* transport); - /// Return the protocol tag. /** * The OMG assigns unique tags (a 32-bit unsigned number) to each @@ -289,20 +284,14 @@ public: */ int queue_is_empty (void); - /// Fill in a handle_set with any associated handler's reactor handle. + /// Added event handler to the handlers set. /** - * Called by the cache when the cache is closing in order to fill - * in a handle_set in a thread-safe manner. - * - * @param reactor_registered the ACE_Handle_Set into which the - * transport should place any handle registered with the reactor + * Called by the cache when the cache is closing. * - * @param unregistered the TAO_EventHandlerSet into which the - * transport should place any event handler that is not registered - * with anyone + * @param handlers the TAO_Connection_Handler_Set into which the + * transport should place its handler */ - void provide_handle (ACE_Handle_Set &reactor_registered, - TAO_EventHandlerSet &unregistered); + void provide_handler (TAO_Connection_Handler_Set &handlers); /// Remove all messages from the outgoing queue. @@ -311,13 +300,18 @@ public: */ // void dequeue_all (void); + /// Register the handler with the reactor. /** * Register the handler with the reactor. This method is used by the * Wait_On_Reactor strategy. The transport must register its event * handler with the ORB's Reactor. + * + * @todo: I think this method is pretty much useless, the + * connections are *always* registered with the Reactor, except in + * thread-per-connection mode. In that case putting the connection + * in the Reactor would produce unpredictable results anyway. */ - int register_handler (void); - + virtual int register_handler (void); /// Write the complete Message_Block chain to the connection. /** @@ -357,9 +351,9 @@ public: * down). In that case, it returns -1 and sets errno to * <code>ENOENT</code>. */ - ssize_t send (iovec *iov, int iovcnt, - size_t &bytes_transferred, - const ACE_Time_Value *timeout = 0); + virtual ssize_t send (iovec *iov, int iovcnt, + size_t &bytes_transferred, + const ACE_Time_Value *timeout = 0) = 0; /// Read len bytes from into buf. /** @@ -371,9 +365,9 @@ public: * not clear this this is the best place to specify this. The actual * timeout values will be kept in the Policies. */ - ssize_t recv (char *buffer, - size_t len, - const ACE_Time_Value *timeout = 0); + virtual ssize_t recv (char *buffer, + size_t len, + const ACE_Time_Value *timeout = 0) = 0; /** * @name Control connection lifecycle @@ -411,14 +405,18 @@ public: virtual int messaging_init (CORBA::Octet major, CORBA::Octet minor) = 0; - - /// Extracts the list of listen points from the <cdr> stream. The /// list would have the protocol specific details of the /// ListenPoints virtual int tear_listen_point_list (TAO_InputCDR &cdr); -protected: + /// Memory management routines. + /* + * Forwards to event handler. + */ + ACE_Event_Handler::Reference_Count add_reference (void); + ACE_Event_Handler::Reference_Count remove_reference (void); + /** @name Template methods * * The Transport class uses the Template Method Pattern to implement @@ -445,71 +443,14 @@ protected: */ virtual ACE_Event_Handler * event_handler_i (void) = 0; - virtual TAO_Connection_Handler * connection_handler_i (void) = 0; +protected: - /// Called by <code>connection_handler_closing()</code> to signal - /// that the protocol-specific transport should dissociate itself - /// with the protocol-specific connection handler. - /** - * Typically, this just sets the pointer to the associated connection - * handler to zero, although it could also clear out any additional - * resources associated with the handler association. - * - * @return The old event handler - */ - virtual TAO_Connection_Handler * invalidate_event_handler_i (void) = 0; + virtual TAO_Connection_Handler * connection_handler_i (void) = 0; /// Return the messaging object that is used to format the data that /// needs to be sent. virtual TAO_Pluggable_Messaging * messaging_object (void) = 0; - /// Write the complete iovec chain to the connection. - /** - * Often the implementation simply forwards the arguments to the - * underlying ACE_Svc_Handler class. Using the code factored out - * into ACE. - * - * Be careful with protocols that perform non-trivial - * transformations of the data, such as SSLIOP or protocols that - * compress the stream. - * - * @param iov contains the data that must be sent. - * - * @param iovcnt is the number of iovec structures in the list - * where iov points. - * - * @param bytes_transferred should return the total number of bytes - * successfully transferred before the connection blocked. This is - * required because in some platforms and/or protocols multiple - * system calls may be required to send the chain of message - * blocks. The first few calls can work successfully, but the final - * one can fail or signal a flow control situation (via EAGAIN). - * In this case the ORB expects the function to return -1, errno to - * be appropriately set and this argument to return the number of - * bytes already on the OS I/O subsystem. - * - * @param timeout is the maximum time that the application is - * willing to wait for the data to be sent, useful in platforms that - * implement timed writes. - * The timeout value is obtained from the policies set by the - * application. - * - */ - virtual ssize_t send_i (iovec *iov, int iovcnt, - size_t &bytes_transferred, - const ACE_Time_Value *timeout = 0) = 0; - - // Read len bytes from into buf. - /** - * @param buffer ORB allocated buffer where the data should be - * @@ The ACE_Time_Value *s is just a place holder for now. It is - * not clear this this is the best place to specify this. The actual - * timeout values will be kept in the Policies. - */ - virtual ssize_t recv_i (char *buffer, - size_t len, - const ACE_Time_Value *timeout = 0) = 0; - public: /// This is a request for the transport object to write a @@ -527,10 +468,6 @@ public: /// recache ourselves in the cache int recache_transport (TAO_Transport_Descriptor_Interface* desc); - /// Method for the connection handler to signify that it - /// is being closed and destroyed. - virtual void connection_handler_closing (void); - /// Callback to read incoming data /** * The ACE_Event_Handler adapter invokes this method as part of its @@ -550,10 +487,9 @@ public: * @param block Is deprecated and ignored. * */ - virtual int handle_input_i (TAO_Resume_Handle &rh, - ACE_Time_Value *max_wait_time = 0, - int block = 0); - + virtual int handle_input (TAO_Resume_Handle &rh, + ACE_Time_Value *max_wait_time = 0, + int block = 0); enum { @@ -562,8 +498,6 @@ public: TAO_REPLY }; - - /// Prepare the waiting and demuxing strategy to receive a reply for /// a new request. /** @@ -633,19 +567,7 @@ public: const ACE_Message_Block *message_block, ACE_Time_Value *max_wait_time); - protected: - /// Register the handler with the reactor. - /** - * This method is used by the Wait_On_Reactor strategy. The - * transport must register its event handler with the ORB's Reactor. - * - * @todo: I think this method is pretty much useless, the - * connections are *always* registered with the Reactor, except in - * thread-per-connection mode. In that case putting the connection - * in the Reactor would produce unpredictable results anyway. - */ - virtual int register_handler_i (void) = 0; /// Called by the handle_input_i (). This method is used to parse /// message read by the handle_input_i () call. It also decides @@ -677,9 +599,7 @@ protected: int consolidate_fragments (TAO_Queued_Data *qd, TAO_Resume_Handle &rh); - - - /// First consolidate the message queue. If the message is still not + /// 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 @@ -703,31 +623,20 @@ protected: /// Make a queued data from the <incoming> message block TAO_Queued_Data *make_queued_data (ACE_Message_Block &incoming); - /// Implement send_message_shared() assuming the handler_lock_ is + /// Implement send_message_shared() assuming the handler_lock_ is /// held. int send_message_shared_i (TAO_Stub *stub, int message_semantics, const ACE_Message_Block *message_block, ACE_Time_Value *max_wait_time); - /// Check if the underlying event handler is still valid. - /** - * @return Returns -1 if not, 0 if it is. - */ - int check_event_handler_i (const char *caller); - public: - - - /// Send a message block chain, int send_message_block_chain (const ACE_Message_Block *message_block, size_t &bytes_transferred, ACE_Time_Value *max_wait_time = 0); - - /// Send a message block chain, assuming the lock is held int send_message_block_chain_i (const ACE_Message_Block *message_block, size_t &bytes_transferred, @@ -787,6 +696,11 @@ public: /// Set the state of the first_request_ flag to 0 void first_request_sent(); + + /// Notify all the components inside a Transport when the underlying + /// connection is closed. + void send_connection_closed_notifications (void); + private: /// Helper method that returns the Transport Cache Manager. @@ -876,7 +790,6 @@ private: /// not pending void reset_flush_timer (void); - /// Print out error messages if the event handler is not valid void report_invalid_event_handler (const char *caller); @@ -893,32 +806,9 @@ private: */ int notify_reactor (void); - /// Grab the mutex and then call invalidate_event_handler_i() - TAO_Connection_Handler * invalidate_event_handler (void); - - /// Notify all the components inside a Transport when the underlying - /// connection is closed. - void send_connection_closed_notifications (void); - /// Assume the lock is held void send_connection_closed_notifications_i (void); - /// Implement close_connection() assuming the handler_lock_ is held. - void close_connection_i (void); - - /// This class needs priviledged access to: - /// close_connection_no_purge () - friend class TAO_Transport_Cache_Manager; - - /// Close the underlying connection, do not purge the entry from the - /// map (supposedly it was purged already, trust the caller, yuck!) - void close_connection_no_purge (void); - - /// Close the underlying connection, implements the code shared by - /// all the close_connection_* variants. - void close_connection_shared (int purge, - TAO_Connection_Handler * eh); - /// Prohibited ACE_UNIMPLEMENTED_FUNC (TAO_Transport (const TAO_Transport&)) ACE_UNIMPLEMENTED_FUNC (void operator= (const TAO_Transport&)) @@ -1005,6 +895,7 @@ protected: unsigned long purging_order_; private: + /// @@Phil, I think it would be nice if we could think of a way to /// do the following. /// We have been trying to use the transport for marking about diff --git a/TAO/tao/Transport.inl b/TAO/tao/Transport.inl index 53da1d841b9..ab9770b43f4 100644 --- a/TAO/tao/Transport.inl +++ b/TAO/tao/Transport.inl @@ -44,7 +44,6 @@ TAO_Transport::cache_map_entry (void) return this->cache_map_entry_; } - ACE_INLINE void TAO_Transport::cache_map_entry ( TAO_Transport_Cache_Manager::HASH_MAP_ENTRY *entry) @@ -90,8 +89,6 @@ TAO_Transport::queue_is_empty (void) return this->queue_is_empty_i (); } - - ACE_INLINE int TAO_Transport::flush_timer_pending (void) const { @@ -105,20 +102,6 @@ TAO_Transport::reset_flush_timer (void) this->current_deadline_ = ACE_Time_Value::zero; } -ACE_INLINE int -TAO_Transport::check_event_handler_i (const char *caller) -{ - // if there's no associated event handler, then we act like a null - // transport - if (this->event_handler_i () == 0) - { - this->report_invalid_event_handler (caller); - errno = ENOENT; - return -1; - } - return 0; -} - //******************************************************************** // codeset related methods @@ -162,17 +145,17 @@ TAO_Transport::first_request_sent (void) this->first_request_ = 0; } - - /*****************************************************/ + ACE_INLINE TAO_Transport_Refcount_Guard::TAO_Transport_Refcount_Guard (TAO_Transport *t) - :tr_ (TAO_Transport::_duplicate (t)) + : tr_ (t) { + this->tr_->add_reference (); } ACE_INLINE TAO_Transport_Refcount_Guard::~TAO_Transport_Refcount_Guard (void) { - TAO_Transport::release (this->tr_); + this->tr_->remove_reference (); } diff --git a/TAO/tao/Transport_Cache_Manager.cpp b/TAO/tao/Transport_Cache_Manager.cpp index de48e770861..b6a4ccae4ab 100644 --- a/TAO/tao/Transport_Cache_Manager.cpp +++ b/TAO/tao/Transport_Cache_Manager.cpp @@ -13,12 +13,10 @@ # include "tao/Transport_Cache_Manager.inl" #endif /* __ACE_INLINE__ */ - ACE_RCSID (TAO, Transport_Cache_Manager, "$Id$") - TAO_Transport_Cache_Manager::TAO_Transport_Cache_Manager (TAO_ORB_Core &orb_core) : percent_ (orb_core.resource_factory ()->purge_percentage ()), purging_strategy_ (orb_core.resource_factory ()->create_purging_strategy ()), @@ -98,8 +96,6 @@ TAO_Transport_Cache_Manager::bind_i (TAO_Cache_ExtId &ext_id, // are holding our lock this->purging_strategy_->update_item (int_id.transport ()); - - int retval = this->cache_map_.bind (ext_id, int_id, entry); @@ -119,7 +115,6 @@ TAO_Transport_Cache_Manager::bind_i (TAO_Cache_ExtId &ext_id, "Trying with a new index\n")); } - // There was an entry like this before, so let us do some // minor adjustments and rebind retval = this->get_last_index_bind (ext_id, @@ -195,8 +190,6 @@ TAO_Transport_Cache_Manager::find (const TAO_Cache_ExtId &key, return status; } - - int TAO_Transport_Cache_Manager::find_i (const TAO_Cache_ExtId &key, TAO_Cache_IntId &value) @@ -284,7 +277,6 @@ TAO_Transport_Cache_Manager::make_idle_i (HASH_MAP_ENTRY *&entry) return 0; } - int TAO_Transport_Cache_Manager::update_entry (HASH_MAP_ENTRY *&entry) { @@ -307,8 +299,7 @@ TAO_Transport_Cache_Manager::update_entry (HASH_MAP_ENTRY *&entry) } int -TAO_Transport_Cache_Manager::close_i (ACE_Handle_Set &reactor_registered, - TAO_EventHandlerSet &unregistered) +TAO_Transport_Cache_Manager::close_i (TAO_Connection_Handler_Set &handlers) { HASH_MAP_ITER end_iter = this->cache_map_.end (); @@ -322,10 +313,8 @@ TAO_Transport_Cache_Manager::close_i (ACE_Handle_Set &reactor_registered, if ((*iter).int_id_.recycle_state () != ACE_RECYCLABLE_CLOSED) { - // Get the transport to fill its associated connection's handle in - // the handle sets. - (*iter).int_id_.transport ()->provide_handle (reactor_registered, - unregistered); + // Get the transport to fill its associated connection's handler. + (*iter).int_id_.transport ()->provide_handler (handlers); // Inform the transport that has a reference to the entry in the // map that we are *gone* now. So, the transport should not use // the reference to the entry that he has, to acces us *at any @@ -463,12 +452,13 @@ TAO_Transport_Cache_Manager::purge (void) int count = 0; for(int i = 0; count < amount && i < sorted_size; i++) { - if (this->is_entry_idle(sorted_set[i])) + if (this->is_entry_idle (sorted_set[i])) { sorted_set[i]->int_id_.recycle_state (ACE_RECYCLABLE_BUSY); TAO_Transport* transport = sorted_set[i]->int_id_.transport (); - if (transports_to_be_closed.push (TAO_Transport::_duplicate(transport)) != 0) + transport->add_reference (); + if (transports_to_be_closed.push (transport) != 0) { ACE_DEBUG ((LM_INFO, ACE_TEXT ("TAO (%P|%t) - ") @@ -484,16 +474,6 @@ TAO_Transport_Cache_Manager::purge (void) transport->id ())); } - // We need to save the cache_map_entry before we - // set it to zero, so we can call purge_entry_i() - // after we call close_connection_no_purge (). - HASH_MAP_ENTRY* entry = transport->cache_map_entry (); - - // This is a bit ugly, but we must do this to - // avoid taking and giving locks inside this loop. - transport->cache_map_entry (0); - this->purge_entry_i (entry); - // Count this as a successful purged entry count++; } @@ -512,8 +492,10 @@ TAO_Transport_Cache_Manager::purge (void) if (transports_to_be_closed.pop (transport) == 0) { if (transport) - transport->close_connection_no_purge (); - TAO_Transport::release (transport); + { + transport->close_connection (); + transport->remove_reference (); + } } } diff --git a/TAO/tao/Transport_Cache_Manager.h b/TAO/tao/Transport_Cache_Manager.h index b1a0e43cfe4..d5d16c8c4ff 100644 --- a/TAO/tao/Transport_Cache_Manager.h +++ b/TAO/tao/Transport_Cache_Manager.h @@ -17,20 +17,14 @@ #include "tao/Cache_Entries.h" - #if !defined (ACE_LACKS_PRAGMA_ONCE) #define ACE_LACKS_PRAGMA_ONCE #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Hash_Map_Manager_T.h" #include "ace/Synch_T.h" -// #include "tao/TAO_Export.h" -// #include "tao/Cache_Entries.h" -// #include "tao/Connection_Purging_Strategy.h" - - class ACE_Handle_Set; -class ACE_Event_Handler; +class TAO_Connection_Handler; class TAO_ORB_Core; class TAO_Resource_Factory; class TAO_Connection_Purging_Strategy; @@ -39,9 +33,7 @@ template <class ACE_COND_MUTEX> class TAO_Condition; template <class T> class ACE_Unbounded_Set; template <class T> class ACE_Unbounded_Set_Iterator; -typedef ACE_Unbounded_Set<ACE_Event_Handler*> TAO_EventHandlerSet; -typedef ACE_Unbounded_Set_Iterator<ACE_Event_Handler*> - TAO_EventHandlerSetIterator; +typedef ACE_Unbounded_Set<TAO_Connection_Handler*> TAO_Connection_Handler_Set; /** * @class TAO_Transport_Cache_Manager @@ -119,10 +111,9 @@ public: /// strategy policy information. int update_entry (HASH_MAP_ENTRY *&entry); - /// Close the underlying hash map manager and return the handle set - /// that have been registered with the reactor - int close (ACE_Handle_Set &reactor_registered, - TAO_EventHandlerSet &unregistered); + /// Close the underlying hash map manager and return any handlers + /// still registered + int close (TAO_Connection_Handler_Set &handlers); /// Return the current size of the cache. size_t current_size (void) const; @@ -169,8 +160,7 @@ private: int make_idle_i (HASH_MAP_ENTRY *&entry); /// Non-locking version and actual implementation of close () - int close_i (ACE_Handle_Set &reactor_registered, - TAO_EventHandlerSet &unregistered); + int close_i (TAO_Connection_Handler_Set &handlers); /// 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 edb29408083..9163ef1907d 100644 --- a/TAO/tao/Transport_Cache_Manager.inl +++ b/TAO/tao/Transport_Cache_Manager.inl @@ -108,8 +108,7 @@ TAO_Transport_Cache_Manager::make_idle (HASH_MAP_ENTRY *&entry) ACE_INLINE int -TAO_Transport_Cache_Manager::close (ACE_Handle_Set &reactor_registered, - TAO_EventHandlerSet &unregistered) +TAO_Transport_Cache_Manager::close (TAO_Connection_Handler_Set &handlers) { // The cache lock pointer should only be zero if // Transport_Cache_Manager::open() was never called. Note that @@ -123,7 +122,7 @@ TAO_Transport_Cache_Manager::close (ACE_Handle_Set &reactor_registered, *this->cache_lock_, -1)); - return this->close_i (reactor_registered, unregistered); + return this->close_i (handlers); } diff --git a/TAO/tao/Wait_On_Read.cpp b/TAO/tao/Wait_On_Read.cpp index 572554525fb..36968e49e46 100644 --- a/TAO/tao/Wait_On_Read.cpp +++ b/TAO/tao/Wait_On_Read.cpp @@ -36,9 +36,9 @@ TAO_Wait_On_Read::wait (ACE_Time_Value * max_wait_time, while (1) { retval = - this->transport_->handle_input_i (rh, - max_wait_time, - 1); + this->transport_->handle_input (rh, + max_wait_time, + 1); // If we got our reply, no need to run the loop any // further. diff --git a/TAO/tao/tao.mpc b/TAO/tao/tao.mpc index 4fe533cb167..320491695e2 100644 --- a/TAO/tao/tao.mpc +++ b/TAO/tao/tao.mpc @@ -15,7 +15,6 @@ project(TAO) : acelib, taoversion, core, tao_output { Transport_Connector.cpp Transport.cpp Incoming_Message_Queue.cpp - Notify_Handler.cpp Resume_Handle.cpp Profile.cpp Endpoint.cpp diff --git a/TAO/tests/Bug_1361_Regression/Bug_1361_Regression.dsw b/TAO/tests/Bug_1361_Regression/Bug_1361_Regression.dsw new file mode 100644 index 00000000000..02e8e8ae61c --- /dev/null +++ b/TAO/tests/Bug_1361_Regression/Bug_1361_Regression.dsw @@ -0,0 +1,53 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "Bug_1361_Regression Client"=.\client.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "Bug_1361_Regression Server"=.\server.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "Bug_1361_Regression Shutdown"=.\shutdown.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/TAO/tests/Bug_1361_Regression/client.dsp b/TAO/tests/Bug_1361_Regression/client.dsp new file mode 100644 index 00000000000..4250d5c1a49 --- /dev/null +++ b/TAO/tests/Bug_1361_Regression/client.dsp @@ -0,0 +1,213 @@ +# Microsoft Developer Studio Project File - Name="Bug_1361_Regression Client" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Bug_1361_Regression Client - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "client.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "client.mak" CFG="Bug_1361_Regression Client - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Bug_1361_Regression Client - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Bug_1361_Regression Client - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Bug_1361_Regression Client - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "..\..\.." /I "..\.." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib TAO.lib TAO_PortableServer.lib TAO_Messaging.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\ace" /libpath:"..\..\tao" /libpath:"..\..\tao\PortableServer" /libpath:"..\..\tao\Messaging"
+
+!ELSEIF "$(CFG)" == "Bug_1361_Regression Client - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /Zi /Od /I "..\..\.." /I "..\.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib TAOd.lib TAO_PortableServerd.lib TAO_Messagingd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\ace" /libpath:"..\..\tao" /libpath:"..\..\tao\PortableServer" /libpath:"..\..\tao\Messaging"
+
+!ENDIF
+
+# Begin Target
+
+# Name "Bug_1361_Regression Client - Win32 Release"
+# Name "Bug_1361_Regression Client - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\client.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ORB_Task.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Echo.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\testC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\testS.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Client_Task.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Echo.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\testC.h
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter "idl"
+# Begin Source File
+
+SOURCE=.\test.idl
+
+!IF "$(CFG)" == "Bug_1361_Regression Client - Win32 Release"
+
+USERDEP__TEST_="..\..\..\bin\Release\tao_idl.exe"
+# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputPath)
+InputPath=.\test.idl
+InputName=test
+
+BuildCmds= \
+ ..\..\..\bin\Release\tao_idl -Ge 1 $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "Bug_1361_Regression Client - Win32 Debug"
+
+USERDEP__TEST_="..\..\..\bin\tao_idl.exe"
+# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputPath)
+InputPath=.\test.idl
+InputName=test
+
+BuildCmds= \
+ ..\..\..\bin\tao_idl -Ge 1 $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/tests/Bug_1361_Regression/server.dsp b/TAO/tests/Bug_1361_Regression/server.dsp new file mode 100644 index 00000000000..5ba5a906b61 --- /dev/null +++ b/TAO/tests/Bug_1361_Regression/server.dsp @@ -0,0 +1,219 @@ +# Microsoft Developer Studio Project File - Name="Bug_1361_Regression Server" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Bug_1361_Regression Server - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "server.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "server.mak" CFG="Bug_1361_Regression Server - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Bug_1361_Regression Server - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Bug_1361_Regression Server - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Bug_1361_Regression Server - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "..\..\.." /I "..\.." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib TAO.lib TAO_PortableServer.lib TAO_Messaging.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\ace" /libpath:"..\..\tao" /libpath:"..\..\tao\PortableServer" /libpath:"..\..\tao\Messaging"
+
+!ELSEIF "$(CFG)" == "Bug_1361_Regression Server - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "server___Win32_Debug"
+# PROP BASE Intermediate_Dir "server___Win32_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /Zi /Od /I "..\..\.." /I "..\.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib TAOd.lib TAO_PortableServerd.lib TAO_Messagingd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\ace" /libpath:"..\..\tao" /libpath:"..\..\tao\PortableServer" /libpath:"..\..\tao\Messaging"
+
+!ENDIF
+
+# Begin Target
+
+# Name "Bug_1361_Regression Server - Win32 Release"
+# Name "Bug_1361_Regression Server - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Echo_Caller.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ORB_Task.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\server.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\Server_Thread_Pool.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\testC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\testS.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\Echo_Caller.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\Server_Task.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\testS.h
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\test.idl
+
+!IF "$(CFG)" == "Bug_1361_Regression Server - Win32 Release"
+
+USERDEP__TEST_="..\..\..\bin\Release\tao_idl.exe"
+# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputPath)
+InputPath=.\test.idl
+InputName=test
+
+BuildCmds= \
+ ..\..\..\bin\Release\tao_idl -Ge 1 $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "Bug_1361_Regression Server - Win32 Debug"
+
+USERDEP__TEST_="..\..\..\bin\tao_idl.exe"
+# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputPath)
+InputPath=.\test.idl
+InputName=test
+
+BuildCmds= \
+ ..\..\..\bin\tao_idl -Ge 1 $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/tests/Bug_1361_Regression/shutdown.dsp b/TAO/tests/Bug_1361_Regression/shutdown.dsp new file mode 100644 index 00000000000..2022fb10844 --- /dev/null +++ b/TAO/tests/Bug_1361_Regression/shutdown.dsp @@ -0,0 +1,193 @@ +# Microsoft Developer Studio Project File - Name="Bug_1361_Regression Shutdown" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Bug_1361_Regression Shutdown - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "shutdown.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "shutdown.mak" CFG="Bug_1361_Regression Shutdown - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Bug_1361_Regression Shutdown - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Bug_1361_Regression Shutdown - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Bug_1361_Regression Shutdown - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "..\..\.." /I "..\.." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib TAO.lib TAO_PortableServer.lib TAO_Messaging.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\ace" /libpath:"..\..\tao" /libpath:"..\..\tao\PortableServer" /libpath:"..\..\tao\Messaging"
+
+!ELSEIF "$(CFG)" == "Bug_1361_Regression Shutdown - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /Zi /Od /I "..\..\.." /I "..\.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib TAOd.lib TAO_PortableServerd.lib TAO_Messagingd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\ace" /libpath:"..\..\tao" /libpath:"..\..\tao\PortableServer" /libpath:"..\..\tao\Messaging"
+
+!ENDIF
+
+# Begin Target
+
+# Name "Bug_1361_Regression Shutdown - Win32 Release"
+# Name "Bug_1361_Regression Shutdown - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\shutdown.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\testC.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\testC.h
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter "idl"
+# Begin Source File
+
+SOURCE=.\test.idl
+
+!IF "$(CFG)" == "Bug_1361_Regression Shutdown - Win32 Release"
+
+USERDEP__TEST_="..\..\..\bin\Release\tao_idl.exe"
+# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputPath)
+InputPath=.\test.idl
+InputName=test
+
+BuildCmds= \
+ ..\..\..\bin\Release\tao_idl -Ge 1 $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "Bug_1361_Regression Shutdown - Win32 Debug"
+
+USERDEP__TEST_="..\..\..\bin\tao_idl.exe"
+# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputPath)
+InputPath=.\test.idl
+InputName=test
+
+BuildCmds= \
+ ..\..\..\bin\tao_idl -Ge 1 $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/tests/Connection_Failure/Connection_Failure.dsw b/TAO/tests/Connection_Failure/Connection_Failure.dsw new file mode 100644 index 00000000000..98381b77d92 --- /dev/null +++ b/TAO/tests/Connection_Failure/Connection_Failure.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "Connection_Failure Client"=.\client.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/TAO/tests/Connection_Failure/Connection_Failure.mpc b/TAO/tests/Connection_Failure/Connection_Failure.mpc new file mode 100644 index 00000000000..5cf9dd225d2 --- /dev/null +++ b/TAO/tests/Connection_Failure/Connection_Failure.mpc @@ -0,0 +1,9 @@ +project(*client): messaging, taoserver { + exename = client + + Source_Files { + testC.cpp + client.cpp + } +} + diff --git a/TAO/tests/Connection_Failure/Makefile b/TAO/tests/Connection_Failure/Makefile new file mode 100644 index 00000000000..0b24fa415ea --- /dev/null +++ b/TAO/tests/Connection_Failure/Makefile @@ -0,0 +1,700 @@ +#---------------------------------------------------------------------------- +# +# $Id$ +# +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# Local macros +#---------------------------------------------------------------------------- + +ifndef TAO_ROOT + TAO_ROOT = $(ACE_ROOT)/TAO +endif # ! TAO_ROOT + +IDL_FILES = test +IDL_SRC = testC.cpp +BIN = client + +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(TAO_ROOT)/rules.tao.GNU + +SRC = $(addsuffix .cpp, $(BIN)) $(IDL_SRC) + +CLIENT_OBJS = client.o testC.o + + +TAO_IDLFLAGS += -Ge 1 +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- + +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU +include $(TAO_ROOT)/taoconfig.mk + +#---------------------------------------------------------------------------- +# Local targets +#---------------------------------------------------------------------------- + +.PRECIOUS: $(foreach ext, $(IDL_EXT), test$(ext)) + +client: $(addprefix $(VDIR),$(CLIENT_OBJS)) + $(LINK.cc) $(LDFLAGS) -o $@ $^ $(TAO_CLNT_LIBS) $(POSTLINK) + +realclean: clean + -$(RM) $(foreach ext, $(IDL_EXT), test$(ext)) + +# DO NOT DELETE THIS LINE -- g++dep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. + + +.obj/client.o .obj/client.so .shobj/client.o .shobj/client.so: client.cpp testC.h \ + $(TAO_ROOT)/tao/corba.h \ + $(ACE_ROOT)/ace/pre.h \ + $(ACE_ROOT)/ace/post.h \ + $(ACE_ROOT)/ace/ace_wchar.h \ + $(ACE_ROOT)/ace/ace_wchar.inl \ + $(TAO_ROOT)/tao/corbafwd.h \ + $(ACE_ROOT)/ace/CDR_Base.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/ACE_export.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/Default_Constants.h \ + $(ACE_ROOT)/ace/CDR_Base.inl \ + $(TAO_ROOT)/tao/orbconf.h \ + $(ACE_ROOT)/ace/Global_Macros.h \ + $(ACE_ROOT)/ace/OS_Export.h \ + $(TAO_ROOT)/tao/TAO_Export.h \ + $(ACE_ROOT)/ace/OS_Memory.h \ + $(ACE_ROOT)/ace/OS_Errno.h \ + $(ACE_ROOT)/ace/OS_Errno.inl \ + $(ACE_ROOT)/ace/OS_Memory.inl \ + $(TAO_ROOT)/tao/corbafwd.i \ + $(TAO_ROOT)/tao/Typecode.h \ + $(ACE_ROOT)/ace/Hash_Map_Manager_T.h \ + $(ACE_ROOT)/ace/Functor.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/OS_Dirent.h \ + $(ACE_ROOT)/ace/OS_Dirent.inl \ + $(ACE_ROOT)/ace/OS_String.h \ + $(ACE_ROOT)/ace/OS_String.inl \ + $(ACE_ROOT)/ace/OS_TLI.h \ + $(ACE_ROOT)/ace/OS_TLI.inl \ + $(ACE_ROOT)/ace/Time_Value.h \ + $(ACE_ROOT)/ace/Time_Value.inl \ + $(ACE_ROOT)/ace/Min_Max.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Flag_Manip.h \ + $(ACE_ROOT)/ace/Flag_Manip.i \ + $(ACE_ROOT)/ace/Handle_Ops.h \ + $(ACE_ROOT)/ace/Handle_Ops.i \ + $(ACE_ROOT)/ace/Lib_Find.h \ + $(ACE_ROOT)/ace/Lib_Find.i \ + $(ACE_ROOT)/ace/Init_ACE.h \ + $(ACE_ROOT)/ace/Init_ACE.i \ + $(ACE_ROOT)/ace/Sock_Connect.h \ + $(ACE_ROOT)/ace/Sock_Connect.i \ + $(ACE_ROOT)/ace/ACE.i \ + $(ACE_ROOT)/ace/Functor.i \ + $(ACE_ROOT)/ace/Functor_T.h \ + $(ACE_ROOT)/ace/Functor_T.i \ + $(ACE_ROOT)/ace/Functor_T.cpp \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/OS_Log_Msg_Attributes.h \ + $(ACE_ROOT)/ace/OS_Log_Msg_Attributes.inl \ + $(ACE_ROOT)/ace/Hash_Map_Manager_T.i \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread_Adapter.h \ + $(ACE_ROOT)/ace/Base_Thread_Adapter.h \ + $(ACE_ROOT)/ace/Base_Thread_Adapter.inl \ + $(ACE_ROOT)/ace/Thread_Adapter.inl \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ + $(ACE_ROOT)/ace/Hash_Map_Manager_T.cpp \ + $(ACE_ROOT)/ace/Service_Config.h \ + $(ACE_ROOT)/ace/Unbounded_Queue.h \ + $(ACE_ROOT)/ace/Node.h \ + $(ACE_ROOT)/ace/Node.cpp \ + $(ACE_ROOT)/ace/Unbounded_Queue.inl \ + $(ACE_ROOT)/ace/Unbounded_Queue.cpp \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Unbounded_Set.h \ + $(ACE_ROOT)/ace/Unbounded_Set.inl \ + $(ACE_ROOT)/ace/Unbounded_Set.cpp \ + $(ACE_ROOT)/ace/SString.h \ + $(ACE_ROOT)/ace/SStringfwd.h \ + $(ACE_ROOT)/ace/String_Base.h \ + $(ACE_ROOT)/ace/String_Base_Const.h \ + $(ACE_ROOT)/ace/String_Base.i \ + $(ACE_ROOT)/ace/String_Base.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Malloc_Allocator.h \ + $(ACE_ROOT)/ace/Malloc_Allocator.i \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Memory_Pool.i \ + $(ACE_ROOT)/ace/Auto_Ptr.h \ + $(ACE_ROOT)/ace/Auto_Ptr.i \ + $(ACE_ROOT)/ace/Auto_Ptr.cpp \ + $(ACE_ROOT)/ace/SString.i \ + $(ACE_ROOT)/ace/XML_Svc_Conf.h \ + $(ACE_ROOT)/ace/Service_Config.i \ + $(ACE_ROOT)/ace/Reactor.h \ + $(ACE_ROOT)/ace/Handle_Set.h \ + $(ACE_ROOT)/ace/Handle_Set.i \ + $(ACE_ROOT)/ace/Timer_Queue.h \ + $(ACE_ROOT)/ace/Timer_Queue_T.h \ + $(ACE_ROOT)/ace/Test_and_Set.h \ + $(ACE_ROOT)/ace/Test_and_Set.i \ + $(ACE_ROOT)/ace/Test_and_Set.cpp \ + $(ACE_ROOT)/ace/Timer_Queue_T.i \ + $(ACE_ROOT)/ace/Timer_Queue_T.cpp \ + $(ACE_ROOT)/ace/Reactor.i \ + $(ACE_ROOT)/ace/Reactor_Impl.h \ + $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \ + $(TAO_ROOT)/tao/Exception.h \ + $(ACE_ROOT)/ace/CORBA_macros.h \ + $(ACE_ROOT)/ace/Exception_Macros.h \ + $(ACE_ROOT)/ace/iosfwd.h \ + $(TAO_ROOT)/tao/Exception.i \ + $(TAO_ROOT)/tao/Pseudo_VarOut_T.h \ + $(TAO_ROOT)/tao/Pseudo_VarOut_T.inl \ + $(TAO_ROOT)/tao/Pseudo_VarOut_T.cpp \ + $(TAO_ROOT)/tao/Typecode.i \ + $(TAO_ROOT)/tao/Any_Impl_T.h \ + $(TAO_ROOT)/tao/Any.h \ + $(ACE_ROOT)/ace/CDR_Stream.h \ + $(ACE_ROOT)/ace/Message_Block.h \ + $(ACE_ROOT)/ace/Message_Block.i \ + $(ACE_ROOT)/ace/Message_Block_T.h \ + $(ACE_ROOT)/ace/Message_Block_T.i \ + $(ACE_ROOT)/ace/Message_Block_T.cpp \ + $(ACE_ROOT)/ace/CDR_Stream.i \ + $(TAO_ROOT)/tao/Object.h \ + $(TAO_ROOT)/tao/Policy_ForwardC.h \ + $(TAO_ROOT)/tao/Sequence.h \ + $(TAO_ROOT)/tao/Managed_Types.h \ + $(TAO_ROOT)/tao/Managed_Types.i \ + $(TAO_ROOT)/tao/Sequence.i \ + $(TAO_ROOT)/tao/Sequence_T.h \ + $(TAO_ROOT)/tao/Sequence_T.i \ + $(TAO_ROOT)/tao/Sequence_T.cpp \ + $(TAO_ROOT)/tao/Environment.h \ + $(TAO_ROOT)/tao/Environment.i \ + $(TAO_ROOT)/tao/CDR.h \ + $(TAO_ROOT)/tao/CDR.i \ + $(TAO_ROOT)/tao/Objref_VarOut_T.h \ + $(TAO_ROOT)/tao/varbase.h \ + $(TAO_ROOT)/tao/Objref_VarOut_T.inl \ + $(TAO_ROOT)/tao/Objref_VarOut_T.cpp \ + $(TAO_ROOT)/tao/Seq_Var_T.h \ + $(TAO_ROOT)/tao/Seq_Var_T.inl \ + $(TAO_ROOT)/tao/Seq_Var_T.cpp \ + $(TAO_ROOT)/tao/Seq_Out_T.h \ + $(TAO_ROOT)/tao/Seq_Out_T.inl \ + $(TAO_ROOT)/tao/Seq_Out_T.cpp \ + $(TAO_ROOT)/tao/Policy_ForwardC.i \ + $(TAO_ROOT)/tao/Object_KeyC.h \ + $(TAO_ROOT)/tao/Object_KeyC.i \ + $(TAO_ROOT)/tao/IOP_IORC.h \ + $(TAO_ROOT)/tao/OctetSeqC.h \ + $(TAO_ROOT)/tao/OctetSeqC.i \ + $(TAO_ROOT)/tao/VarOut_T.h \ + $(TAO_ROOT)/tao/VarOut_T.inl \ + $(TAO_ROOT)/tao/VarOut_T.cpp \ + $(TAO_ROOT)/tao/IOP_IORC.i \ + $(TAO_ROOT)/tao/Object.i \ + $(TAO_ROOT)/tao/Any.i \ + $(TAO_ROOT)/tao/Any_Impl_T.inl \ + $(TAO_ROOT)/tao/Any_Impl_T.cpp \ + $(TAO_ROOT)/tao/Marshal.h \ + $(TAO_ROOT)/tao/Marshal.i \ + $(TAO_ROOT)/tao/debug.h \ + $(TAO_ROOT)/tao/Any_Basic_Impl_T.h \ + $(TAO_ROOT)/tao/Any_Basic_Impl_T.inl \ + $(TAO_ROOT)/tao/Any_Basic_Impl_T.cpp \ + $(TAO_ROOT)/tao/Any_Special_Impl_T.h \ + $(TAO_ROOT)/tao/Any_Special_Impl_T.inl \ + $(TAO_ROOT)/tao/Any_Special_Impl_T.cpp \ + $(TAO_ROOT)/tao/Any_Special_Basic_Impl_T.h \ + $(TAO_ROOT)/tao/Any_Special_Basic_Impl_T.inl \ + $(TAO_ROOT)/tao/Any_Special_Basic_Impl_T.cpp \ + $(TAO_ROOT)/tao/Any_Array_Impl_T.h \ + $(TAO_ROOT)/tao/Any_Array_Impl_T.inl \ + $(TAO_ROOT)/tao/Any_Array_Impl_T.cpp \ + $(TAO_ROOT)/tao/Any_Dual_Impl_T.h \ + $(TAO_ROOT)/tao/Any_Dual_Impl_T.inl \ + $(TAO_ROOT)/tao/Any_Dual_Impl_T.cpp \ + $(TAO_ROOT)/tao/NVList.h \ + $(TAO_ROOT)/tao/NVList.i \ + $(TAO_ROOT)/tao/LocalObject.h \ + $(TAO_ROOT)/tao/LocalObject.i \ + $(TAO_ROOT)/tao/Principal.h \ + $(TAO_ROOT)/tao/Principal.i \ + $(TAO_ROOT)/tao/ORB.h \ + $(TAO_ROOT)/tao/ServicesC.h \ + $(TAO_ROOT)/tao/ServicesC.i \ + $(TAO_ROOT)/tao/CORBA_String.h \ + $(TAO_ROOT)/tao/CORBA_String.inl \ + $(TAO_ROOT)/tao/ObjectIdListC.h \ + $(TAO_ROOT)/tao/ObjectIdListC.i \ + $(TAO_ROOT)/tao/objectid.h \ + $(TAO_ROOT)/tao/PolicyC.h \ + $(TAO_ROOT)/tao/CurrentC.h \ + $(TAO_ROOT)/tao/CurrentC.i \ + $(TAO_ROOT)/tao/Remote_Object_Proxy_Impl.h \ + $(TAO_ROOT)/tao/Object_Proxy_Impl.h \ + $(TAO_ROOT)/tao/PolicyC.i \ + $(TAO_ROOT)/tao/ORB.i \ + $(TAO_ROOT)/tao/BoundsC.h \ + $(TAO_ROOT)/tao/BoundsC.i \ + $(TAO_ROOT)/tao/DomainC.h \ + $(TAO_ROOT)/tao/DomainC.i \ + $(TAO_ROOT)/tao/WrongTransactionC.h \ + $(TAO_ROOT)/tao/WrongTransactionC.i \ + $(TAO_ROOT)/tao/Array_VarOut_T.h \ + $(TAO_ROOT)/tao/Array_VarOut_T.inl \ + $(TAO_ROOT)/tao/Array_VarOut_T.cpp \ + $(TAO_ROOT)/tao/StringSeqC.h \ + $(TAO_ROOT)/tao/StringSeqC.i \ + $(TAO_ROOT)/tao/PortableInterceptorC.h \ + $(TAO_ROOT)/tao/PI_ForwardC.h \ + $(TAO_ROOT)/tao/PI_ForwardC.i \ + $(TAO_ROOT)/tao/DynamicC.h \ + $(TAO_ROOT)/tao/DynamicC.i \ + $(TAO_ROOT)/tao/Messaging_SyncScopeC.h \ + $(TAO_ROOT)/tao/Messaging_SyncScopeC.i \ + $(TAO_ROOT)/tao/IOPC.h \ + $(TAO_ROOT)/tao/IOP_CodecC.h \ + $(TAO_ROOT)/tao/IOP_CodecC.i \ + $(TAO_ROOT)/tao/IOPC.i \ + $(TAO_ROOT)/tao/PortableInterceptorC.i \ + testC.i \ + $(ACE_ROOT)/ace/Get_Opt.h \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers_T.h \ + $(ACE_ROOT)/ace/Array_Base.h \ + $(ACE_ROOT)/ace/Array_Base.inl \ + $(ACE_ROOT)/ace/Array_Base.cpp \ + $(ACE_ROOT)/ace/Containers_T.i \ + $(ACE_ROOT)/ace/Containers_T.cpp \ + $(ACE_ROOT)/ace/Get_Opt.i \ + $(ACE_ROOT)/ace/Profile_Timer.h \ + $(ACE_ROOT)/ace/High_Res_Timer.h \ + $(ACE_ROOT)/ace/High_Res_Timer.i \ + $(ACE_ROOT)/ace/Profile_Timer.i \ + $(TAO_ROOT)/tao/Messaging/Messaging.h \ + $(TAO_ROOT)/tao/Messaging/messaging_export.h \ + $(TAO_ROOT)/tao/Messaging/MessagingC.h \ + $(TAO_ROOT)/tao/Messaging/Messaging_SyncScope_PolicyC.h \ + $(TAO_ROOT)/tao/Messaging/Messaging_SyncScope_PolicyC.i \ + $(TAO_ROOT)/tao/Messaging/Messaging_RT_PolicyC.h \ + $(TAO_ROOT)/tao/TimeBaseC.h \ + $(TAO_ROOT)/tao/TimeBaseC.i \ + $(TAO_ROOT)/tao/Messaging/Messaging_RT_PolicyC.i \ + $(TAO_ROOT)/tao/Messaging/Messaging_No_ImplC.h \ + $(TAO_ROOT)/tao/Messaging/Messaging_No_ImplC.i \ + $(TAO_ROOT)/tao/Valuetype/Value_VarOut_T.h \ + $(TAO_ROOT)/tao/Valuetype/Value_VarOut_T.inl \ + $(TAO_ROOT)/tao/Valuetype/Value_VarOut_T.cpp \ + $(TAO_ROOT)/tao/Valuetype/ValueBase.h \ + $(TAO_ROOT)/tao/Valuetype/valuetype_export.h \ + $(TAO_ROOT)/tao/Valuetype/ValueBase.inl \ + $(TAO_ROOT)/tao/Valuetype/ValueFactory.h \ + $(TAO_ROOT)/tao/Valuetype/ValueFactory.inl \ + $(TAO_ROOT)/tao/Messaging/MessagingC.i \ + $(TAO_ROOT)/tao/Messaging/TAO_ExtC.h \ + $(TAO_ROOT)/tao/Messaging/TAO_ExtC.i \ + $(TAO_ROOT)/tao/TAOC.h \ + $(TAO_ROOT)/tao/TAOC.i + +.obj/testC.o .obj/testC.so .shobj/testC.o .shobj/testC.so: testC.cpp testC.h \ + $(TAO_ROOT)/tao/corba.h \ + $(ACE_ROOT)/ace/pre.h \ + $(ACE_ROOT)/ace/post.h \ + $(ACE_ROOT)/ace/ace_wchar.h \ + $(ACE_ROOT)/ace/ace_wchar.inl \ + $(TAO_ROOT)/tao/corbafwd.h \ + $(ACE_ROOT)/ace/CDR_Base.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/ACE_export.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/Default_Constants.h \ + $(ACE_ROOT)/ace/CDR_Base.inl \ + $(TAO_ROOT)/tao/orbconf.h \ + $(ACE_ROOT)/ace/Global_Macros.h \ + $(ACE_ROOT)/ace/OS_Export.h \ + $(TAO_ROOT)/tao/TAO_Export.h \ + $(ACE_ROOT)/ace/OS_Memory.h \ + $(ACE_ROOT)/ace/OS_Errno.h \ + $(ACE_ROOT)/ace/OS_Errno.inl \ + $(ACE_ROOT)/ace/OS_Memory.inl \ + $(TAO_ROOT)/tao/corbafwd.i \ + $(TAO_ROOT)/tao/Typecode.h \ + $(ACE_ROOT)/ace/Hash_Map_Manager_T.h \ + $(ACE_ROOT)/ace/Functor.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/OS_Dirent.h \ + $(ACE_ROOT)/ace/OS_Dirent.inl \ + $(ACE_ROOT)/ace/OS_String.h \ + $(ACE_ROOT)/ace/OS_String.inl \ + $(ACE_ROOT)/ace/OS_TLI.h \ + $(ACE_ROOT)/ace/OS_TLI.inl \ + $(ACE_ROOT)/ace/Time_Value.h \ + $(ACE_ROOT)/ace/Time_Value.inl \ + $(ACE_ROOT)/ace/Min_Max.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Flag_Manip.h \ + $(ACE_ROOT)/ace/Flag_Manip.i \ + $(ACE_ROOT)/ace/Handle_Ops.h \ + $(ACE_ROOT)/ace/Handle_Ops.i \ + $(ACE_ROOT)/ace/Lib_Find.h \ + $(ACE_ROOT)/ace/Lib_Find.i \ + $(ACE_ROOT)/ace/Init_ACE.h \ + $(ACE_ROOT)/ace/Init_ACE.i \ + $(ACE_ROOT)/ace/Sock_Connect.h \ + $(ACE_ROOT)/ace/Sock_Connect.i \ + $(ACE_ROOT)/ace/ACE.i \ + $(ACE_ROOT)/ace/Functor.i \ + $(ACE_ROOT)/ace/Functor_T.h \ + $(ACE_ROOT)/ace/Functor_T.i \ + $(ACE_ROOT)/ace/Functor_T.cpp \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/OS_Log_Msg_Attributes.h \ + $(ACE_ROOT)/ace/OS_Log_Msg_Attributes.inl \ + $(ACE_ROOT)/ace/Hash_Map_Manager_T.i \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread_Adapter.h \ + $(ACE_ROOT)/ace/Base_Thread_Adapter.h \ + $(ACE_ROOT)/ace/Base_Thread_Adapter.inl \ + $(ACE_ROOT)/ace/Thread_Adapter.inl \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ + $(ACE_ROOT)/ace/Hash_Map_Manager_T.cpp \ + $(ACE_ROOT)/ace/Service_Config.h \ + $(ACE_ROOT)/ace/Unbounded_Queue.h \ + $(ACE_ROOT)/ace/Node.h \ + $(ACE_ROOT)/ace/Node.cpp \ + $(ACE_ROOT)/ace/Unbounded_Queue.inl \ + $(ACE_ROOT)/ace/Unbounded_Queue.cpp \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Unbounded_Set.h \ + $(ACE_ROOT)/ace/Unbounded_Set.inl \ + $(ACE_ROOT)/ace/Unbounded_Set.cpp \ + $(ACE_ROOT)/ace/SString.h \ + $(ACE_ROOT)/ace/SStringfwd.h \ + $(ACE_ROOT)/ace/String_Base.h \ + $(ACE_ROOT)/ace/String_Base_Const.h \ + $(ACE_ROOT)/ace/String_Base.i \ + $(ACE_ROOT)/ace/String_Base.cpp \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Malloc_Allocator.h \ + $(ACE_ROOT)/ace/Malloc_Allocator.i \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Memory_Pool.i \ + $(ACE_ROOT)/ace/Auto_Ptr.h \ + $(ACE_ROOT)/ace/Auto_Ptr.i \ + $(ACE_ROOT)/ace/Auto_Ptr.cpp \ + $(ACE_ROOT)/ace/SString.i \ + $(ACE_ROOT)/ace/XML_Svc_Conf.h \ + $(ACE_ROOT)/ace/Service_Config.i \ + $(ACE_ROOT)/ace/Reactor.h \ + $(ACE_ROOT)/ace/Handle_Set.h \ + $(ACE_ROOT)/ace/Handle_Set.i \ + $(ACE_ROOT)/ace/Timer_Queue.h \ + $(ACE_ROOT)/ace/Timer_Queue_T.h \ + $(ACE_ROOT)/ace/Test_and_Set.h \ + $(ACE_ROOT)/ace/Test_and_Set.i \ + $(ACE_ROOT)/ace/Test_and_Set.cpp \ + $(ACE_ROOT)/ace/Timer_Queue_T.i \ + $(ACE_ROOT)/ace/Timer_Queue_T.cpp \ + $(ACE_ROOT)/ace/Reactor.i \ + $(ACE_ROOT)/ace/Reactor_Impl.h \ + $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \ + $(TAO_ROOT)/tao/Exception.h \ + $(ACE_ROOT)/ace/CORBA_macros.h \ + $(ACE_ROOT)/ace/Exception_Macros.h \ + $(ACE_ROOT)/ace/iosfwd.h \ + $(TAO_ROOT)/tao/Exception.i \ + $(TAO_ROOT)/tao/Pseudo_VarOut_T.h \ + $(TAO_ROOT)/tao/Pseudo_VarOut_T.inl \ + $(TAO_ROOT)/tao/Pseudo_VarOut_T.cpp \ + $(TAO_ROOT)/tao/Typecode.i \ + $(TAO_ROOT)/tao/Any_Impl_T.h \ + $(TAO_ROOT)/tao/Any.h \ + $(ACE_ROOT)/ace/CDR_Stream.h \ + $(ACE_ROOT)/ace/Message_Block.h \ + $(ACE_ROOT)/ace/Message_Block.i \ + $(ACE_ROOT)/ace/Message_Block_T.h \ + $(ACE_ROOT)/ace/Message_Block_T.i \ + $(ACE_ROOT)/ace/Message_Block_T.cpp \ + $(ACE_ROOT)/ace/CDR_Stream.i \ + $(TAO_ROOT)/tao/Object.h \ + $(TAO_ROOT)/tao/Policy_ForwardC.h \ + $(TAO_ROOT)/tao/Sequence.h \ + $(TAO_ROOT)/tao/Managed_Types.h \ + $(TAO_ROOT)/tao/Managed_Types.i \ + $(TAO_ROOT)/tao/Sequence.i \ + $(TAO_ROOT)/tao/Sequence_T.h \ + $(TAO_ROOT)/tao/Sequence_T.i \ + $(TAO_ROOT)/tao/Sequence_T.cpp \ + $(TAO_ROOT)/tao/Environment.h \ + $(TAO_ROOT)/tao/Environment.i \ + $(TAO_ROOT)/tao/CDR.h \ + $(TAO_ROOT)/tao/CDR.i \ + $(TAO_ROOT)/tao/Objref_VarOut_T.h \ + $(TAO_ROOT)/tao/varbase.h \ + $(TAO_ROOT)/tao/Objref_VarOut_T.inl \ + $(TAO_ROOT)/tao/Objref_VarOut_T.cpp \ + $(TAO_ROOT)/tao/Seq_Var_T.h \ + $(TAO_ROOT)/tao/Seq_Var_T.inl \ + $(TAO_ROOT)/tao/Seq_Var_T.cpp \ + $(TAO_ROOT)/tao/Seq_Out_T.h \ + $(TAO_ROOT)/tao/Seq_Out_T.inl \ + $(TAO_ROOT)/tao/Seq_Out_T.cpp \ + $(TAO_ROOT)/tao/Policy_ForwardC.i \ + $(TAO_ROOT)/tao/Object_KeyC.h \ + $(TAO_ROOT)/tao/Object_KeyC.i \ + $(TAO_ROOT)/tao/IOP_IORC.h \ + $(TAO_ROOT)/tao/OctetSeqC.h \ + $(TAO_ROOT)/tao/OctetSeqC.i \ + $(TAO_ROOT)/tao/VarOut_T.h \ + $(TAO_ROOT)/tao/VarOut_T.inl \ + $(TAO_ROOT)/tao/VarOut_T.cpp \ + $(TAO_ROOT)/tao/IOP_IORC.i \ + $(TAO_ROOT)/tao/Object.i \ + $(TAO_ROOT)/tao/Any.i \ + $(TAO_ROOT)/tao/Any_Impl_T.inl \ + $(TAO_ROOT)/tao/Any_Impl_T.cpp \ + $(TAO_ROOT)/tao/Marshal.h \ + $(TAO_ROOT)/tao/Marshal.i \ + $(TAO_ROOT)/tao/debug.h \ + $(TAO_ROOT)/tao/Any_Basic_Impl_T.h \ + $(TAO_ROOT)/tao/Any_Basic_Impl_T.inl \ + $(TAO_ROOT)/tao/Any_Basic_Impl_T.cpp \ + $(TAO_ROOT)/tao/Any_Special_Impl_T.h \ + $(TAO_ROOT)/tao/Any_Special_Impl_T.inl \ + $(TAO_ROOT)/tao/Any_Special_Impl_T.cpp \ + $(TAO_ROOT)/tao/Any_Special_Basic_Impl_T.h \ + $(TAO_ROOT)/tao/Any_Special_Basic_Impl_T.inl \ + $(TAO_ROOT)/tao/Any_Special_Basic_Impl_T.cpp \ + $(TAO_ROOT)/tao/Any_Array_Impl_T.h \ + $(TAO_ROOT)/tao/Any_Array_Impl_T.inl \ + $(TAO_ROOT)/tao/Any_Array_Impl_T.cpp \ + $(TAO_ROOT)/tao/Any_Dual_Impl_T.h \ + $(TAO_ROOT)/tao/Any_Dual_Impl_T.inl \ + $(TAO_ROOT)/tao/Any_Dual_Impl_T.cpp \ + $(TAO_ROOT)/tao/NVList.h \ + $(TAO_ROOT)/tao/NVList.i \ + $(TAO_ROOT)/tao/LocalObject.h \ + $(TAO_ROOT)/tao/LocalObject.i \ + $(TAO_ROOT)/tao/Principal.h \ + $(TAO_ROOT)/tao/Principal.i \ + $(TAO_ROOT)/tao/ORB.h \ + $(TAO_ROOT)/tao/ServicesC.h \ + $(TAO_ROOT)/tao/ServicesC.i \ + $(TAO_ROOT)/tao/CORBA_String.h \ + $(TAO_ROOT)/tao/CORBA_String.inl \ + $(TAO_ROOT)/tao/ObjectIdListC.h \ + $(TAO_ROOT)/tao/ObjectIdListC.i \ + $(TAO_ROOT)/tao/objectid.h \ + $(TAO_ROOT)/tao/PolicyC.h \ + $(TAO_ROOT)/tao/CurrentC.h \ + $(TAO_ROOT)/tao/CurrentC.i \ + $(TAO_ROOT)/tao/Remote_Object_Proxy_Impl.h \ + $(TAO_ROOT)/tao/Object_Proxy_Impl.h \ + $(TAO_ROOT)/tao/PolicyC.i \ + $(TAO_ROOT)/tao/ORB.i \ + $(TAO_ROOT)/tao/BoundsC.h \ + $(TAO_ROOT)/tao/BoundsC.i \ + $(TAO_ROOT)/tao/DomainC.h \ + $(TAO_ROOT)/tao/DomainC.i \ + $(TAO_ROOT)/tao/WrongTransactionC.h \ + $(TAO_ROOT)/tao/WrongTransactionC.i \ + $(TAO_ROOT)/tao/Array_VarOut_T.h \ + $(TAO_ROOT)/tao/Array_VarOut_T.inl \ + $(TAO_ROOT)/tao/Array_VarOut_T.cpp \ + $(TAO_ROOT)/tao/StringSeqC.h \ + $(TAO_ROOT)/tao/StringSeqC.i \ + $(TAO_ROOT)/tao/PortableInterceptorC.h \ + $(TAO_ROOT)/tao/PI_ForwardC.h \ + $(TAO_ROOT)/tao/PI_ForwardC.i \ + $(TAO_ROOT)/tao/DynamicC.h \ + $(TAO_ROOT)/tao/DynamicC.i \ + $(TAO_ROOT)/tao/Messaging_SyncScopeC.h \ + $(TAO_ROOT)/tao/Messaging_SyncScopeC.i \ + $(TAO_ROOT)/tao/IOPC.h \ + $(TAO_ROOT)/tao/IOP_CodecC.h \ + $(TAO_ROOT)/tao/IOP_CodecC.i \ + $(TAO_ROOT)/tao/IOPC.i \ + $(TAO_ROOT)/tao/PortableInterceptorC.i \ + testC.i \ + $(TAO_ROOT)/tao/Stub.h \ + $(TAO_ROOT)/tao/MProfile.h \ + $(TAO_ROOT)/tao/MProfile.i \ + $(TAO_ROOT)/tao/ORB_Core.h \ + $(TAO_ROOT)/tao/Policy_Manager.h \ + $(TAO_ROOT)/tao/Policy_Set.h \ + $(TAO_ROOT)/tao/Policy_Set.i \ + $(TAO_ROOT)/tao/Policy_Manager.i \ + $(TAO_ROOT)/tao/Resource_Factory.h \ + $(ACE_ROOT)/ace/Service_Object.h \ + $(ACE_ROOT)/ace/Shared_Object.h \ + $(ACE_ROOT)/ace/Shared_Object.i \ + $(ACE_ROOT)/ace/DLL.h \ + $(ACE_ROOT)/ace/Service_Object.i \ + $(TAO_ROOT)/tao/CONV_FRAMEC.h \ + $(TAO_ROOT)/tao/CONV_FRAMEC.i \ + $(TAO_ROOT)/tao/params.h \ + $(TAO_ROOT)/tao/params.i \ + $(TAO_ROOT)/tao/TAO_Singleton_Manager.h \ + $(TAO_ROOT)/tao/TAO_Singleton_Manager.inl \ + $(TAO_ROOT)/tao/TAO_Singleton.h \ + $(TAO_ROOT)/tao/TAO_Singleton.inl \ + $(TAO_ROOT)/tao/TAO_Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ + $(TAO_ROOT)/tao/Adapter.h \ + $(TAO_ROOT)/tao/Adapter.i \ + $(TAO_ROOT)/tao/PolicyFactory_Registry.h \ + $(ACE_ROOT)/ace/Map_Manager.h \ + $(ACE_ROOT)/ace/Map_Manager.i \ + $(ACE_ROOT)/ace/Map_Manager.cpp \ + $(TAO_ROOT)/tao/Parser_Registry.h \ + $(TAO_ROOT)/tao/Parser_Registry.i \ + $(TAO_ROOT)/tao/Service_Callbacks.h \ + $(TAO_ROOT)/tao/Service_Callbacks.i \ + $(TAO_ROOT)/tao/Fault_Tolerance_Service.h \ + $(TAO_ROOT)/tao/Fault_Tolerance_Service.i \ + $(TAO_ROOT)/tao/Cleanup_Func_Registry.h \ + $(ACE_ROOT)/ace/Array_Base.h \ + $(ACE_ROOT)/ace/Array_Base.inl \ + $(ACE_ROOT)/ace/Array_Base.cpp \ + $(TAO_ROOT)/tao/Cleanup_Func_Registry.inl \ + $(TAO_ROOT)/tao/Object_Ref_Table.h \ + $(TAO_ROOT)/tao/Interceptor_List.h \ + $(TAO_ROOT)/tao/Interceptor_List.inl \ + $(TAO_ROOT)/tao/PICurrent.h \ + $(TAO_ROOT)/tao/PICurrent.inl \ + $(ACE_ROOT)/ace/Thread_Manager.h \ + $(ACE_ROOT)/ace/Thread_Exit.h \ + $(ACE_ROOT)/ace/Thread_Control.h \ + $(ACE_ROOT)/ace/Thread_Control.inl \ + $(ACE_ROOT)/ace/Containers.h \ + $(ACE_ROOT)/ace/Containers.i \ + $(ACE_ROOT)/ace/Containers_T.h \ + $(ACE_ROOT)/ace/Containers_T.i \ + $(ACE_ROOT)/ace/Containers_T.cpp \ + $(ACE_ROOT)/ace/Singleton.h \ + $(ACE_ROOT)/ace/Singleton.i \ + $(ACE_ROOT)/ace/Singleton.cpp \ + $(ACE_ROOT)/ace/Framework_Component.h \ + $(ACE_ROOT)/ace/Framework_Component.inl \ + $(ACE_ROOT)/ace/Framework_Component_T.h \ + $(ACE_ROOT)/ace/Framework_Component_T.inl \ + $(ACE_ROOT)/ace/Framework_Component_T.cpp \ + $(ACE_ROOT)/ace/Thread_Manager.i \ + $(TAO_ROOT)/tao/ORB_Core.i \ + $(TAO_ROOT)/tao/ORB_Core_Auto_Ptr.h \ + $(TAO_ROOT)/tao/ORB_Core_Auto_Ptr.inl \ + $(TAO_ROOT)/tao/Stub.i \ + $(TAO_ROOT)/tao/Invocation.h \ + $(TAO_ROOT)/tao/Synch_Reply_Dispatcher.h \ + $(TAO_ROOT)/tao/Reply_Dispatcher.h \ + $(TAO_ROOT)/tao/Reply_Dispatcher.i \ + $(TAO_ROOT)/tao/LF_Invocation_Event.h \ + $(TAO_ROOT)/tao/LF_Event.h \ + $(TAO_ROOT)/tao/LF_Event.inl \ + $(TAO_ROOT)/tao/LF_Invocation_Event.inl \ + $(TAO_ROOT)/tao/GIOP_Message_Version.h \ + $(TAO_ROOT)/tao/GIOP_Message_Version.inl \ + $(TAO_ROOT)/tao/operation_details.h \ + $(TAO_ROOT)/tao/Service_Context.h \ + $(TAO_ROOT)/tao/Service_Context.inl \ + $(TAO_ROOT)/tao/target_specification.h \ + $(TAO_ROOT)/tao/target_specification.i \ + $(TAO_ROOT)/tao/operation_details.i \ + $(TAO_ROOT)/tao/Transport.h \ + $(TAO_ROOT)/tao/Transport_Descriptor_Interface.h \ + $(TAO_ROOT)/tao/Transport_Descriptor_Interface.inl \ + $(TAO_ROOT)/tao/Transport_Cache_Manager.h \ + $(TAO_ROOT)/tao/Cache_Entries.h \ + $(ACE_ROOT)/ace/Recyclable.h \ + $(ACE_ROOT)/ace/Recyclable.inl \ + $(TAO_ROOT)/tao/Cache_Entries.inl \ + $(TAO_ROOT)/tao/Transport_Cache_Manager.inl \ + $(TAO_ROOT)/tao/Transport_Timer.h \ + $(TAO_ROOT)/tao/Incoming_Message_Queue.h \ + $(TAO_ROOT)/tao/Pluggable_Messaging_Utils.h \ + $(TAO_ROOT)/tao/Pluggable_Messaging_Utils.i \ + $(TAO_ROOT)/tao/Incoming_Message_Queue.inl \ + $(TAO_ROOT)/tao/Synch_Refcountable.h \ + $(ACE_ROOT)/ace/Refcountable.h \ + $(ACE_ROOT)/ace/Refcountable.inl \ + $(TAO_ROOT)/tao/Synch_Refcountable.inl \ + $(TAO_ROOT)/tao/Transport.inl \ + $(TAO_ROOT)/tao/Invocation.i \ + $(TAO_ROOT)/tao/PortableInterceptor.h \ + $(TAO_ROOT)/tao/RequestInfo_Util.h \ + $(TAO_ROOT)/tao/ClientRequestInfo_i.h \ + $(TAO_ROOT)/tao/ClientRequestInfo_i.inl \ + $(TAO_ROOT)/tao/ClientInterceptorAdapter.h \ + $(TAO_ROOT)/tao/ClientInterceptorAdapter.inl + +# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/TAO/tests/Connection_Failure/Makefile.bor b/TAO/tests/Connection_Failure/Makefile.bor new file mode 100644 index 00000000000..e321e32567a --- /dev/null +++ b/TAO/tests/Connection_Failure/Makefile.bor @@ -0,0 +1,7 @@ +# +# $Id$ +# + +MAKEFILES = client.bor + +!include <$(ACE_ROOT)\include\makeinclude\recurse.bor> diff --git a/TAO/tests/Connection_Failure/README b/TAO/tests/Connection_Failure/README new file mode 100644 index 00000000000..7ae5b95d45d --- /dev/null +++ b/TAO/tests/Connection_Failure/README @@ -0,0 +1,8 @@ +/** + +@page Connection_Failure Test README File + +A simple test for connection failures. The client tries to connect to +an non-existent server. + +*/ diff --git a/TAO/tests/Connection_Failure/client.bor b/TAO/tests/Connection_Failure/client.bor new file mode 100644 index 00000000000..04225c59cea --- /dev/null +++ b/TAO/tests/Connection_Failure/client.bor @@ -0,0 +1,35 @@ +# +# $Id$ +# + +NAME = client + +TAO_IDL = $(CORE_BINDIR)\tao_idl -g $(CORE_BINDIR)\gperf.exe -Ge 1 + +OBJFILES = \ + $(OBJDIR)\testC.obj \ + $(OBJDIR)\client.obj + +CFLAGS = \ + $(ACE_CFLAGS) \ + $(TAO_CFLAGS) + +LIBFILES = \ + $(ACE_LIB) \ + $(TAO_LIB) + +IDLFILES = \ + $(IDLDIR)\test.idl + +CPPDIR = . + +IDLDIR = . + +!include <$(ACE_ROOT)\include\makeinclude\build_exe.bor> + +# +# IDL Build rules +# + +$(IDLDIR)\testS.cpp $(IDLDIR)\testC.cpp: $(IDLDIR)\test.idl + $(TAO_IDL) $** diff --git a/TAO/tests/Connection_Failure/client.cpp b/TAO/tests/Connection_Failure/client.cpp new file mode 100644 index 00000000000..1ed7cbc25bc --- /dev/null +++ b/TAO/tests/Connection_Failure/client.cpp @@ -0,0 +1,45 @@ +// $Id$ + +#include "testC.h" + +ACE_RCSID(Connection_Failure, client, "$Id$") + +const char *ior = + "corbaloc:iiop:192.3.47/10007/RandomObject"; + +int +main (int argc, char *argv[]) +{ + ACE_TRY_NEW_ENV + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + CORBA::Object_var tmp = + orb->string_to_object (ior ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // First connection happens here.. + test::_narrow (tmp.in () ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // Should not reach here. + ACE_ERROR_RETURN ((LM_ERROR, + "_narrow() succeeded to non-existent object when it should not have...\n"), + -1); + } + ACE_CATCH (CORBA::TRANSIENT, transient_exception) + { + // This exception is correct. + ACE_DEBUG ((LM_DEBUG, + "_narrow() to non-existent object failed correctly. Test succeeded.\n")); + return 0; + } + ACE_ENDTRY; + + // Should not reach here. + ACE_ERROR_RETURN ((LM_ERROR, + "This test should not reach this code...\n"), + -1); +} diff --git a/TAO/tests/Connection_Failure/client.dsp b/TAO/tests/Connection_Failure/client.dsp new file mode 100644 index 00000000000..9de61d97c8d --- /dev/null +++ b/TAO/tests/Connection_Failure/client.dsp @@ -0,0 +1,202 @@ +# Microsoft Developer Studio Project File - Name="Connection_Failure Client" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Connection_Failure Client - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "client.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "client.mak" CFG="Connection_Failure Client - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Connection_Failure Client - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Connection_Failure Client - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Connection_Failure Client - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../../" /I "../../" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 tao.lib ace.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\ace" /libpath:"..\..\tao"
+
+!ELSEIF "$(CFG)" == "Connection_Failure Client - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../../../" /I "../../" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 taod.lib aced.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\ace" /libpath:"..\..\tao"
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "Connection_Failure Client - Win32 Release"
+# Name "Connection_Failure Client - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter ".cpp"
+# Begin Source File
+
+SOURCE=.\client.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\testC.cpp
+# ADD CPP /GR
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter ""
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\test.idl
+
+!IF "$(CFG)" == "Connection_Failure Client - Win32 Release"
+
+# PROP Ignore_Default_Tool 1
+USERDEP__TEST_="..\..\..\bin\Release\tao_idl.exe"
+# Begin Custom Build - Invoking TAO_IDL Compiler
+InputPath=.\test.idl
+InputName=test
+
+BuildCmds= \
+ ..\..\..\bin\Release\tao_idl -Ge 1 $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "Connection_Failure Client - Win32 Debug"
+
+USERDEP__TEST_="..\..\..\bin\tao_idl.exe"
+# Begin Custom Build - Invoking TAO_IDL Compiler
+InputPath=.\test.idl
+InputName=test
+
+BuildCmds= \
+ ..\..\..\bin\tao_idl -Ge 1 $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\testC.i
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/tests/Connection_Failure/run_test.pl b/TAO/tests/Connection_Failure/run_test.pl new file mode 100755 index 00000000000..16469fa132a --- /dev/null +++ b/TAO/tests/Connection_Failure/run_test.pl @@ -0,0 +1,22 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib '../../../bin'; +use PerlACE::Run_Test; + +$status = 0; + +$CL = new PerlACE::Process ("client", ""); + +$client = $CL->SpawnWaitKill (60); + +if ($client != 0) { + print STDERR "ERROR: client returned $client\n"; + $status = 1; +} + +exit $status; diff --git a/TAO/tests/Connection_Failure/test.idl b/TAO/tests/Connection_Failure/test.idl new file mode 100644 index 00000000000..0e52e7f2a6a --- /dev/null +++ b/TAO/tests/Connection_Failure/test.idl @@ -0,0 +1,7 @@ +// +// $Id$ +// + +interface test +{ +}; diff --git a/TAO/tests/Connection_Timeout/client.cpp b/TAO/tests/Connection_Timeout/client.cpp index 323caa40871..345ca8f5a38 100644 --- a/TAO/tests/Connection_Timeout/client.cpp +++ b/TAO/tests/Connection_Timeout/client.cpp @@ -64,8 +64,6 @@ main (int argc, char *argv[]) CORBA::PolicyCurrent::_narrow (object.in () ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - - CORBA::Any timeout_as_any; timeout_as_any <<= timeout_period; @@ -77,7 +75,6 @@ main (int argc, char *argv[]) ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - policy_current->set_policy_overrides (policy_list, CORBA::ADD_OVERRIDE ACE_ENV_ARG_PARAMETER); diff --git a/TAO/tests/Connection_Timeout/client.dsp b/TAO/tests/Connection_Timeout/client.dsp index ce4579b8d37..9c6ca00d197 100644 --- a/TAO/tests/Connection_Timeout/client.dsp +++ b/TAO/tests/Connection_Timeout/client.dsp @@ -1,10 +1,10 @@ -# Microsoft Developer Studio Project File - Name="Hello Client" - Package Owner=<4>
+# Microsoft Developer Studio Project File - Name="Connection_Timeout Client" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
-CFG=Hello Client - Win32 Debug
+CFG=Connection_Timeout Client - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
@@ -13,12 +13,12 @@ CFG=Hello Client - Win32 Debug !MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
-!MESSAGE NMAKE /f "client.mak" CFG="Hello Client - Win32 Debug"
+!MESSAGE NMAKE /f "client.mak" CFG="Connection_Timeout Client - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
-!MESSAGE "Hello Client - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "Hello Client - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE "Connection_Timeout Client - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Connection_Timeout Client - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
@@ -28,7 +28,7 @@ CFG=Hello Client - Win32 Debug CPP=cl.exe
RSC=rc.exe
-!IF "$(CFG)" == "Hello Client - Win32 Release"
+!IF "$(CFG)" == "Connection_Timeout Client - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
@@ -53,7 +53,7 @@ LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 TAO_Messaging.lib tao.lib ace.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\tao\Messaging" /libpath:"..\..\..\ace" /libpath:"..\..\tao"
-!ELSEIF "$(CFG)" == "Hello Client - Win32 Debug"
+!ELSEIF "$(CFG)" == "Connection_Timeout Client - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
@@ -83,8 +83,8 @@ LINK32=link.exe # Begin Target
-# Name "Hello Client - Win32 Release"
-# Name "Hello Client - Win32 Debug"
+# Name "Connection_Timeout Client - Win32 Release"
+# Name "Connection_Timeout Client - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter ".cpp"
@@ -109,7 +109,7 @@ SOURCE=.\TestC.cpp SOURCE=.\Test.idl
-!IF "$(CFG)" == "Hello Client - Win32 Release"
+!IF "$(CFG)" == "Connection_Timeout Client - Win32 Release"
# PROP Ignore_Default_Tool 1
USERDEP__TEST_="..\..\..\bin\Release\tao_idl.exe"
@@ -148,7 +148,7 @@ BuildCmds= \ $(BuildCmds)
# End Custom Build
-!ELSEIF "$(CFG)" == "Hello Client - Win32 Debug"
+!ELSEIF "$(CFG)" == "Connection_Timeout Client - Win32 Debug"
USERDEP__TEST_="..\..\..\bin\tao_idl.exe"
# Begin Custom Build - Invoking TAO_IDL Compiler
diff --git a/TAO/tests/MProfile_Connection_Timeout/client.dsp b/TAO/tests/MProfile_Connection_Timeout/client.dsp index 51b6dc3ecea..e51e2b93b70 100644 --- a/TAO/tests/MProfile_Connection_Timeout/client.dsp +++ b/TAO/tests/MProfile_Connection_Timeout/client.dsp @@ -1,10 +1,10 @@ -# Microsoft Developer Studio Project File - Name="MProfile Client" - Package Owner=<4>
+# Microsoft Developer Studio Project File - Name="MProfile_Connection_Timeout Client" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
-CFG=MProfile Client - Win32 Debug
+CFG=MProfile_Connection_Timeout Client - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
@@ -13,12 +13,12 @@ CFG=MProfile Client - Win32 Debug !MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
-!MESSAGE NMAKE /f "client.mak" CFG="MProfile Client - Win32 Debug"
+!MESSAGE NMAKE /f "client.mak" CFG="MProfile_Connection_Timeout Client - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
-!MESSAGE "MProfile Client - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "MProfile Client - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE "MProfile_Connection_Timeout Client - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "MProfile_Connection_Timeout Client - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
@@ -28,7 +28,7 @@ CFG=MProfile Client - Win32 Debug CPP=cl.exe
RSC=rc.exe
-!IF "$(CFG)" == "MProfile Client - Win32 Release"
+!IF "$(CFG)" == "MProfile_Connection_Timeout Client - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
@@ -54,7 +54,7 @@ LINK32=link.exe # ADD LINK32 ace.lib TAO.lib TAO_IORManip.lib TAO_Messaging.lib /nologo /subsystem:console /debug /machine:I386 /out:"Release/client.exe" /pdbtype:sept /libpath:"..\..\..\ace" /libpath:"..\..\tao" /libpath:"..\..\tao\PortableServer" /libpath:"..\..\tao\IORManipulation" /libpath:"..\..\tao\Messaging"
# SUBTRACT LINK32 /pdb:none
-!ELSEIF "$(CFG)" == "MProfile Client - Win32 Debug"
+!ELSEIF "$(CFG)" == "MProfile_Connection_Timeout Client - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
@@ -84,8 +84,8 @@ LINK32=link.exe # Begin Target
-# Name "MProfile Client - Win32 Release"
-# Name "MProfile Client - Win32 Debug"
+# Name "MProfile_Connection_Timeout Client - Win32 Release"
+# Name "MProfile_Connection_Timeout Client - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
@@ -114,7 +114,7 @@ SOURCE=.\testC.h SOURCE=.\test.idl
-!IF "$(CFG)" == "MProfile Client - Win32 Release"
+!IF "$(CFG)" == "MProfile_Connection_Timeout Client - Win32 Release"
USERDEP__TEST_="..\..\..\bin\Release\tao_idl.exe"
# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputPath)
@@ -152,7 +152,7 @@ BuildCmds= \ $(BuildCmds)
# End Custom Build
-!ELSEIF "$(CFG)" == "MProfile Client - Win32 Debug"
+!ELSEIF "$(CFG)" == "MProfile_Connection_Timeout Client - Win32 Debug"
USERDEP__TEST_="..\..\..\bin\tao_idl.exe"
# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputPath)
diff --git a/TAO/tests/MProfile_Connection_Timeout/server.dsp b/TAO/tests/MProfile_Connection_Timeout/server.dsp index 92b0a57aee8..67a59ed66ca 100644 --- a/TAO/tests/MProfile_Connection_Timeout/server.dsp +++ b/TAO/tests/MProfile_Connection_Timeout/server.dsp @@ -1,10 +1,10 @@ -# Microsoft Developer Studio Project File - Name="MProfile Server" - Package Owner=<4>
+# Microsoft Developer Studio Project File - Name="MProfile_Connection_Timeout Server" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
-CFG=MProfile Server - Win32 Debug
+CFG=MProfile_Connection_Timeout Server - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
@@ -13,12 +13,12 @@ CFG=MProfile Server - Win32 Debug !MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
-!MESSAGE NMAKE /f "server.mak" CFG="MProfile Server - Win32 Debug"
+!MESSAGE NMAKE /f "server.mak" CFG="MProfile_Connection_Timeout Server - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
-!MESSAGE "MProfile Server - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "MProfile Server - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE "MProfile_Connection_Timeout Server - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "MProfile_Connection_Timeout Server - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
@@ -28,7 +28,7 @@ CFG=MProfile Server - Win32 Debug CPP=cl.exe
RSC=rc.exe
-!IF "$(CFG)" == "MProfile Server - Win32 Release"
+!IF "$(CFG)" == "MProfile_Connection_Timeout Server - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
@@ -53,7 +53,7 @@ LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 ace.lib TAO.lib TAO_PortableServer.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\lib" /libpath:"..\..\..\ace" /libpath:"..\..\tao" /libpath:"..\..\tao\PortableServer" /libpath:"..\..\tao\IORManipulation"
-!ELSEIF "$(CFG)" == "MProfile Server - Win32 Debug"
+!ELSEIF "$(CFG)" == "MProfile_Connection_Timeout Server - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
@@ -82,8 +82,8 @@ LINK32=link.exe # Begin Target
-# Name "MProfile Server - Win32 Release"
-# Name "MProfile Server - Win32 Debug"
+# Name "MProfile_Connection_Timeout Server - Win32 Release"
+# Name "MProfile_Connection_Timeout Server - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
@@ -124,7 +124,7 @@ SOURCE=.\testS.h SOURCE=.\test.idl
-!IF "$(CFG)" == "MProfile Server - Win32 Release"
+!IF "$(CFG)" == "MProfile_Connection_Timeout Server - Win32 Release"
USERDEP__TEST_="..\..\..\bin\Release\tao_idl.exe"
# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputPath)
@@ -162,7 +162,7 @@ BuildCmds= \ $(BuildCmds)
# End Custom Build
-!ELSEIF "$(CFG)" == "MProfile Server - Win32 Debug"
+!ELSEIF "$(CFG)" == "MProfile_Connection_Timeout Server - Win32 Debug"
USERDEP__TEST_="..\..\..\bin\tao_idl.exe"
# Begin Custom Build - Invoking TAO's IDL Compiler on $(InputPath)
diff --git a/TAO/tests/MT_BiDir/client.dsp b/TAO/tests/MT_BiDir/client.dsp index d84c65a123b..377d0949356 100644 --- a/TAO/tests/MT_BiDir/client.dsp +++ b/TAO/tests/MT_BiDir/client.dsp @@ -1,10 +1,10 @@ -# Microsoft Developer Studio Project File - Name="BiDir Client" - Package Owner=<4>
+# Microsoft Developer Studio Project File - Name="MT_BiDir Client" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
-CFG=BiDir Client - Win32 Debug
+CFG=MT_BiDir Client - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
@@ -13,12 +13,12 @@ CFG=BiDir Client - Win32 Debug !MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
-!MESSAGE NMAKE /f "client.mak" CFG="BiDir Client - Win32 Debug"
+!MESSAGE NMAKE /f "client.mak" CFG="MT_BiDir Client - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
-!MESSAGE "BiDir Client - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "BiDir Client - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE "MT_BiDir Client - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "MT_BiDir Client - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
@@ -28,7 +28,7 @@ CFG=BiDir Client - Win32 Debug CPP=cl.exe
RSC=rc.exe
-!IF "$(CFG)" == "BiDir Client - Win32 Release"
+!IF "$(CFG)" == "MT_BiDir Client - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
@@ -54,7 +54,7 @@ LINK32=link.exe # ADD LINK32 ace.lib tao.lib TAO_PortableServer.lib TAO_BiDirGIOP.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\ace" /libpath:"..\..\tao" /libpath:"..\..\tao\PortableServer" /libpath:"..\..\tao\BiDir_GIOP"
# SUBTRACT LINK32 /pdb:none
-!ELSEIF "$(CFG)" == "BiDir Client - Win32 Debug"
+!ELSEIF "$(CFG)" == "MT_BiDir Client - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
@@ -84,8 +84,8 @@ LINK32=link.exe # Begin Target
-# Name "BiDir Client - Win32 Release"
-# Name "BiDir Client - Win32 Debug"
+# Name "MT_BiDir Client - Win32 Release"
+# Name "MT_BiDir Client - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
@@ -151,7 +151,7 @@ SOURCE=.\SenderC.h SOURCE=.\Receiver.idl
-!IF "$(CFG)" == "BiDir Client - Win32 Release"
+!IF "$(CFG)" == "MT_BiDir Client - Win32 Release"
# Begin Custom Build
InputPath=.\Receiver.idl
@@ -188,7 +188,7 @@ BuildCmds= \ $(BuildCmds)
# End Custom Build
-!ELSEIF "$(CFG)" == "BiDir Client - Win32 Debug"
+!ELSEIF "$(CFG)" == "MT_BiDir Client - Win32 Debug"
# Begin Custom Build - Invoking TAO_IDL Compiler
InputPath=.\Receiver.idl
@@ -232,7 +232,7 @@ BuildCmds= \ SOURCE=.\Sender.idl
-!IF "$(CFG)" == "BiDir Client - Win32 Release"
+!IF "$(CFG)" == "MT_BiDir Client - Win32 Release"
# Begin Custom Build
InputPath=.\Sender.idl
@@ -269,7 +269,7 @@ BuildCmds= \ $(BuildCmds)
# End Custom Build
-!ELSEIF "$(CFG)" == "BiDir Client - Win32 Debug"
+!ELSEIF "$(CFG)" == "MT_BiDir Client - Win32 Debug"
# Begin Custom Build - Invoking TAO_IDL Compiler
InputPath=.\Sender.idl
diff --git a/TAO/tests/MT_BiDir/server.dsp b/TAO/tests/MT_BiDir/server.dsp index 72938a046d0..bda4accfffc 100644 --- a/TAO/tests/MT_BiDir/server.dsp +++ b/TAO/tests/MT_BiDir/server.dsp @@ -1,10 +1,10 @@ -# Microsoft Developer Studio Project File - Name="BiDir Server" - Package Owner=<4>
+# Microsoft Developer Studio Project File - Name="MT_BiDir Server" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
-CFG=BiDir Server - Win32 Debug
+CFG=MT_BiDir Server - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
@@ -13,12 +13,12 @@ CFG=BiDir Server - Win32 Debug !MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
-!MESSAGE NMAKE /f "server.mak" CFG="BiDir Server - Win32 Debug"
+!MESSAGE NMAKE /f "server.mak" CFG="MT_BiDir Server - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
-!MESSAGE "BiDir Server - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "BiDir Server - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE "MT_BiDir Server - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "MT_BiDir Server - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
@@ -28,7 +28,7 @@ CFG=BiDir Server - Win32 Debug CPP=cl.exe
RSC=rc.exe
-!IF "$(CFG)" == "BiDir Server - Win32 Release"
+!IF "$(CFG)" == "MT_BiDir Server - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
@@ -54,7 +54,7 @@ LINK32=link.exe # ADD LINK32 ace.lib tao.lib TAO_PortableServer.lib TAO_BiDirGIOP.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\ace" /libpath:"..\..\tao" /libpath:"..\..\tao\PortableServer" /libpath:"..\..\tao\BiDir_GIOP"
# SUBTRACT LINK32 /pdb:none
-!ELSEIF "$(CFG)" == "BiDir Server - Win32 Debug"
+!ELSEIF "$(CFG)" == "MT_BiDir Server - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
@@ -84,8 +84,8 @@ LINK32=link.exe # Begin Target
-# Name "BiDir Server - Win32 Release"
-# Name "BiDir Server - Win32 Debug"
+# Name "MT_BiDir Server - Win32 Release"
+# Name "MT_BiDir Server - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
@@ -151,7 +151,7 @@ SOURCE=.\Server_Task.h SOURCE=.\Receiver.idl
-!IF "$(CFG)" == "BiDir Server - Win32 Release"
+!IF "$(CFG)" == "MT_BiDir Server - Win32 Release"
# Begin Custom Build
InputPath=.\Receiver.idl
@@ -188,7 +188,7 @@ BuildCmds= \ $(BuildCmds)
# End Custom Build
-!ELSEIF "$(CFG)" == "BiDir Server - Win32 Debug"
+!ELSEIF "$(CFG)" == "MT_BiDir Server - Win32 Debug"
# Begin Custom Build
InputPath=.\Receiver.idl
@@ -232,7 +232,7 @@ BuildCmds= \ SOURCE=.\Sender.idl
-!IF "$(CFG)" == "BiDir Server - Win32 Release"
+!IF "$(CFG)" == "MT_BiDir Server - Win32 Release"
# Begin Custom Build
InputPath=.\Sender.idl
@@ -269,7 +269,7 @@ BuildCmds= \ $(BuildCmds)
# End Custom Build
-!ELSEIF "$(CFG)" == "BiDir Server - Win32 Debug"
+!ELSEIF "$(CFG)" == "MT_BiDir Server - Win32 Debug"
# Begin Custom Build
InputPath=.\Sender.idl
diff --git a/TAO/tests/Makefile b/TAO/tests/Makefile index f7101331388..0b85e9e6487 100644 --- a/TAO/tests/Makefile +++ b/TAO/tests/Makefile @@ -24,6 +24,7 @@ DIRS = CDR \ Collocation_Tests \ CodeSets \ Collocation \ + Connection_Failure \ Connection_Timeout \ IDL_Test \ OctetSeq \ diff --git a/TAO/tests/Makefile.bor b/TAO/tests/Makefile.bor index 2be206f2269..6fafb10574e 100644 --- a/TAO/tests/Makefile.bor +++ b/TAO/tests/Makefile.bor @@ -29,6 +29,7 @@ DIRS = \ Collocation_Tests \ Connect_Strategy_Test \ Connection_Purging \ + Connection_Failure \ Connection_Timeout \ Crash_On_Write \ Cache_Growth_Test \ diff --git a/TAO/tests/ORB_shutdown/server.dsp b/TAO/tests/ORB_shutdown/server.dsp index 1b8448b5ce0..5eeab6b5a1f 100644 --- a/TAO/tests/ORB_shutdown/server.dsp +++ b/TAO/tests/ORB_shutdown/server.dsp @@ -1,10 +1,10 @@ -# Microsoft Developer Studio Project File - Name="Foo_Bar Server" - Package Owner=<4>
+# Microsoft Developer Studio Project File - Name="ORB_shutdown Server" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
-CFG=Foo_Bar Server - Win32 Debug
+CFG=ORB_shutdown Server - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
@@ -13,12 +13,12 @@ CFG=Foo_Bar Server - Win32 Debug !MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
-!MESSAGE NMAKE /f "server.mak" CFG="Foo_Bar Server - Win32 Debug"
+!MESSAGE NMAKE /f "server.mak" CFG="ORB_shutdown Server - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
-!MESSAGE "Foo_Bar Server - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "Foo_Bar Server - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE "ORB_shutdown Server - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "ORB_shutdown Server - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
@@ -28,7 +28,7 @@ CFG=Foo_Bar Server - Win32 Debug CPP=cl.exe
RSC=rc.exe
-!IF "$(CFG)" == "Foo_Bar Server - Win32 Release"
+!IF "$(CFG)" == "ORB_shutdown Server - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
@@ -53,7 +53,7 @@ LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 ace.lib TAO.lib TAO_PortableServer.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\ace" /libpath:"..\..\tao" /libpath:"..\..\tao\PortableServer"
-!ELSEIF "$(CFG)" == "Foo_Bar Server - Win32 Debug"
+!ELSEIF "$(CFG)" == "ORB_shutdown Server - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
@@ -82,8 +82,8 @@ LINK32=link.exe # Begin Target
-# Name "Foo_Bar Server - Win32 Release"
-# Name "Foo_Bar Server - Win32 Debug"
+# Name "ORB_shutdown Server - Win32 Release"
+# Name "ORB_shutdown Server - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter ".cpp"
@@ -120,7 +120,7 @@ SOURCE=.\Foo_Bar.h SOURCE=.\Test.idl
-!IF "$(CFG)" == "Foo_Bar Server - Win32 Release"
+!IF "$(CFG)" == "ORB_shutdown Server - Win32 Release"
# PROP Ignore_Default_Tool 1
USERDEP__TEST_="..\..\..\bin\Release\tao_idl.exe"
@@ -159,7 +159,7 @@ BuildCmds= \ $(BuildCmds)
# End Custom Build
-!ELSEIF "$(CFG)" == "Foo_Bar Server - Win32 Debug"
+!ELSEIF "$(CFG)" == "ORB_shutdown Server - Win32 Debug"
USERDEP__TEST_="..\..\..\bin\tao_idl.exe"
# Begin Custom Build - Invoking TAO_IDL Compiler
diff --git a/TAO/tests/README b/TAO/tests/README index f537674c084..8e48823cca7 100644 --- a/TAO/tests/README +++ b/TAO/tests/README @@ -77,6 +77,11 @@ how to run the following tests: and checks whether cached handlers are purged effectively when the process runs out of descriptors. + . Connection_Failure + + A simple test for connection failures. The client tries to + connect to an non-existent server. + . Crashed_Callback A regression test for callbacks, sent as a reliable oneway, diff --git a/TAO/tests/TAO_Tests.dsw b/TAO/tests/TAO_Tests.dsw index e728d7697fd..04060998a1a 100644 --- a/TAO/tests/TAO_Tests.dsw +++ b/TAO/tests/TAO_Tests.dsw @@ -1,1751 +1,2255 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "AMI Timeout Client"=.\AMI_Timeouts\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "AMI Timeout Server"=.\AMI_Timeouts\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "AMI_Buffering Admin"=.\AMI_Buffering\admin.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "AMI_Buffering Client"=.\AMI_Buffering\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "AMI_Buffering Server"=.\AMI_Buffering\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "AMI_Test_Client"=.\AMI\AMI_Test_Client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "AMI_Test_Server"=.\AMI\AMI_Test_Server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "AMI_Test_Simple_Client"=.\AMI\AMI_Test_Simple_Client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "BiDir Client"=.\BiDirectional\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "BiDir Server"=.\BiDirectional\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "BiDirectional_NestedUpcall Client"=.\BiDirectional_NestedUpcall\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "BiDirectional_NestedUpcall Server"=.\BiDirectional_NestedUpcall\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Big_Oneways Client"=.\Big_Oneways\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Big_Oneways Server"=.\Big_Oneways\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Big_Reply Client"=.\Big_Reply\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Big_Reply Server"=.\Big_Reply\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Big_Request_Muxing Client"=.\Big_Request_Muxing\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Big_Request_Muxing Server"=.\Big_Request_Muxing\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Big_Twoways Client"=.\Big_Twoways\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Big_Twoways Server"=.\Big_Twoways\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Blocking_Sync_None Client"=.\Blocking_Sync_None\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Blocking_Sync_None Server"=.\Blocking_Sync_None\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Bug 1020 Basic Regression Client"=.\Bug_1020_Basic_Regression\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Bug 1020 Basic Regression Server"=.\Bug_1020_Basic_Regression\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Bug 1020 Regression Client"=.\Bug_1020_Regression\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Bug 1020 Regression Server"=.\Bug_1020_Regression\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "CDR Basic Types"=.\CDR\basic_types.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "CDR Growth"=.\CDR\growth.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "CDR TC"=.\CDR\tc.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Cache Grow Client"=.\Cache_Growth_Test\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Cache Grow Server"=.\Cache_Growth_Test\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Client_Leaks Child"=.\Client_Leaks\child.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Client_Leaks Client"=.\Client_Leaks\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Client_Leaks Server"=.\Client_Leaks\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Codec Client"=.\Codec\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Codeset Simple client"=.\CodeSets\simple\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name IBM1047_ISO8859
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Codeset Simple server"=.\CodeSets\simple\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name IBM1047_ISO8859
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Collocation"=.\Collocation\Collocation.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Collocation Diamond DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Collocation Diamond DLL"=.\Collocation\Diamond.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Collocation Test Stubs DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Collocation Test Stubs DLL"=.\Collocation\Collocation_Test_Stubs.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Connection Purging Client"=.\Connection_Purging\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Connection Purging Server"=.\Connection_Purging\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Crash_On_Write Client"=.\Crash_On_Write\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Crash_On_Write Server"=.\Crash_On_Write\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Crashed_Callback Server"=.\Crashed_Callback\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Crashed_Callbacks Client"=.\Crashed_Callback\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "DLL_ORB Test_Client_Module"=.\DLL_ORB\Test_Client_Module.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "DLL_ORB Test_Server_Module"=.\DLL_ORB\Test_Server_Module.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "DLL_ORB client"=.\DLL_ORB\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Client_Module
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "DLL_ORB server"=.\DLL_ORB\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Server_Module
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "DSI_Gateway_Client"=.\DSI_Gateway\DSI_Gateway_Client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "DSI_Gateway_Server"=.\DSI_Gateway\DSI_Gateway_Server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "DSI_Gateway_Service"=.\DSI_Gateway\DSI_Gateway_Service.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "DynAny Basics"=.\DynAny_Test\basic_test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Explicit_Event_Loop Client"=.\Explicit_Event_Loop\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Explicit_Event_Loop Server"=.\Explicit_Event_Loop\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Exposed_Policies Client"=.\Exposed_Policies\Client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Exposed_Policies Server"=.\Exposed_Policies\Server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Faults Client"=.\Faults\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Faults Middle Server"=.\Faults\middle.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Faults Ping"=.\Faults\ping.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Faults Pong"=.\Faults\pong.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Faults Server"=.\Faults\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Forwarding Client"=.\Forwarding\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Forwarding Server"=.\Forwarding\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Hello Client"=.\Hello\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Hello Server"=.\Hello\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "IBM1047_ISO8859"=.\CodeSets\libs\IBM1047_ISO8859\IBM1047_ISO8859.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "IORTest"=.\IORManipulation\IORTest.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "InterOp Naming Server"=".\InterOp-Naming\server.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Leader_Followers Client"=.\Leader_Followers\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Leader_Followers Server"=.\Leader_Followers\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "LongUpcalls AMI_Client"=.\LongUpcalls\ami_client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "LongUpcalls AMI_Server"=.\LongUpcalls\ami_server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "LongUpcalls Blocking_Client"=.\LongUpcalls\blocking_client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "LongUpcalls Blocking_Server"=.\LongUpcalls\blocking_server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "MProfile Client"=.\MProfile\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "MProfile Server"=.\MProfile\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "MT Timeout Client"=.\MT_Timeout\MT_Timeout_Client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "MT Timeout Server"=.\MT_Timeout\MT_Timeout_Server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "MT_Client Client"=.\MT_Client\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "MT_Client ORB Creation"=.\MT_Client\orb_creation.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "MT_Client Server"=.\MT_Client\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "MT_Server Client"=.\MT_Server\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "MT_Server Server"=.\MT_Server\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Multiple Client"=.\Multiple\Client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Multiple Inheritance Client"=.\Multiple_Inheritance\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Multiple Inheritance Server"=.\Multiple_Inheritance\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Multiple Server"=.\Multiple\Server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Muxing Client"=.\Muxing\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Muxing Server"=.\Muxing\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Native Exceptions Client"=.\Native_Exceptions\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Native Exceptions Server"=.\Native_Exceptions\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Nested Upcall MT_Client Client"=.\NestedUpcall\MT_Client_Test\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Nested Upcall MT_Client Server"=.\NestedUpcall\MT_Client_Test\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Nested Upcall Simple Client"=.\NestedUpcall\Simple\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Nested Upcall Simple Server"=.\NestedUpcall\Simple\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Nested Upcall Triangle Initiator"=.\NestedUpcall\Triangle_Test\initiator.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Nested Upcall Triangle Server_A"=.\NestedUpcall\Triangle_Test\server_A.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Nested Upcall Triangle Server_B"=.\NestedUpcall\Triangle_Test\server_B.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Nested_Event_Loop Client"=.\Nested_Event_Loop\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Nested_Event_Loop Server"=.\Nested_Event_Loop\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "ORB_destroy"=.\ORB_destroy\ORB_destroy.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "ORB_init"=.\ORB_init\ORB_init.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "ORT Server"=.\ORT\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "ORT client"=.\ORT\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Object_Loader Driver"=.\Object_Loader\driver.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "OctetSeq"=.\OctetSeq\OctetSeq.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "OctetSeq Client"=.\OctetSeq\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "OctetSeq Server"=.\OctetSeq\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Oneways_Invoking_Twoways Client"=.\Oneways_Invoking_Twoways\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Oneways_Invoking_Twoways Server"=.\Oneways_Invoking_Twoways\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "POA Current"=.\POA\Current\Current.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "POA Default_Servant"=.\POA\Default_Servant\Default_Servant.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "POA Etherealization"=.\POA\Etherealization\Etherealization.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "POA Excessive_Object_Deactivations"=.\POA\Excessive_Object_Deactivations\Excessive_Object_Deactivations.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "POA Identity"=.\POA\Identity\Identity.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "POA MT_Servant_Locator"=.\POA\MT_Servant_Locator\MT_Servant_Locator.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "POA Nested_Non_Servant_Upcalls"=.\POA\Nested_Non_Servant_Upcalls\Nested_Non_Servant_Upcalls.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "POA Non_Servant_Upcalls"=.\POA\Non_Servant_Upcalls\Non_Servant_Upcalls.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "POA Object_Reactivation"=.\POA\Object_Reactivation\Object_Reactivation.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "POA POA_Destruction"=.\POA\POA_Destruction\POA_Destruction.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "POA Persistent ID Client"=.\POA\Persistent_ID\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "POA Persistent ID Server"=.\POA\Persistent_ID\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "POA Policies"=.\POA\Policies\Policies.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "POA Single_Threaded_POA"=.\POA\Single_Threaded_POA\Single_Threaded_POA.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "POA wait_for_completion"=.\POA\wait_for_completion\wait_for_completion.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Param_Test Client"=.\Param_Test\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Param_Test Server"=.\Param_Test\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Queued_Message_Test"=.\Queued_Message_Test\Queued_Message_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Reliable_Oneways Client"=.\Reliable_Oneways\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Reliable_Oneways Server"=.\Reliable_Oneways\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Server_Leaks Client"=.\Server_Leaks\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Server_Leaks Server"=.\Server_Leaks\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Single_Read Client"=.\Single_Read\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Single_Read Server"=.\Single_Read\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Test_DLL"=.\Object_Loader\Test_DLL.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Timed_Buffered_Oneways Client"=.\Timed_Buffered_Oneways\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Timed_Buffered_Oneways Server"=.\Timed_Buffered_Oneways\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Timeout Client"=.\Timeout\client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Timeout Server"=.\Timeout\server.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "idl_test"=.\IDL_Test\idl_test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "portspan"=.\ORB_init\Portspan\portspan.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
+Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "AMH_Exceptions_Test Client"=.\AMH_Exceptions\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "AMH_Exceptions_Test Server"=.\AMH_Exceptions\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "AMH_Oneway_Test Client"=.\AMH_Oneway\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "AMH_Oneway_Test Server"=.\AMH_Oneway\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "AMI Timeout Client"=.\AMI_Timeouts\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "AMI Timeout Server"=.\AMI_Timeouts\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "AMI_Buffering Admin"=.\AMI_Buffering\admin.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "AMI_Buffering Client"=.\AMI_Buffering\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "AMI_Buffering Server"=.\AMI_Buffering\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "AMI_Test_Client"=.\AMI\AMI_Test_Client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "AMI_Test_Server"=.\AMI\AMI_Test_Server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "AMI_Test_Simple_Client"=.\AMI\AMI_Test_Simple_Client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Abstract Interface Client"=.\Abstract_Interface\Abstract_Interface_Client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Abstract Interface Server"=.\Abstract_Interface\Abstract_Interface_Server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "BiDir Client"=.\BiDirectional\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "BiDir Server"=.\BiDirectional\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "BiDirectional_NestedUpcall Client"=.\BiDirectional_NestedUpcall\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "BiDirectional_NestedUpcall Server"=.\BiDirectional_NestedUpcall\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Big_Oneways Client"=.\Big_Oneways\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Big_Oneways Server"=.\Big_Oneways\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Big_Reply Client"=.\Big_Reply\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Big_Reply Server"=.\Big_Reply\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Big_Request_Muxing Client"=.\Big_Request_Muxing\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Big_Request_Muxing Server"=.\Big_Request_Muxing\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Big_Twoways Client"=.\Big_Twoways\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Big_Twoways Server"=.\Big_Twoways\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Blocking_Sync_None Client"=.\Blocking_Sync_None\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Blocking_Sync_None Server"=.\Blocking_Sync_None\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Bug_1020_Basic_Regression Client"=.\Bug_1020_Basic_Regression\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Bug_1020_Basic_Regression Server"=.\Bug_1020_Basic_Regression\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Bug_1020_Regression Client"=.\Bug_1020_Regression\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Bug_1020_Regression Server"=.\Bug_1020_Regression\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Bug_1361_Regression Client"=.\Bug_1361_Regression\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Bug_1361_Regression Server"=.\Bug_1361_Regression\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Bug_1361_Regression Shutdown"=.\Bug_1361_Regression\shutdown.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Bug_1482_Regression Client"=.\Bug_1482_Regression\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Bug_1482_Regression Server"=.\Bug_1482_Regression\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "CDR Basic Types"=.\CDR\basic_types.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "CDR Growth"=.\CDR\growth.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "CDR TC"=.\CDR\tc.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Cache Grow Client"=.\Cache_Growth_Test\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Cache Grow Server"=.\Cache_Growth_Test\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Client_Leaks Child"=.\Client_Leaks\child.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Client_Leaks Client"=.\Client_Leaks\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Client_Leaks Server"=.\Client_Leaks\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Codec Client"=.\Codec\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Codeset Simple client"=.\CodeSets\simple\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name IBM1047_ISO8859 + End Project Dependency +}}} + +############################################################################### + +Project: "Codeset Simple server"=.\CodeSets\simple\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name IBM1047_ISO8859 + End Project Dependency +}}} + +############################################################################### + +Project: "Collocation"=.\Collocation\Collocation.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name Collocation Diamond DLL + End Project Dependency +}}} + +############################################################################### + +Project: "Collocation Diamond DLL"=.\Collocation\Diamond.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name Collocation Test Stubs DLL + End Project Dependency +}}} + +############################################################################### + +Project: "Collocation Test Stubs DLL"=.\Collocation\Collocation_Test_Stubs.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Collocation_Test"=.\Collocation_Tests\Collocation_Test.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Connect_Strategy_Test Client"=.\Connect_Strategy_Test\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Connect_Strategy_Test Server"=.\Connect_Strategy_Test\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Connection Purging Client"=.\Connection_Purging\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Connection Purging Server"=.\Connection_Purging\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Connection_Failure Client"=.\Connection_Failure\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Connection_Timeout Client"=.\Connection_Timeout\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Crash_On_Write Client"=.\Crash_On_Write\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Crash_On_Write Server"=.\Crash_On_Write\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Crashed_Callback Server"=.\Crashed_Callback\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Crashed_Callbacks Client"=.\Crashed_Callback\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "DLL_ORB Test_Client_Module"=.\DLL_ORB\Test_Client_Module.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "DLL_ORB Test_Server_Module"=.\DLL_ORB\Test_Server_Module.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "DLL_ORB client"=.\DLL_ORB\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name Test_Client_Module + End Project Dependency +}}} + +############################################################################### + +Project: "DLL_ORB server"=.\DLL_ORB\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name Test_Server_Module + End Project Dependency +}}} + +############################################################################### + +Project: "DSI_Gateway_Client"=.\DSI_Gateway\DSI_Gateway_Client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "DSI_Gateway_Server"=.\DSI_Gateway\DSI_Gateway_Server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "DSI_Gateway_Service"=.\DSI_Gateway\DSI_Gateway_Service.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "DynAny Basics"=.\DynAny_Test\basic_test.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Explicit_Event_Loop Client"=.\Explicit_Event_Loop\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Explicit_Event_Loop Server"=.\Explicit_Event_Loop\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Exposed_Policies Client"=.\Exposed_Policies\Client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Exposed_Policies Server"=.\Exposed_Policies\Server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Faults Client"=.\Faults\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Faults Middle Server"=.\Faults\middle.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Faults Ping"=.\Faults\ping.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Faults Pong"=.\Faults\pong.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Faults Server"=.\Faults\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "File_IO Client"=.\File_IO\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "File_IO Server"=.\File_IO\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Forwarding Client"=.\Forwarding\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Forwarding Server"=.\Forwarding\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Hello Client"=.\Hello\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Hello Server"=.\Hello\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "IBM1047_ISO8859"=.\CodeSets\libs\IBM1047_ISO8859\IBM1047_ISO8859.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "IORTest"=.\IORManipulation\IORTest.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "InterOp Naming Server"=".\InterOp-Naming\server.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Leader_Followers Client"=.\Leader_Followers\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Leader_Followers Server"=.\Leader_Followers\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "LongUpcalls AMI_Client"=.\LongUpcalls\ami_client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "LongUpcalls AMI_Server"=.\LongUpcalls\ami_server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "LongUpcalls Blocking_Client"=.\LongUpcalls\blocking_client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "LongUpcalls Blocking_Server"=.\LongUpcalls\blocking_server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "MProfile Client"=.\MProfile\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "MProfile Server"=.\MProfile\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "MProfile_Connection_Timeout Client"=.\MProfile_Connection_Timeout\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "MProfile_Connection_Timeout Server"=.\MProfile_Connection_Timeout\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "MT Timeout Client"=.\MT_Timeout\MT_Timeout_Client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "MT Timeout Server"=.\MT_Timeout\MT_Timeout_Server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "MT_BiDir Client"=.\MT_BiDir\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "MT_BiDir Server"=.\MT_BiDir\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "MT_Client Client"=.\MT_Client\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "MT_Client ORB Creation"=.\MT_Client\orb_creation.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "MT_Client Server"=.\MT_Client\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "MT_Server Client"=.\MT_Server\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "MT_Server Server"=.\MT_Server\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Manipulation"=.\Policies\Manipulation.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Multiple Client"=.\Multiple\Client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Multiple Inheritance Client"=.\Multiple_Inheritance\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Multiple Inheritance Server"=.\Multiple_Inheritance\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Multiple Server"=.\Multiple\Server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Muxed_GIOP_Versions Client"=.\Muxed_GIOP_Versions\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Muxed_GIOP_Versions Server"=.\Muxed_GIOP_Versions\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Muxing Client"=.\Muxing\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Muxing Server"=.\Muxing\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Native Exceptions Client"=.\Native_Exceptions\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Native Exceptions Server"=.\Native_Exceptions\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Nested Upcall MT_Client Client"=.\NestedUpcall\MT_Client_Test\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Nested Upcall MT_Client Server"=.\NestedUpcall\MT_Client_Test\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Nested Upcall Simple Client"=.\NestedUpcall\Simple\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Nested Upcall Simple Server"=.\NestedUpcall\Simple\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Nested Upcall Triangle Initiator"=.\NestedUpcall\Triangle_Test\initiator.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Nested Upcall Triangle Server_A"=.\NestedUpcall\Triangle_Test\server_A.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Nested Upcall Triangle Server_B"=.\NestedUpcall\Triangle_Test\server_B.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Nested_Event_Loop Client"=.\Nested_Event_Loop\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Nested_Event_Loop Server"=.\Nested_Event_Loop\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Nested_Upcall_Crash Client"=.\Nested_Upcall_Crash\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Nested_Upcall_Crash Scavenger"=.\Nested_Upcall_Crash\scavenger.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Nested_Upcall_Crash Server"=.\Nested_Upcall_Crash\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "No_Server_MT_Connect_Test Client"=.\No_Server_MT_Connect_Test\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "No_Server_MT_Connect_Test Server"=.\No_Server_MT_Connect_Test\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "ORB_destroy"=.\ORB_destroy\ORB_destroy.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "ORB_init"=.\ORB_init\ORB_init.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "ORB_shutdown Server"=.\ORB_shutdown\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "ORT Server"=.\ORT\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "ORT client"=.\ORT\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Object_Loader Driver"=.\Object_Loader\driver.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Objref_Sequence_Test Client"=.\Objref_Sequence_Test\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Objref_Sequence_Test Server"=.\Objref_Sequence_Test\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "OctetSeq"=.\OctetSeq\OctetSeq.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "OctetSeq Client"=.\OctetSeq\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "OctetSeq Server"=.\OctetSeq\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Oneway_Buffering Admin"=.\Oneway_Buffering\admin.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Oneway_Buffering Client"=.\Oneway_Buffering\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Oneway_Buffering Server"=.\Oneway_Buffering\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Oneways_Invoking_Twoways Client"=.\Oneways_Invoking_Twoways\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Oneways_Invoking_Twoways Server"=.\Oneways_Invoking_Twoways\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "POA Current"=.\POA\Current\Current.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "POA Default_Servant"=.\POA\Default_Servant\Default_Servant.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "POA Etherealization"=.\POA\Etherealization\Etherealization.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "POA Excessive_Object_Deactivations"=.\POA\Excessive_Object_Deactivations\Excessive_Object_Deactivations.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "POA Identity"=.\POA\Identity\Identity.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "POA MT_Servant_Locator"=.\POA\MT_Servant_Locator\MT_Servant_Locator.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "POA Nested_Non_Servant_Upcalls"=.\POA\Nested_Non_Servant_Upcalls\Nested_Non_Servant_Upcalls.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "POA Non_Servant_Upcalls"=.\POA\Non_Servant_Upcalls\Non_Servant_Upcalls.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "POA Object_Reactivation"=.\POA\Object_Reactivation\Object_Reactivation.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "POA POA_Destruction"=.\POA\POA_Destruction\POA_Destruction.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "POA Persistent ID Client"=.\POA\Persistent_ID\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "POA Persistent ID Server"=.\POA\Persistent_ID\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "POA Policies"=.\POA\Policies\Policies.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "POA Single_Threaded_POA"=.\POA\Single_Threaded_POA\Single_Threaded_POA.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "POA wait_for_completion"=.\POA\wait_for_completion\wait_for_completion.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Param_Test Client"=.\Param_Test\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Param_Test Server"=.\Param_Test\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Queued_Message_Test"=.\Queued_Message_Test\Queued_Message_Test.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Reliable_Oneways Client"=.\Reliable_Oneways\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Reliable_Oneways Server"=.\Reliable_Oneways\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Server_Leaks Client"=.\Server_Leaks\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Server_Leaks Server"=.\Server_Leaks\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Single_Read Client"=.\Single_Read\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Single_Read Server"=.\Single_Read\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Stack Recursion Client"=.\Stack_Recursion\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Stack_Recursion Server"=.\Stack_Recursion\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Strategies client"=.\Strategies\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Strategies server"=.\Strategies\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Test_DLL"=.\Object_Loader\Test_DLL.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Timed_Buffered_Oneways Client"=.\Timed_Buffered_Oneways\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Timed_Buffered_Oneways Server"=.\Timed_Buffered_Oneways\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Timeout Client"=.\Timeout\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Timeout Server"=.\Timeout\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Two_Objects Client"=.\Two_Objects\client.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "Two_Objects Server"=.\Two_Objects\server.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "idl_test"=.\IDL_Test\idl_test.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "portspan"=.\ORB_init\Portspan\portspan.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/ace/Connector.cpp b/ace/Connector.cpp index 52651212c74..abacf6c061e 100644 --- a/ace/Connector.cpp +++ b/ace/Connector.cpp @@ -1,39 +1,194 @@ -#ifndef ACE_CONNECTOR_CPP -#define ACE_CONNECTOR_CPP +// Connector.cpp +// $Id$ + +#ifndef ACE_CONNECTOR_C +#define ACE_CONNECTOR_C #include "ace/Connector.h" -#include "ace/Svc_Handler.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -ACE_RCSID (ace, - Connector, - "$Id$") +ACE_RCSID(ace, Connector, "$Id$") ACE_ALLOC_HOOK_DEFINE(ACE_Connector) +template <class SVC_HANDLER> +ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::ACE_NonBlocking_Connect_Handler +(ACE_Connector_Base<SVC_HANDLER> &connector, + SVC_HANDLER *sh, + long id) + : connector_ (connector) + , svc_handler_ (sh) + , timer_id_ (id) +{ + ACE_TRACE ("ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::ACE_NonBlocking_Connect_Handler"); + + this->reference_counting_policy ().value + (ACE_Event_Handler::Reference_Counting_Policy::ENABLED); +} + +template <class SVC_HANDLER> SVC_HANDLER * +ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::svc_handler (void) +{ + ACE_TRACE ("ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::svc_handler"); + return this->svc_handler_; +} + +template <class SVC_HANDLER> long +ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::timer_id (void) +{ + ACE_TRACE ("ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::timer_id"); + return this->timer_id_; +} + +template <class SVC_HANDLER> void +ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::timer_id (long id) +{ + ACE_TRACE ("ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::timer_id"); + this->timer_id_ = id; +} + +template <class SVC_HANDLER> void +ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::dump (void) const +{ + ACE_TRACE ("ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::dump"); + + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("svc_handler_ = %x"), this->svc_handler_)); + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ntimer_id_ = %d"), this->timer_id_)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +} + +template <class SVC_HANDLER> SVC_HANDLER * +ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::close (void) +{ + SVC_HANDLER *svc_handler = 0; + + // Make sure that we haven't already initialized the Svc_Handler. + if (this->svc_handler_) + { + // Exclusive access to the Reactor. + ACE_GUARD_RETURN (ACE_Lock, ace_mon, this->reactor ()->lock (), 0); + + // Double check. + if (this->svc_handler_) + { + // Remember the Svc_Handler. + svc_handler = this->svc_handler_; + + // Remove from Reactor. + this->reactor ()->remove_handler + (this->svc_handler_->get_handle (), + ACE_Event_Handler::ALL_EVENTS_MASK); + + // Cancel timer. + this->reactor ()->cancel_timer + (this->timer_id (), 0, 0); + + // Remove this handle from the set of non-blocking handles + // in the Connector. + this->connector_.non_blocking_handles ().clr_bit + (this->svc_handler_->get_handle ()); + + // We are done. Don't initialize the Svc_Handler again. + this->svc_handler_ = 0; + } + } + + return svc_handler; +} + +template <class SVC_HANDLER> int +ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::handle_timeout +(const ACE_Time_Value &tv, + const void *arg) +{ + // This method is called if a connection times out before completing. + ACE_TRACE ("ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::handle_timeout"); + + SVC_HANDLER *svc_handler = + this->close (); + + if (svc_handler == 0) + return 0; + + // Forward to the SVC_HANDLER the <arg> that was passed in as a + // magic cookie during ACE_Connector::connect(). This gives the + // SVC_HANDLER an opportunity to take corrective action (e.g., wait + // a few milliseconds and try to reconnect again. + if (svc_handler->handle_timeout (tv, arg) == -1) + svc_handler->handle_close (svc_handler->get_handle (), + ACE_Event_Handler::TIMER_MASK); + + return 0; +} + + +template <class SVC_HANDLER> int +ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::handle_input (ACE_HANDLE) +{ + // Called when a failure occurs during asynchronous connection + // establishment. + ACE_TRACE ("ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::handle_input"); + + SVC_HANDLER *svc_handler = + this->close (); + + if (svc_handler == 0) + return 0; + + // Close Svc_Handler. + svc_handler->close (0); + + return 0; +} + +template <class SVC_HANDLER> int +ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::handle_output (ACE_HANDLE handle) +{ + // Called when a connection is establishment asynchronous. + ACE_TRACE ("ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::handle_output"); + + SVC_HANDLER *svc_handler = + this->close (); + + if (svc_handler == 0) + return 0; + + this->connector_.initialize_svc_handler (handle, + svc_handler); + + return 0; +} + +template <class SVC_HANDLER> int +ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::handle_exception (ACE_HANDLE h) +{ + // On Win32, the except mask must also be set for asynchronous + // connects. + ACE_TRACE ("ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::handle_exception"); + + return this->handle_output (h); +} + +template <class SVC_HANDLER> int +ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::resume_handler (void) +{ + return ACE_Event_Handler::ACE_EVENT_HANDLER_NOT_RESUMED; +} + template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> void ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::dump (void) const { ACE_TRACE ("ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::dump"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nclosing_ = %d"), this->closing_)); ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nflags_ = %d"), this->flags_)); - this->handler_map_.dump (); ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } -// Bridge method for creating a SVC_HANDLER. The strategy for -// creating a SVC_HANDLER are configured into the Acceptor via it's -// <creation_strategy_>. The default is to create a new SVC_HANDLER. -// However, subclasses can override this strategy to perform -// SVC_HANDLER creation in any way that they like (such as creating -// subclass instances of SVC_HANDLER, using a singleton, dynamically -// linking the handler, etc.). - template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> int ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::make_svc_handler (SVC_HANDLER *&sh) { @@ -87,14 +242,14 @@ ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connector (void) const } template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> int -ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect_svc_handler ( - SVC_HANDLER *&svc_handler, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms) +ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect_svc_handler +(SVC_HANDLER *&svc_handler, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + ACE_Time_Value *timeout, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + int reuse_addr, + int flags, + int perms) { ACE_TRACE ("ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect_svc_handler"); @@ -108,15 +263,15 @@ ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect_svc_handler ( } template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> int -ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect_svc_handler ( - SVC_HANDLER *&svc_handler, - SVC_HANDLER *&sh_copy, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms) +ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect_svc_handler +(SVC_HANDLER *&svc_handler, + SVC_HANDLER *&sh_copy, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + ACE_Time_Value *timeout, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + int reuse_addr, + int flags, + int perms) { ACE_TRACE ("ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect_svc_handler"); @@ -136,319 +291,28 @@ ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::open (ACE_Reactor *r, int flag ACE_TRACE ("ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::open"); this->reactor (r); this->flags_ = flags; - this->closing_ = 0; return 0; } template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> -ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::ACE_Connector (ACE_Reactor *r, int flags) - : handler_map_ (ACE_CONNECTOR_HANDLER_MAP_SIZE) - , connector_ () - , closing_ (0) - , flags_ (0) - , mutex_ () +ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::ACE_Connector (ACE_Reactor *r, + int flags) { ACE_TRACE ("ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::ACE_Connector"); (void) this->open (r, flags); } -template <class SVC_HANDLER> -ACE_Svc_Tuple<SVC_HANDLER>::ACE_Svc_Tuple ( - SVC_HANDLER *sh, - ACE_HANDLE handle, - const void *arg, - long id) - : svc_handler_ (sh), - handle_ (handle), - arg_ (arg), - cancellation_id_ (id), - refcount_ (1) -{ - ACE_TRACE ("ACE_Svc_Tuple<SVC_HANDLER>::ACE_Svc_Tuple"); -} - -template <class SVC_HANDLER> -ACE_Svc_Tuple<SVC_HANDLER>::~ACE_Svc_Tuple (void) -{ -} - -template <class SVC_HANDLER> SVC_HANDLER * -ACE_Svc_Tuple<SVC_HANDLER>::svc_handler (void) -{ - ACE_TRACE ("ACE_Svc_Tuple<SVC_HANDLER>::svc_handler"); - return this->svc_handler_; -} - -template <class SVC_HANDLER> const void * -ACE_Svc_Tuple<SVC_HANDLER>::arg (void) -{ - ACE_TRACE ("ACE_Svc_Tuple<SVC_HANDLER>::arg"); - return this->arg_; -} - -template <class SVC_HANDLER> void -ACE_Svc_Tuple<SVC_HANDLER>::arg (const void *v) -{ - ACE_TRACE ("ACE_Svc_Tuple<SVC_HANDLER>::arg"); - this->arg_ = v; -} - -template <class SVC_HANDLER> ACE_HANDLE -ACE_Svc_Tuple<SVC_HANDLER>::handle (void) -{ - ACE_TRACE ("ACE_Svc_Tuple<SVC_HANDLER>::handle"); - return this->handle_; -} - -template <class SVC_HANDLER> void -ACE_Svc_Tuple<SVC_HANDLER>::handle (ACE_HANDLE h) -{ - ACE_TRACE ("ACE_Svc_Tuple<SVC_HANDLER>::handle"); - this->handle_ = h; -} - -template <class SVC_HANDLER> long -ACE_Svc_Tuple<SVC_HANDLER>::cancellation_id (void) -{ - ACE_TRACE ("ACE_Svc_Tuple<SVC_HANDLER>::cancellation_id"); - return this->cancellation_id_; -} - -template <class SVC_HANDLER> void -ACE_Svc_Tuple<SVC_HANDLER>::cancellation_id (long id) -{ - ACE_TRACE ("ACE_Svc_Tuple<SVC_HANDLER>::cancellation_id"); - this->cancellation_id_ = id; -} - -template <class SVC_HANDLER> long -ACE_Svc_Tuple<SVC_HANDLER>::incr_refcount (void) -{ - ACE_TRACE ("ACE_Svc_Tuple<SVC_HANDLER>::incr_refcount"); - return ++this->refcount_; -} - -template <class SVC_HANDLER> long -ACE_Svc_Tuple<SVC_HANDLER>::decr_refcount (void) -{ - ACE_TRACE ("ACE_Svc_Tuple<SVC_HANDLER>::decr_refcount"); - if (--this->refcount_ > 0) - return this->refcount_; - - ACE_ASSERT (this->refcount_ == 0); - - delete this; - - return 0; -} - -template <class SVC_HANDLER> void -ACE_Svc_Tuple<SVC_HANDLER>::dump (void) const -{ - ACE_TRACE ("ACE_Svc_Tuple<SVC_HANDLER>::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("svc_handler_ = %x"), this->svc_handler_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\narg_ = %x"), this->arg_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ncancellation_id_ = %d"), this->cancellation_id_)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -} - -// This method is called if a connection times out before completing. -// In this case, we call our cleanup_AST() method to cleanup the -// descriptor from the ACE_Connector's table. - -template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> int -ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::handle_timeout ( - const ACE_Time_Value &tv, - const void *arg) -{ - ACE_TRACE ("ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::handle_timeout"); - AST *ast = 0; - - if (this->cleanup_AST (((AST *) arg)->handle (), - ast) == -1) - { - // Matches the creation time refcount for AST, which is 1 - this->decr_ast_refcount ((AST *) arg); - return -1; - } - else - { - ACE_ASSERT (((AST *) arg) == ast); - - // We may need this seemingly unnecessary assignment to work - // around a bug with MSVC++? - SVC_HANDLER *sh = ast->svc_handler (); - - // Forward to the SVC_HANDLER the <arg> that was passed in as a - // magic cookie during ACE_Connector::connect(). This gives the - // SVC_HANDLER an opportunity to take corrective action (e.g., - // wait a few milliseconds and try to reconnect again. - int result = sh->handle_timeout (tv, ast->arg ()); - - // Matches the creation time refcount for AST, which is 1. - this->decr_ast_refcount (ast); - - if (result == -1) - sh->handle_close (sh->get_handle (), - ACE_Event_Handler::TIMER_MASK); - - return 0; - } -} - template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> int -ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::cleanup_AST ( - ACE_HANDLE handle, - ACE_Svc_Tuple<SVC_HANDLER> *&ast) -{ - ACE_TRACE ("ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::cleanup_AST"); - - ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, - ace_mon, - this->mutex_, - -1)); - - // Locate the ACE_Svc_Handler corresponding to the socket - // descriptor. - if (this->handler_map_.unbind (handle, ast) == -1) - { - // Error, entry not found in map. - errno = ENOENT; - return -1; - } - - // Matches incr_refcount () in create_AST () after registering - // with the map. - ast->decr_refcount (); - - // Try to remove from ACE_Timer_Queue but if it's not there we - // ignore the error. - if (this->reactor ()->cancel_timer (ast->cancellation_id ())) - { - // Matches incr_refcount () in create_AST () after registering - // the timer - ast->decr_refcount (); - } - - - ACE_Reactor_Mask m = - ACE_Event_Handler::ALL_EVENTS_MASK | ACE_Event_Handler::DONT_CALL; - - // Remove ACE_HANDLE from ACE_Reactor. - if (this->reactor ()->remove_handler (handle, m) == 0) - { - // Matches incr_refcount () in create_AST () after registering - // with the Reactor. - ast->decr_refcount (); - } - return 0; -} - -// Called when a failure occurs during asynchronous connection -// establishment. Simply delegate all work to this->handle_output(). - -template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> int -ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::handle_input (ACE_HANDLE h) -{ - ACE_TRACE ("ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::handle_input"); - AST *ast = 0; - - if (this->cleanup_AST (h, ast) != -1) - { - ACE_ASSERT (ast != 0); - ast->svc_handler ()->close (0); - - // Matches the creation time refcount for AST, which is 1 - this->decr_ast_refcount (ast); - } - - return 0; // Already removed from the ACE_Reactor. -} - -// Finalize a connection established in non-blocking mode. When a -// non-blocking connect *succeeds* the descriptor becomes enabled for -// writing... Likewise, it is generally the case that when a -// non-blocking connect *fails* the descriptor becomes enabled for -// reading. - -template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> int -ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::handle_output (ACE_HANDLE handle) -{ - ACE_TRACE ("ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::handle_output"); - AST *ast = 0; - - if (this->cleanup_AST (handle, ast) == -1) - { - return 0; - } - ACE_ASSERT (ast != 0); // This shouldn't happen! - - // Try to find out if the reactor uses event associations for the - // handles it waits on. If so we need to reset it. - int reset_new_handle = this->reactor ()->uses_event_associations (); - - if (reset_new_handle) - this->connector_.reset_new_handle (handle); - - // Transfer ownership of the ACE_HANDLE to the SVC_HANDLER. - ast->svc_handler ()->set_handle (handle); - - ACE_PEER_CONNECTOR_ADDR raddr; - - // Check to see if we're connected. - if (ast->svc_handler ()->peer ().get_remote_addr (raddr) != -1) - this->activate_svc_handler (ast->svc_handler ()); - else // Somethings gone wrong, so close down... - { -#if defined (ACE_WIN32) - // ACE_DEBUG ((LM_DEBUG, "errno %d; Sleeping to retry get_remote_addr\n", errno)); - // Win32 (at least prior to Windows 2000) has a timing problem. - // If you check to see if the connection has completed too fast, - // it will fail - so wait 35 milliseconds to let it catch up. - ACE_Time_Value tv (0, ACE_NON_BLOCKING_BUG_DELAY); - ACE_OS::sleep (tv); - if (ast->svc_handler ()->peer ().get_remote_addr (raddr) != -1) - this->activate_svc_handler (ast->svc_handler ()); - else // do the svc handler close below... -#endif /* ACE_WIN32 */ - ast->svc_handler ()->close (0); - } - // Matches the creation time refcount for AST, which is 1 - this->decr_ast_refcount (ast); - return 0; -} - -template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> int -ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::resume_handler (void) -{ - return ACE_Event_Handler::ACE_EVENT_HANDLER_NOT_RESUMED; -} - -template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> int -ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::handle_exception (ACE_HANDLE h) -{ - ACE_TRACE ("ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::handle_exception"); - - // On Win32, the except mask must also be set for asynchronous - // connects. - - return this->handle_output (h); -} - -// Initiate connection to peer. - -template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> int -ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect ( - SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - const ACE_Synch_Options &synch_options, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms) -{ +ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect +(SVC_HANDLER *&sh, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + const ACE_Synch_Options &synch_options, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + int reuse_addr, + int flags, + int perms) +{ + // Initiate connection to peer. return this->connect_i (sh, 0, remote_addr, @@ -460,16 +324,17 @@ ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect ( } template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> int -ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect ( - SVC_HANDLER *&sh, - SVC_HANDLER *&sh_copy, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - const ACE_Synch_Options &synch_options, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms) -{ +ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect +(SVC_HANDLER *&sh, + SVC_HANDLER *&sh_copy, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + const ACE_Synch_Options &synch_options, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + int reuse_addr, + int flags, + int perms) +{ + // Initiate connection to peer. return this->connect_i (sh, &sh_copy, remote_addr, @@ -481,15 +346,15 @@ ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect ( } template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> int -ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect_i ( - SVC_HANDLER *&sh, - SVC_HANDLER **sh_copy, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - const ACE_Synch_Options &synch_options, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms) +ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect_i +(SVC_HANDLER *&sh, + SVC_HANDLER **sh_copy, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + const ACE_Synch_Options &synch_options, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + int reuse_addr, + int flags, + int perms) { ACE_TRACE ("ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect_i"); @@ -526,60 +391,57 @@ ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect_i ( flags, perms); + // Activate immediately if we are connected. + if (result != -1) + return this->activate_svc_handler (sh); + // Delegate to connection strategy. - if (result == -1) + if (use_reactor && errno == EWOULDBLOCK) { - if (use_reactor && errno == EWOULDBLOCK) - { - // If the connection hasn't completed and we are using - // non-blocking semantics then register ourselves with the - // ACE_Reactor so that it will call us back when the - // connection is complete or we timeout, whichever comes - // first... - int result; - - if (sh_copy == 0) - result = this->create_AST (sh, synch_options); - else - result = this->create_AST (*sh_copy, synch_options); - - // If for some reason the <create_AST> call failed, then - // <errno> will be set to the new error. If the call - // succeeds, however, we need to make sure that <errno> - // remains set to <EWOULDBLOCK>. - if (result == 0) - errno = EWOULDBLOCK; - } + // If the connection hasn't completed and we are using + // non-blocking semantics then register + // ACE_NonBlocking_Connect_Handler with the ACE_Reactor so that + // it will call us back when the connection is complete or we + // timeout, whichever comes first... + int result; + + if (sh_copy == 0) + result = this->nonblocking_connect (sh, synch_options); else + result = this->nonblocking_connect (*sh_copy, synch_options); + + // If for some reason the <nonblocking_connect> call failed, then <errno> + // will be set to the new error. If the call succeeds, however, + // we need to make sure that <errno> remains set to + // <EWOULDBLOCK>. + if (result == 0) + errno = EWOULDBLOCK; + } + else + { + // Save/restore errno. + ACE_Errno_Guard error (errno); + // Make sure to close down the service handler to avoid handle + // leaks. + if (sh_copy == 0) { - // Save/restore errno. - ACE_Errno_Guard error (errno); - // Make sure to close down the service handler to avoid - // handle leaks. - if (sh_copy == 0) - { - if (sh) - sh->close (0); - } - else if (*sh_copy) - (*sh_copy)->close (0); + if (sh) + sh->close (0); } - return -1; + else if (*sh_copy) + (*sh_copy)->close (0); } - else - // Activate immediately if we are connected. - return this->activate_svc_handler (sh); -} -// Initiate connection to peer. + return -1; +} template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> int -ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect_n ( - size_t n, - SVC_HANDLER *sh[], - ACE_PEER_CONNECTOR_ADDR remote_addrs[], - ACE_TCHAR *failed_svc_handlers, - const ACE_Synch_Options &synch_options) +ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect_n +(size_t n, + SVC_HANDLER *sh[], + ACE_PEER_CONNECTOR_ADDR remote_addrs[], + ACE_TCHAR *failed_svc_handlers, + const ACE_Synch_Options &synch_options) { int result = 0; @@ -607,169 +469,210 @@ template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> int ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::cancel (SVC_HANDLER *sh) { ACE_TRACE ("ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::cancel"); - MAP_ITERATOR mi (this->handler_map_); - for (MAP_ENTRY *me = 0; - mi.next (me) != 0; - mi.advance ()) - if (me->int_id_->svc_handler () == sh) - { - AST *ast = 0; + ACE_Event_Handler *handler = + this->reactor ()->find_handler (sh->get_handle ()); - if (this->cleanup_AST (me->ext_id_, ast) != -1) - this->decr_ast_refcount (ast); + if (handler == 0) + return -1; - return 0; - } + ACE_Event_Handler_var safe_handler (handler); - return -1; -} + NBCH *nbch = + ACE_dynamic_cast (NBCH *, handler); + + if (nbch == 0) + return -1; -// Register the pending SVC_HANDLER with the map so that it can be -// activated later on when the connection complets. + nbch->close (); + + return 0; +} template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> int -ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::create_AST ( - SVC_HANDLER *sh, - const ACE_Synch_Options &synch_options) +ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::nonblocking_connect +(SVC_HANDLER *sh, + const ACE_Synch_Options &synch_options) { - ACE_TRACE ("ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::create_AST"); + ACE_TRACE ("ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::nonblocking_connect"); - ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, - ace_mon, - this->mutex_, - -1)); + // Must have a valid Reactor for non-blocking connects to work. + if (this->reactor () == 0) + return -1; - ACE_HANDLE handle = sh->get_handle (); - AST *ast; + // Register the pending SVC_HANDLER so that it can be activated + // later on when the connection completes. - // AST is created with a refcount - ACE_NEW_RETURN (ast, - AST (sh, - handle, - synch_options.arg (), -1), + ACE_HANDLE handle = sh->get_handle (); + long timer_id = -1; + ACE_Time_Value *tv = 0; + NBCH *nbch = 0; + + ACE_NEW_RETURN (nbch, + NBCH (*this, + sh, + -1), -1); - // Register this with the reactor for connection events. - ACE_Reactor_Mask mask = ACE_Event_Handler::CONNECT_MASK; - - // Bind ACE_Svc_Tuple with the ACE_HANDLE we're trying to connect. - if (this->handler_map_.bind (handle, ast) == -1) - goto fail1; + ACE_Event_Handler_var safe_nbch (nbch); - // Increment the refcount of the AST to indicate registration with - // the map. - ast->incr_refcount (); + // Exclusive access to the Reactor. + ACE_GUARD_RETURN (ACE_Lock, ace_mon, this->reactor ()->lock (), -1); + // Register handle with the reactor for connection events. + ACE_Reactor_Mask mask = ACE_Event_Handler::CONNECT_MASK; if (this->reactor ()->register_handler (handle, - this, + nbch, mask) == -1) - goto fail2; - - // Increment the refcount of the AST. This increment is for access - // from the Reactor. Though we register <this> with the Reactor, - // every dispatch from the Reactor actually looks for <ast> and - // hence the refcount increment. - (void) ast->incr_refcount (); - - { - // If we're starting connection under timer control then we need to - // schedule a timeout with the ACE_Reactor. - ACE_Time_Value *tv = - ACE_const_cast (ACE_Time_Value *, - synch_options.time_value ()); - if (tv != 0) - { - int cancellation_id = - this->reactor ()->schedule_timer - (this, - (const void *) ast, - *tv); - if (cancellation_id == -1) - goto fail3; - - // Increment the refcount of the AST. This increment is for access - // from the timer queue. The same argument used for Rector - // registration holds true here too. - (void) ast->incr_refcount (); - - ast->cancellation_id (cancellation_id); - return 0; - } - } - return 0; // Ok, everything worked just fine... + goto reactor_registration_failure; + + // Add handle to non-blocking handle set. + this->non_blocking_handles ().set_bit (handle); + + // If we're starting connection under timer control then we need to + // schedule a timeout with the ACE_Reactor. + tv = ACE_const_cast (ACE_Time_Value *, + synch_options.time_value ()); + if (tv == 0) + return 0; + + timer_id = + this->reactor ()->schedule_timer (nbch, + synch_options.arg (), + *tv); + if (timer_id == -1) + goto timer_registration_failure; + + // Remember timer id. + nbch->timer_id (timer_id); + + // Everything was successful. + return 0; // Undo previous actions using the ol' "goto label and fallthru" // trick... -fail3: - this->reactor ()->remove_handler - (this, mask | ACE_Event_Handler::DONT_CALL); - /* FALLTHRU */ -fail2: - this->handler_map_.unbind (handle); + timer_registration_failure: + + // Remove from Reactor. + this->reactor ()->remove_handler (handle, mask); + + // Remove handle from the set of non-blocking handles. + this->non_blocking_handles ().clr_bit (handle); + /* FALLTHRU */ -fail1: + reactor_registration_failure: // Close the svc_handler + sh->close (0); - ast->decr_refcount (); return -1; } -// Terminate the Client ACE_Connector by iterating over any -// unconnected ACE_Svc_Handler's and removing them from the -// ACE_Reactor. Note that we can't call handle_close() back at this -// point since we own these things and we'll just get called -// recursively! +template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> +ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::~ACE_Connector (void) +{ + ACE_TRACE ("ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::~ACE_Connector"); + + this->close (); +} + +template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> void +ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::initialize_svc_handler +(ACE_HANDLE handle, + SVC_HANDLER *svc_handler) +{ + // Try to find out if the reactor uses event associations for the + // handles it waits on. If so we need to reset it. + int reset_new_handle = + this->reactor ()->uses_event_associations (); -template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> int -ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::close (void) + if (reset_new_handle) + this->connector_.reset_new_handle (handle); + + // Transfer ownership of the ACE_HANDLE to the SVC_HANDLER. + svc_handler->set_handle (handle); + + ACE_PEER_CONNECTOR_ADDR raddr; + + // Check to see if we're connected. + if (svc_handler->peer ().get_remote_addr (raddr) != -1) + this->activate_svc_handler (svc_handler); + else // Somethings gone wrong, so close down... + { +#if defined (ACE_WIN32) + // Win32 (at least prior to Windows 2000) has a timing problem. + // If you check to see if the connection has completed too fast, + // it will fail - so wait 35 milliseconds to let it catch up. + ACE_Time_Value tv (0, ACE_NON_BLOCKING_BUG_DELAY); + ACE_OS::sleep (tv); + if (svc_handler->peer ().get_remote_addr (raddr) != -1) + this->activate_svc_handler (svc_handler); + else // do the svc handler close below... +#endif /* ACE_WIN32 */ + svc_handler->close (0); + } +} + +template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> void +ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::reactor (ACE_Reactor *reactor) { - ACE_TRACE ("ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::close"); - return this->handle_close (); + this->reactor_ = reactor; +} + +template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> ACE_Reactor * +ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::reactor (void) const +{ + return this->reactor_; +} + +template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> ACE_Handle_Set & +ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::non_blocking_handles (void) +{ + return this->non_blocking_handles_; } template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> int -ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::handle_close (ACE_HANDLE, ACE_Reactor_Mask) +ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::close (void) { - ACE_TRACE ("ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::handle_close"); + // If there are no non-blocking handle pending, return immediately. + if (this->non_blocking_handles ().num_set () == 0) + return 0; - if (this->reactor () != 0 && this->closing_ == 0) + // Exclusive access to the Reactor. + ACE_GUARD_RETURN (ACE_Lock, ace_mon, this->reactor ()->lock (), -1); + + // Go through all the non-blocking handles. It is necessary to + // create a new iterator each time because we remove from the handle + // set when we cancel the Svc_Handler. + while (1) { - // We're closing down now, so make sure not to call ourselves - // recursively via other calls to handle_close() (e.g., from the - // Timer_Queue). - this->closing_ = 1; + ACE_Handle_Set_Iterator iterator (this->non_blocking_handles ()); + ACE_HANDLE handle = iterator (); - for (;;) - { - // Create an iterator. - MAP_ITERATOR iterator = this->handler_map_.begin (); + if (handle == ACE_INVALID_HANDLE) + break; - // If we reach the end of the map, break the loop. - if (iterator == this->handler_map_.end ()) - break; + ACE_Event_Handler *handler = + this->reactor ()->find_handler (handle); - // Get the first handle. - ACE_HANDLE handle = (*iterator).ext_id_; + ACE_ASSERT (handler != 0); - // Clean it up. - AST *ast = 0; - int r = this->cleanup_AST (handle, ast); + ACE_Event_Handler_var safe_handler (handler); - // Close the svc_handler. - if (r != -1) - { - ACE_ASSERT (ast != 0); - ast->svc_handler ()->close (0); + NBCH *nbch = + ACE_dynamic_cast (NBCH *, handler); - // Zap the ast. - this->decr_ast_refcount (ast); - } + ACE_ASSERT (nbch != 0); + SVC_HANDLER *svc_handler = + nbch->svc_handler (); - } + // Cancel the non-blocking connection. + this->cancel (svc_handler); + + // Close the associated Svc_Handler. + svc_handler->close (0); } return 0; @@ -780,12 +683,7 @@ ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::fini (void) { ACE_TRACE ("ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::fini"); - // Make sure to call close here since our destructor might not be - // called if we're being dynamically linked via the svc.conf. - this->handler_map_.close (); - - // Make sure we call our handle_close(), not a subclass's! - return ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::handle_close (); + return this->close (); } // Hook called by the explicit dynamic linking facility. @@ -829,44 +727,9 @@ ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::info (ACE_TCHAR **strp, size_t return ACE_static_cast (int, ACE_OS::strlen (buf)); } -template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> -ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::~ACE_Connector (void) -{ - ACE_TRACE ("ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::~ACE_Connector"); - // We will call our handle_close(), not a subclass's, due to the way - // that C++ destructors work. - this->handle_close (); -} - -template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> long -ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::incr_ast_refcount ( - ACE_Svc_Tuple<SVC_HANDLER> *ast) -{ - ACE_TRACE ("ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::incr_ast_refcount"); - ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, - ace_mon, - this->mutex_, - -1)); - - return ast->incr_refcount (); -} - -template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> long -ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::decr_ast_refcount ( - ACE_Svc_Tuple<SVC_HANDLER> *ast) -{ - ACE_TRACE ("ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::decr_ast_refcount"); - ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, - ace_mon, - this->mutex_, - -1)); - - return ast->decr_refcount (); -} - -/***********************************************************/ template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> int -ACE_Strategy_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::open (ACE_Reactor *r, int flags) +ACE_Strategy_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::open (ACE_Reactor *r, + int flags) { ACE_TRACE ("ACE_Strategy_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::open"); return this->open (r, 0, 0, 0, flags); @@ -874,11 +737,11 @@ ACE_Strategy_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::open (ACE_Reactor *r, template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> int ACE_Strategy_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::open - (ACE_Reactor *r, - ACE_Creation_Strategy<SVC_HANDLER> *cre_s, - ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2> *conn_s, - ACE_Concurrency_Strategy<SVC_HANDLER> *con_s, - int flags) +(ACE_Reactor *r, + ACE_Creation_Strategy<SVC_HANDLER> *cre_s, + ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2> *conn_s, + ACE_Concurrency_Strategy<SVC_HANDLER> *con_s, + int flags) { ACE_TRACE ("ACE_Strategy_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::open"); @@ -922,15 +785,15 @@ ACE_Strategy_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::open this->delete_connect_strategy_ = 0; } - if (conn_s != 0) - this->connect_strategy_ = conn_s; - else if (this->connect_strategy_ == 0) - { - ACE_NEW_RETURN (this->connect_strategy_, - CONNECT_STRATEGY, - -1); - this->delete_connect_strategy_ = 1; - } + if (conn_s != 0) + this->connect_strategy_ = conn_s; + else if (this->connect_strategy_ == 0) + { + ACE_NEW_RETURN (this->connect_strategy_, + CONNECT_STRATEGY, + -1); + this->delete_connect_strategy_ = 1; + } // Initialize the concurrency strategy. @@ -958,17 +821,17 @@ ACE_Strategy_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::open template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> ACE_Strategy_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::ACE_Strategy_Connector - (ACE_Reactor *reactor, - ACE_Creation_Strategy<SVC_HANDLER> *cre_s, - ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2> *conn_s, - ACE_Concurrency_Strategy<SVC_HANDLER> *con_s, - int flags) - : creation_strategy_ (0), - delete_creation_strategy_ (0), - connect_strategy_ (0), - delete_connect_strategy_ (0), - concurrency_strategy_ (0), - delete_concurrency_strategy_ (0) +(ACE_Reactor *reactor, + ACE_Creation_Strategy<SVC_HANDLER> *cre_s, + ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2> *conn_s, + ACE_Concurrency_Strategy<SVC_HANDLER> *con_s, + int flags) + : creation_strategy_ (0), + delete_creation_strategy_ (0), + connect_strategy_ (0), + delete_connect_strategy_ (0), + concurrency_strategy_ (0), + delete_concurrency_strategy_ (0) { ACE_TRACE ("ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::ACE_Strategy_Connector"); @@ -1014,13 +877,13 @@ ACE_Strategy_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::make_svc_handler (SVC template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> int ACE_Strategy_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect_svc_handler - (SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms) +(SVC_HANDLER *&sh, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + ACE_Time_Value *timeout, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + int reuse_addr, + int flags, + int perms) { return this->connect_strategy_->connect_svc_handler (sh, remote_addr, @@ -1033,14 +896,14 @@ ACE_Strategy_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect_svc_handler template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> int ACE_Strategy_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect_svc_handler - (SVC_HANDLER *&sh, - SVC_HANDLER *&sh_copy, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms) +(SVC_HANDLER *&sh, + SVC_HANDLER *&sh_copy, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + ACE_Time_Value *timeout, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + int reuse_addr, + int flags, + int perms) { return this->connect_strategy_->connect_svc_handler (sh, sh_copy, diff --git a/ace/Connector.h b/ace/Connector.h index 8fd528e383a..42f6204b118 100644 --- a/ace/Connector.h +++ b/ace/Connector.h @@ -21,29 +21,49 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/Map_Manager.h" #include "ace/Strategies_T.h" #include "ace/Synch_Options.h" - /** - * @class ACE_Svc_Tuple + * @class ACE_Connector_Base * - * @brief Holds the ACE_Svc_Handler and its argument and - * <ACE_Timer_Handle> until an asynchronous connection completes. + * @brief This base interface allows ACE_NonBlocking_Connect_Handler + * to only care about the SVC_HANDLER template parameter of the + * ACE_Connector. Otherwise, ACE_NonBlocking_Connect_Handler would + * have to be configured with all the template parameters that + * ACE_Connector is configured with. + */ +template <class SVC_HANDLER> +class ACE_Connector_Base +{ +public: + + /// Initialize the Svc_Handler. + virtual void initialize_svc_handler (ACE_HANDLE handle, + SVC_HANDLER *svc_handler) = 0; + + /// Return the handle set representing the non-blocking connects in + /// progress. + virtual ACE_Handle_Set &non_blocking_handles (void) = 0; +}; + +/** + * @class ACE_NonBlocking_Connect_Handler * - * This is a no-brainer... + * @brief Performs non-blocking connects on behalf of the Connector. */ template <class SVC_HANDLER> -class ACE_Svc_Tuple +class ACE_NonBlocking_Connect_Handler : public ACE_Event_Handler { public: - // = Initialization methods. - ACE_Svc_Tuple (SVC_HANDLER *, - ACE_HANDLE, - const void * = 0, - long timer_id = -1); + // Constructor. + ACE_NonBlocking_Connect_Handler (ACE_Connector_Base<SVC_HANDLER> &connector, + SVC_HANDLER *, + long timer_id); + + /// Close up and return underlying SVC_HANDLER *. + SVC_HANDLER *close (void); /// Get SVC_HANDLER. SVC_HANDLER *svc_handler (void); @@ -55,25 +75,31 @@ public: /// Set handle. void handle (ACE_HANDLE); - // = Get/set argument. - /// Get argument. - const void *arg (void); + // = Set/get timer id. + /// Get timer id. + long timer_id (void); - /// Set argument. - void arg (const void *); + /// Set timer id. + void timer_id (long timer_id); - // = Set/get timer cancellation handle. - /// Get cancellation id. - long cancellation_id (void); + /// Called by ACE_Reactor when asynchronous connections fail. + virtual int handle_input (ACE_HANDLE); - /// Set cancellation id. - void cancellation_id (long timer_id); + /// Called by ACE_Reactor when asynchronous connections succeed. + virtual int handle_output (ACE_HANDLE); - /// Increment and decrement refcount within the context of the lock - /// on the ACE_Connector - long incr_refcount (void); + /// Called by ACE_Reactor when asynchronous connections suceeds (on + /// some platforms only). + virtual int handle_exception (ACE_HANDLE fd); - long decr_refcount (void); + /// This method is called if a connection times out before + /// completing. + virtual int handle_timeout (const ACE_Time_Value &tv, + const void *arg); + + /// Should Reactor resume us if we have been suspended before the + /// upcall? + virtual int resume_handler (void); /// Dump the state of an object. void dump (void) const; @@ -81,27 +107,16 @@ public: /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; -protected: - /// Prevent direct deletion - ~ACE_Svc_Tuple (void); - private: - /// Associated SVC_HANDLER. - SVC_HANDLER *svc_handler_; - - /// IPC <HANDLE> that we are trying to connect. - ACE_HANDLE handle_; - /// Associated argument. - const void *arg_; + /// Connector base. + ACE_Connector_Base<SVC_HANDLER> &connector_; - /// Associated cancellation id. - long cancellation_id_; + /// Associated SVC_HANDLER. + SVC_HANDLER *svc_handler_; - /// Reference count manipulated within the context of the connector - /// lock. - /// @@ TODO: Things will change after 5.3 goes out of the way. - long refcount_; + /// Associated timer id. + long timer_id_; }; /** @@ -110,22 +125,17 @@ private: * @brief Generic factory for actively connecting clients and creating * service handlers (SVC_HANDLERs). * - * Implements the strategy for actively establishing connections - * with clients. An ACE_Connector is parameterized by concrete - * types that conform to the interfaces of PEER_CONNECTOR and - * SVC_HANDLER. The PEER_CONNECTOR is instantiated with a - * transport mechanism that passively establishes connections. - * The SVC_HANDLER is instantiated with a concrete type that - * performs the application-specific service. An ACE_Connector - * inherits from ACE_Service_Object, which in turn inherits from - * ACE_Event_Handler. This enables the ACE_Reactor to dispatch - * the ACE_Connector's handle_output method when connections - * complete asynchronously. The handle_output method performs - * the connector's active connection establishment and service - * activation strategy. + * Implements the strategy for actively establishing connections with + * clients. An ACE_Connector is parameterized by concrete types that + * conform to the interfaces of PEER_CONNECTOR and SVC_HANDLER. The + * PEER_CONNECTOR is instantiated with a transport mechanism that + * actively establishes connections. The SVC_HANDLER is instantiated + * with a concrete type that performs the application-specific + * service. Both blocking and non-blocking connects are supported. + * Further, non-blocking connects support timeouts. */ template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> -class ACE_Connector : public ACE_Service_Object +class ACE_Connector : public ACE_Connector_Base<SVC_HANDLER>, public ACE_Service_Object { public: @@ -135,14 +145,13 @@ public: typedef SVC_HANDLER handler_type; typedef ACE_TYPENAME SVC_HANDLER::stream_type stream_type; - // typedef ACE_TYPENAME ACE_PEER_CONNECTOR_ADDR PEER_ADDR; #if defined (ACE_HAS_TYPENAME_KEYWORD) typedef ACE_PEER_CONNECTOR_ADDR ACE_PEER_ADDR_TYPEDEF; #endif /* ACE_HAS_TYPENAME_KEYWORD */ typedef ACE_TYPENAME _ACE_PEER_CONNECTOR::PEER_ADDR - ACE_TYPENAME_ACE_PEER_CONNECTOR_PEER_ADDR; + ACE_TYPENAME_ACE_PEER_CONNECTOR_PEER_ADDR; /** * Initialize a connector. @a flags indicates how <SVC_HANDLER>'s @@ -182,7 +191,7 @@ public: const ACE_PEER_CONNECTOR_ADDR &remote_addr, const ACE_Synch_Options &synch_options = ACE_Synch_Options::defaults, const ACE_PEER_CONNECTOR_ADDR &local_addr - = (ACE_TYPENAME_ACE_PEER_CONNECTOR_PEER_ADDR &) ACE_PEER_CONNECTOR_ADDR_ANY, + = (ACE_TYPENAME_ACE_PEER_CONNECTOR_PEER_ADDR &) ACE_PEER_CONNECTOR_ADDR_ANY, int reuse_addr = 0, int flags = O_RDWR, int perms = 0); @@ -202,7 +211,7 @@ public: const ACE_PEER_CONNECTOR_ADDR &remote_addr, const ACE_Synch_Options &synch_options = ACE_Synch_Options::defaults, const ACE_PEER_CONNECTOR_ADDR &local_addr - = (ACE_TYPENAME_ACE_PEER_CONNECTOR_PEER_ADDR &) ACE_PEER_CONNECTOR_ADDR_ANY, + = (ACE_TYPENAME_ACE_PEER_CONNECTOR_PEER_ADDR &) ACE_PEER_CONNECTOR_ADDR_ANY, int reuse_addr = 0, int flags = O_RDWR, int perms = 0); @@ -230,12 +239,23 @@ public: */ virtual int cancel (SVC_HANDLER *svc_handler); - /// Close down the Connector + /// Close down the Connector. All pending non-blocking connects are + /// canceled and the corresponding svc_handler is closed. virtual int close (void); /// Return the underlying PEER_CONNECTOR object. virtual ACE_PEER_CONNECTOR &connector (void) const; + /// Initialize Svc_Handler. + virtual void initialize_svc_handler (ACE_HANDLE handle, + SVC_HANDLER *svc_handler); + + /// Set Reactor. + virtual void reactor (ACE_Reactor *reactor); + + /// Get Reactor. + virtual ACE_Reactor *reactor (void) const; + /// Dump the state of an object. void dump (void) const; @@ -244,16 +264,7 @@ public: protected: // = Helpful typedefs. - - typedef ACE_Svc_Tuple<SVC_HANDLER> - AST; - - typedef ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<SVC_HANDLER> *, ACE_SYNCH_RW_MUTEX> - MAP_MANAGER; - typedef ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<SVC_HANDLER> *, ACE_SYNCH_RW_MUTEX> - MAP_ITERATOR; - typedef ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<SVC_HANDLER> *> - MAP_ENTRY; + typedef ACE_NonBlocking_Connect_Handler<SVC_HANDLER> NBCH; // = The following two methods define the Connector's strategies for // creating, connecting, and activating SVC_HANDLER's, respectively. @@ -302,17 +313,23 @@ protected: */ virtual int activate_svc_handler (SVC_HANDLER *svc_handler); - /// Called by ACE_Reactor when asynchronous connections fail. - virtual int handle_input (ACE_HANDLE); + /// Creates and registers ACE_NonBlocking_Connect_Handler. + int nonblocking_connect (SVC_HANDLER *, + const ACE_Synch_Options &); - /// Called by ACE_Reactor when asynchronous connections succeed. - virtual int handle_output (ACE_HANDLE); - - virtual int resume_handler (void); + /// Implementation the <connect> methods. + virtual int connect_i (SVC_HANDLER *&svc_handler, + SVC_HANDLER **sh_copy, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + const ACE_Synch_Options &synch_options, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + int reuse_addr, + int flags, + int perms); - /// Called by ACE_Reactor when asynchronous connections complete (on - /// some platforms only). - virtual int handle_exception (ACE_HANDLE fd = ACE_INVALID_HANDLE); + /// Return the handle set representing the non-blocking connects in + /// progress. + ACE_Handle_Set &non_blocking_handles (void); // = Dynamic linking hooks. /// Default version does no work and returns -1. Must be overloaded @@ -325,20 +342,6 @@ protected: /// Default version returns address info in <buf>. virtual int info (ACE_TCHAR **, size_t) const; - // = Demultiplexing hooks. - /** - * Terminate the Client ACE_Connector by iterating over any - * unconnected ACE_Svc_Handler's and removing them from the - * ACE_Reactor. - */ - virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE, - ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); - - /// This method is called if a connection times out before - /// completing. - virtual int handle_timeout (const ACE_Time_Value &tv, - const void *arg); - // = Service management hooks. /// Default version does no work and returns -1. Must be overloaded /// by application developer to do anything meaningful. @@ -348,43 +351,10 @@ protected: /// by application developer to do anything meaningful. virtual int resume (void); - /// Creates and inserts an ACE_Svc_Tuple into the <handler_map_>. - /// so that we can continue accepting this connection asynchronously. - int create_AST (SVC_HANDLER *, - const ACE_Synch_Options &); - - /// Cleanup the <handler_map_> and returns the appropriate - /// ACE_Svc_Tuple (which is 0 if there is no associated tuple). - int cleanup_AST (ACE_HANDLE handle, AST *&ast); - - /// Implementation the <connect> methods. - virtual int connect_i (SVC_HANDLER *&svc_handler, - SVC_HANDLER **sh_copy, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - const ACE_Synch_Options &synch_options, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms); - - - /// Helper method for manipulating the refcount on AST. It holds the - /// lock before manipulating the refcount on AST. - /// @@ TODO: Needs to be out after 5.3 - long incr_ast_refcount (AST *ast); - long decr_ast_refcount (AST *ast); - - /// Lookup table that maps an I/O handle to a SVC_HANDLER *. - MAP_MANAGER handler_map_; private: - /// This is the concrete connector factory (it keeps no state so the - /// <ACE_Connector> is reentrant). + /// This is the peer connector factory. ACE_PEER_CONNECTOR connector_; - /// Keeps track of whether we are in the process of closing (required - /// to avoid circular calls to <handle_close>). - char closing_; - /** * Flags that indicate how <SVC_HANDLER>'s should be initialized * prior to being activated. Right now, the only flag that is @@ -393,10 +363,12 @@ private: */ int flags_; - /// Lock to synchronize access to the internal state of the - /// connector. - /// @@TODO: This needs to go after 1.3 - ACE_SYNCH_MUTEX mutex_; + /// Pointer to the Reactor. + ACE_Reactor *reactor_; + + /// Handle set representing the non-blocking connects in progress. + ACE_Handle_Set non_blocking_handles_; + }; /** @@ -421,23 +393,23 @@ public: // Useful STL-style traits. typedef ACE_Creation_Strategy<SVC_HANDLER> - creation_strategy_type; + creation_strategy_type; typedef ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2> - connect_strategy_type; + connect_strategy_type; typedef ACE_Concurrency_Strategy<SVC_HANDLER> - concurrency_strategy_type; + concurrency_strategy_type; typedef ACE_Connector <SVC_HANDLER, ACE_PEER_CONNECTOR_2> - base_type; + base_type; // = Define some useful (old style) traits. typedef ACE_Creation_Strategy<SVC_HANDLER> - CREATION_STRATEGY; + CREATION_STRATEGY; typedef ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2> - CONNECT_STRATEGY; + CONNECT_STRATEGY; typedef ACE_Concurrency_Strategy<SVC_HANDLER> - CONCURRENCY_STRATEGY; + CONCURRENCY_STRATEGY; typedef ACE_Connector <SVC_HANDLER, ACE_PEER_CONNECTOR_2> - SUPER; + SUPER; /** * Initialize a connector. <flags> indicates how <SVC_HANDLER>'s diff --git a/ace/Event_Handler.cpp b/ace/Event_Handler.cpp index 11b1c48b38e..aa96116f662 100644 --- a/ace/Event_Handler.cpp +++ b/ace/Event_Handler.cpp @@ -18,8 +18,10 @@ ACE_RCSID(ace, Event_Handler, "$Id$") ACE_Event_Handler::ACE_Event_Handler (ACE_Reactor *r, int p) - : priority_ (p), - reactor_ (r) + : reference_count_ (1) + , priority_ (p) + , reactor_ (r) + , reference_counting_policy_ (Reference_Counting_Policy::DISABLED) { // ACE_TRACE ("ACE_Event_Handler::ACE_Event_Handler"); } @@ -172,6 +174,58 @@ ACE_Event_Handler::reactor (void) const return this->reactor_; } +ACE_Reactor_Timer_Interface * +ACE_Event_Handler::reactor_timer_interface (void) const +{ + ACE_TRACE ("ACE_Event_Handler::reactor_timer_interface"); + return this->reactor_; +} + +ACE_Event_Handler::Reference_Count +ACE_Event_Handler::add_reference (void) +{ + return ++this->reference_count_; +} + +ACE_Event_Handler::Reference_Count +ACE_Event_Handler::remove_reference (void) +{ + Reference_Count result = + --this->reference_count_; + + if (result == 0) + delete this; + + return result; +} + +ACE_Event_Handler::Policy::~Policy (void) +{ +} + +ACE_Event_Handler::Reference_Counting_Policy::Reference_Counting_Policy (Reference_Counting_Policy::Value value) + : value_ (value) +{ +} + +ACE_Event_Handler::Reference_Counting_Policy::Value +ACE_Event_Handler::Reference_Counting_Policy::value (void) const +{ + return this->value_; +} + +void +ACE_Event_Handler::Reference_Counting_Policy::value (ACE_Event_Handler::Reference_Counting_Policy::Value value) +{ + this->value_ = value; +} + +ACE_Event_Handler::Reference_Counting_Policy & +ACE_Event_Handler::reference_counting_policy (void) +{ + return this->reference_counting_policy_; +} + #if !defined (ACE_HAS_WINCE) ACE_THR_FUNC_RETURN @@ -234,6 +288,92 @@ ACE_Event_Handler::remove_stdin_handler (ACE_Reactor *reactor, #endif /* ACE_HAS_WINCE */ +ACE_Event_Handler_var::ACE_Event_Handler_var (void) + : ptr_ (0) +{ +} + +ACE_Event_Handler_var::ACE_Event_Handler_var (ACE_Event_Handler *p) + : ptr_ (p) +{ +} + +ACE_Event_Handler_var::ACE_Event_Handler_var (const ACE_Event_Handler_var &b) + : ptr_ (b.ptr_) +{ + if (this->ptr_ != 0) + { + this->ptr_->add_reference (); + } +} + +ACE_Event_Handler_var::~ACE_Event_Handler_var (void) +{ + if (this->ptr_ != 0) + { + this->ptr_->remove_reference (); + } +} + +ACE_Event_Handler_var & +ACE_Event_Handler_var::operator= (ACE_Event_Handler *p) +{ + if (this->ptr_ == p) + return *this; + + if (this->ptr_ != 0) + this->ptr_->remove_reference (); + + this->ptr_ = p; + + return *this; +} + +ACE_Event_Handler_var & +ACE_Event_Handler_var::operator= (const ACE_Event_Handler_var &b) +{ + if (this->ptr_ != b.ptr_) + { + if (this->ptr_ != 0) + { + this->ptr_->remove_reference (); + } + + if ((this->ptr_ = b.ptr_) != 0) + { + this->ptr_->add_reference (); + } + } + + return *this; +} + +ACE_Event_Handler * +ACE_Event_Handler_var::operator->() const +{ + return this->ptr_; +} + +ACE_Event_Handler * +ACE_Event_Handler_var::handler (void) const +{ + return this->ptr_; +} + +ACE_Event_Handler * +ACE_Event_Handler_var::release (void) +{ + ACE_Event_Handler *old = this->ptr_; + this->ptr_ = 0; + return old; +} + +void +ACE_Event_Handler_var::reset (ACE_Event_Handler *p) +{ + *this = p; +} + ACE_Notification_Buffer::ACE_Notification_Buffer (void) { ACE_TRACE ("ACE_Notification_Buffer::ACE_Notification_Buffer"); diff --git a/ace/Event_Handler.h b/ace/Event_Handler.h index f3b60e9c2b5..7ddfb85e705 100644 --- a/ace/Event_Handler.h +++ b/ace/Event_Handler.h @@ -20,14 +20,16 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +// need to fix THR_DETACHED, then we can get rid of OS.h #include "ace/OS.h" #include "ace/os_include/os_signal.h" -// need to fix THR_DETACHED, then we can get rid of OS.h #include "ace/os_include/os_pthread.h" +#include "ace/Atomic_Op.h" // Forward declaration. class ACE_Message_Block; class ACE_Reactor; +class ACE_Reactor_Timer_Interface; class ACE_Thread_Manager; class ACE_Process; @@ -165,6 +167,9 @@ public: /// Get the event demultiplexors. virtual ACE_Reactor *reactor (void) const; + /// Get only the reactor's timer related interface. + virtual ACE_Reactor_Timer_Interface *reactor_timer_interface (void) const; + #if !defined (ACE_HAS_WINCE) /** * Used to read from non-socket ACE_HANDLEs in our own thread to @@ -193,11 +198,100 @@ public: ACE_Thread_Manager *thr_mgr); #endif /* ACE_HAS_WINCE */ + /// Reference count type. + typedef long Reference_Count; + + /// Increment reference count on the handler. + /** + * This method is called when the handler is registered with the + * Reactor and when the Reactor makes an upcall on the handler. + * Reference count is 1 when the handler is created. + * + * @return Current reference count. + */ + virtual Reference_Count add_reference (void); + + /// Decrement reference count on the handler. + /** + * This method is called when the handler is removed from the + * Reactor and when an upcall made on the handler by the Reactor + * completes. Handler is deleted when the reference count reaches + * 0. + * + * @return Current reference count. + */ + virtual Reference_Count remove_reference (void); + + /** + * @class Policy + * + * @brief Base class for all handler policies. + */ + class ACE_Export Policy + { + + public: + + /// Virtual destructor. + virtual ~Policy (void); + }; + + /** + * @class Reference_Counting_Policy + * + * @brief This policy dictates the reference counting requirements + * for the handler. + * + * This policy allows applications to configure whether it wants the + * Reactor to call add_reference() and remove_reference() during + * registrations, removals, and upcalls. + * + * <B>Default:</B> DISABLED. + */ + class ACE_Export Reference_Counting_Policy : public Policy + { + /// This policy can only be created by the handler. + friend class ACE_Event_Handler; + + public: + + enum Value + { + /// Perform reference counting. + ENABLED, + /// Don't perform reference counting. + DISABLED + }; + + /// Current Reference_Counting_Policy. + Value value (void) const; + + /// Update Reference_Counting_Policy. + void value (Value value); + + private: + + /// Private constructor. + Reference_Counting_Policy (Value value); + + /// The value of the policy. + Value value_; + }; + + /// Current Reference_Counting_Policy. + Reference_Counting_Policy &reference_counting_policy (void); + protected: /// Force ACE_Event_Handler to be an abstract base class. ACE_Event_Handler (ACE_Reactor * = 0, int priority = ACE_Event_Handler::LO_PRIORITY); + /// Typedef for implementation of reference counting. + typedef ACE_Atomic_Op<ACE_SYNCH_MUTEX, Reference_Count> Atomic_Reference_Count; + + /// Reference count. + Atomic_Reference_Count reference_count_; + private: /// Priority of this Event_Handler. @@ -205,6 +299,58 @@ private: /// Pointer to the various event demultiplexors. ACE_Reactor *reactor_; + + /// Reference counting requirements. + Reference_Counting_Policy reference_counting_policy_; +}; + +/** + * @class ACE_Event_Handler_var + * + * @brief Auto pointer like class for Event Handlers. + * + * Used to manage lifecycle of handlers. This class calls + * ACE_Event_Handler::remove_reference() in its destructor. + */ +class ACE_Export ACE_Event_Handler_var +{ + +public: + + /// Default constructor. + ACE_Event_Handler_var (void); + + /// Construct with a handler. + ACE_Event_Handler_var (ACE_Event_Handler *p); + + /// Copy constructor. + ACE_Event_Handler_var (const ACE_Event_Handler_var &b); + + /// Destructor. + ~ACE_Event_Handler_var (void); + + /// Assignment to a handler. + ACE_Event_Handler_var &operator= (ACE_Event_Handler *p); + + /// Assignment to a ACE_Event_Handler_var. + ACE_Event_Handler_var &operator= (const ACE_Event_Handler_var &b); + + /// Overloaded "->". + ACE_Event_Handler *operator-> () const; + + /// Access the handler. + ACE_Event_Handler *handler (void) const; + + /// Release the handler. + ACE_Event_Handler *release (void); + + /// Reset the handler. + void reset (ACE_Event_Handler *p = 0); + +private: + + /// Handler. + ACE_Event_Handler *ptr_; }; /** @@ -4482,14 +4482,16 @@ ACE_OS::event_timedwait (ACE_event_t *event, { event->waiting_threads_++; + ACE_Time_Value absolute_timeout = *timeout; + // cond_timewait() expects absolute time, check // <use_absolute_time> flag. - if (use_absolute_time == 0 && timeout != 0) - *timeout += ACE_OS::gettimeofday (); + if (use_absolute_time == 0) + absolute_timeout += ACE_OS::gettimeofday (); if (ACE_OS::cond_timedwait (&event->condition_, &event->lock_, - timeout) != 0) + &absolute_timeout) != 0) { result = -1; error = errno; diff --git a/ace/Proactor.cpp b/ace/Proactor.cpp index 85ea994f9b0..a2ed115ca66 100644 --- a/ace/Proactor.cpp +++ b/ace/Proactor.cpp @@ -164,13 +164,42 @@ ACE_Proactor_Handle_Timeout_Upcall::ACE_Proactor_Handle_Timeout_Upcall (void) } int -ACE_Proactor_Handle_Timeout_Upcall::timeout (TIMER_QUEUE &timer_queue, +ACE_Proactor_Handle_Timeout_Upcall::registration (TIMER_QUEUE &, + ACE_Handler *, + const void *) +{ + return 0; +} + +int +ACE_Proactor_Handle_Timeout_Upcall::preinvoke (TIMER_QUEUE &, + ACE_Handler *, + const void *, + int, + const ACE_Time_Value &, + const void *&) +{ + return 0; +} + +int +ACE_Proactor_Handle_Timeout_Upcall::postinvoke (TIMER_QUEUE &, + ACE_Handler *, + const void *, + int, + const ACE_Time_Value &, + const void *) +{ + return 0; +} + +int +ACE_Proactor_Handle_Timeout_Upcall::timeout (TIMER_QUEUE &, ACE_Handler *handler, const void *act, + int, const ACE_Time_Value &time) { - ACE_UNUSED_ARG (timer_queue); - if (this->proactor_ == 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT ("(%t) No Proactor set in ACE_Proactor_Handle_Timeout_Upcall,") @@ -201,25 +230,30 @@ ACE_Proactor_Handle_Timeout_Upcall::timeout (TIMER_QUEUE &timer_queue, } int -ACE_Proactor_Handle_Timeout_Upcall::cancellation (TIMER_QUEUE &timer_queue, - ACE_Handler *handler) +ACE_Proactor_Handle_Timeout_Upcall::cancel_type (TIMER_QUEUE &, + ACE_Handler *, + int, + int &) { - ACE_UNUSED_ARG (timer_queue); - ACE_UNUSED_ARG (handler); - // Do nothing return 0; } int -ACE_Proactor_Handle_Timeout_Upcall::deletion (TIMER_QUEUE &timer_queue, - ACE_Handler *handler, - const void *arg) +ACE_Proactor_Handle_Timeout_Upcall::cancel_timer (TIMER_QUEUE &, + ACE_Handler *, + int, + int) { - ACE_UNUSED_ARG (timer_queue); - ACE_UNUSED_ARG (handler); - ACE_UNUSED_ARG (arg); + // Do nothing + return 0; +} +int +ACE_Proactor_Handle_Timeout_Upcall::deletion (TIMER_QUEUE &, + ACE_Handler *, + const void *) +{ // Do nothing return 0; } diff --git a/ace/Proactor.h b/ace/Proactor.h index 53ddb9d1d39..cb60187a47d 100644 --- a/ace/Proactor.h +++ b/ace/Proactor.h @@ -66,15 +66,45 @@ public: /// Constructor. ACE_Proactor_Handle_Timeout_Upcall (void); + /// This method is called when a timer is registered. + int registration (TIMER_QUEUE &timer_queue, + ACE_Handler *handler, + const void *arg); + + /// This method is called before the timer expires. + int preinvoke (TIMER_QUEUE &timer_queue, + ACE_Handler *handler, + const void *arg, + int recurring_timer, + const ACE_Time_Value &cur_time, + const void *&upcall_act); + /// This method is called when the timer expires. int timeout (TIMER_QUEUE &timer_queue, - ACE_Handler *handler, - const void *arg, - const ACE_Time_Value &cur_time); - - /// This method is called when the timer is canceled. - int cancellation (TIMER_QUEUE &timer_queue, - ACE_Handler *handler); + ACE_Handler *handler, + const void *arg, + int recurring_timer, + const ACE_Time_Value &cur_time); + + /// This method is called after the timer expires. + int postinvoke (TIMER_QUEUE &timer_queue, + ACE_Handler *handler, + const void *arg, + int recurring_timer, + const ACE_Time_Value &cur_time, + const void *upcall_act); + + /// This method is called when a handler is canceled. + int cancel_type (TIMER_QUEUE &timer_queue, + ACE_Handler *handler, + int dont_call_handle_close, + int &requires_reference_counting); + + /// This method is called when a timer is canceled. + int cancel_timer (TIMER_QUEUE &timer_queue, + ACE_Handler *handler, + int dont_call_handle_close, + int requires_reference_counting); /// This method is called when the timer queue is destroyed and the /// timer is still contained in it. @@ -270,7 +300,7 @@ public: /// This method adds the <handle> to the I/O completion port. This /// function is a no-op function for Unix systems and returns 0; virtual int register_handle (ACE_HANDLE handle, - const void *completion_key); + const void *completion_key); // = Timer management. /** @@ -285,12 +315,12 @@ public: * failure (which is guaranteed never to be a valid <timer_id>). */ virtual long schedule_timer (ACE_Handler &handler, - const void *act, - const ACE_Time_Value &time); + const void *act, + const ACE_Time_Value &time); virtual long schedule_repeating_timer (ACE_Handler &handler, - const void *act, - const ACE_Time_Value &interval); + const void *act, + const ACE_Time_Value &interval); // Same as above except <interval> it is used to reschedule the // <handler> automatically. @@ -298,14 +328,14 @@ public: /// This combines the above two methods into one. Mostly for backward /// compatibility. virtual long schedule_timer (ACE_Handler &handler, - const void *act, - const ACE_Time_Value &time, - const ACE_Time_Value &interval); + const void *act, + const ACE_Time_Value &time, + const ACE_Time_Value &interval); /// Cancel all timers associated with this <handler>. Returns number /// of timers cancelled. virtual int cancel_timer (ACE_Handler &handler, - int dont_call_handle_close = 1); + int dont_call_handle_close = 1); /** * Cancel the single <ACE_Handler> that matches the <timer_id> value @@ -317,8 +347,8 @@ public: * wasn't found. */ virtual int cancel_timer (long timer_id, - const void **act = 0, - int dont_call_handle_close = 1); + const void **act = 0, + int dont_call_handle_close = 1); /** * Dispatch a single set of events, waiting up to a specified time limit @@ -616,7 +646,7 @@ class ACE_Export ACE_Proactor public: class Timer_Queue {}; ACE_Proactor (size_t /* number_of_threads */ = 0, - Timer_Queue * /* tq */ = 0) {} + Timer_Queue * /* tq */ = 0) {} virtual int handle_events (void) { return -1; } virtual int handle_events (ACE_Time_Value &) { return -1; } diff --git a/ace/Reactor.h b/ace/Reactor.h index d7f91a6df46..0c977b6712f 100644 --- a/ace/Reactor.h +++ b/ace/Reactor.h @@ -29,6 +29,9 @@ class ACE_Reactor_Impl; // declaration will not work #include "ace/Timer_Queue.h" +// Contains the timer related interface for the Reactor. +#include "ace/Reactor_Timer_Interface.h" + // Event_Handler.h contains the definition of ACE_Reactor_Mask #include "ace/Event_Handler.h" @@ -44,7 +47,7 @@ class ACE_Reactor_Impl; * its delegation/implementation class, e.g., * <ACE_Select_Reactor> or <ACE_WFMO_Reactor>. */ -class ACE_Export ACE_Reactor +class ACE_Export ACE_Reactor : public ACE_Reactor_Timer_Interface { public: /// Operations on the "ready" mask and the "dispatch" mask. @@ -295,56 +298,98 @@ public: virtual int handle_events (ACE_Time_Value &max_wait_time); virtual int alertable_handle_events (ACE_Time_Value &max_wait_time); - // = Register and remove Handlers. + // = Register and remove handlers. - /// Register <event_handler> with <mask>. The I/O handle will always - /// come from <get_handle> on the <event_handler>. + /** + * Register handler for I/O events. + * + * A handler can be associated with multiple handles. A handle + * cannot be associated with multiple handlers. + * + * The handle will come from ACE_Event_Handler::get_handle(). + * + * Reactor will call ACE_Event_Handler::add_reference() for a new + * handler/handle pair. + * + * If this handler/handle pair has already been registered, any new + * masks specified will be added. In this case, + * ACE_Event_Handler::add_reference() will not be called. + * + * If the registered handler is currently suspended, it will remain + * suspended. When the handler is resumed, it will have the + * existing masks plus any masks added through this call. Handlers + * do not have partial suspensions. + */ virtual int register_handler (ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask); - /// Register <event_handler> with <mask>. The I/O handle is provided - /// through the <io_handle> parameter. + /** + * Register handler for I/O events. + * + * Same as register_handler(ACE_Event_Handler*,ACE_Reactor_Mask), + * except handle is explicitly specified. + */ virtual int register_handler (ACE_HANDLE io_handle, ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask); #if defined (ACE_WIN32) + /** + * Register handler for OS events. + * * Register an <event_handler> that will be notified when - * <event_handle> is signaled. Since no event mask is passed - * through this interface, it is assumed that the <event_handle> - * being passed in is an event handle and not an I/O handle. + * <event_handle> is signaled. * - * Originally this interface was available for all platforms, but - * because ACE_HANDLE is an int on non-Win32 platforms, compilers - * are not able to tell the difference between + * Reactor will call ACE_Event_Handler::add_reference() for a new + * handler/handle pair. + * + * This interface is only available Win32 platforms because + * ACE_HANDLE is an int on non-Win32 platforms and compilers are not + * able to tell the difference between * register_handler(ACE_Event_Handler*,ACE_Reactor_Mask) and - * register_handler(ACE_Event_Handler*,ACE_HANDLE). Therefore, we - * have restricted this method to Win32 only. + * register_handler(ACE_Event_Handler*,ACE_HANDLE). */ virtual int register_handler (ACE_Event_Handler *event_handler, ACE_HANDLE event_handle = ACE_INVALID_HANDLE); + #endif /* ACE_WIN32 */ /** - * Register an <event_handler> that will be notified when - * <event_handle> is signaled. <mask> specifies the network events - * that the <event_handler> is interested in. + * Register handler for I/O events. + * + * Similar to + * register_handler(ACE_HANDLE,ACE_Event_Handler*,ACE_Reactor_Mask), + * except that the user gets to specify the event handle that will + * be used for this registration. This only applies to Reactors + * that use event handles for I/O registrations. */ virtual int register_handler (ACE_HANDLE event_handle, ACE_HANDLE io_handle, ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask); - /// Register <event_handler> with all the <handles> in the <Handle_Set>. + /** + * Register handler for multiple I/O events. + * + * Shorthand for calling + * register_handler(ACE_HANDLE,ACE_Event_Handler*,ACE_Reactor_Mask), + * multiple times for the same <event_handler> and <masks> but + * different <handles>. + */ virtual int register_handler (const ACE_Handle_Set &handles, ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask); + ACE_Reactor_Mask masks); /** + * Register handler for signals. + * * Register <new_sh> to handle the signal <signum> using the * <new_disp>. Returns the <old_sh> that was previously registered * (if any), along with the <old_disp> of the signal handler. + * + * Reactor will call ACE_Event_Handler::add_reference() on <new_sh> + * and ACE_Event_Handler::remove_reference() on <old_sh>. */ virtual int register_handler (int signum, ACE_Event_Handler *new_sh, @@ -352,78 +397,129 @@ public: ACE_Event_Handler **old_sh = 0, ACE_Sig_Action *old_disp = 0); - /// Registers <new_sh> to handle a set of signals <sigset> using the - /// <new_disp>. - virtual int register_handler (const ACE_Sig_Set &sigset, - ACE_Event_Handler *new_sh, - ACE_Sig_Action *new_disp = 0); - /** - * Removes <event_handler>. Note that the I/O handle will be - * obtained using <get_handle> method of <event_handler> . If - * <mask> includes <ACE_Event_Handler::DONT_CALL> then the - * <handle_close> method of the <event_handler> is not invoked. + * Register handler for multiple signals. + * + * Shorthand for calling + * register_handler(int,ACE_Event_Handler*,ACE_Sig_Action*,ACE_Event_Handler**,ACE_Sig_Action*) + * multiple times for the same <event_handler> and <sig_action> but + * different <signals>. */ - virtual int remove_handler (ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask); + virtual int register_handler (const ACE_Sig_Set &signals, + ACE_Event_Handler *event_handler, + ACE_Sig_Action *sig_action = 0); /** - * Removes the <ACE_Event_Handler> associated with <handle>. If - * <mask> includes <ACE_Event_Handler::DONT_CALL> then the - * <handle_close> method of the associated <event_handler> is not - * invoked. + * Remove <masks> from <handle> registration. + * + * For I/O handles, <masks> are removed from the Reactor. Unless + * <masks> includes <ACE_Event_Handler::DONT_CALL>, + * ACE_Event_Handler::handle_close() will be called with the <masks> + * that have been removed. If all masks have been removed, + * ACE_Event_Handler::remove_reference() will be called. + * + * For OS handles, the <handle> is removed from the Reactor. Unless + * <masks> includes <ACE_Event_Handler::DONT_CALL>, + * ACE_Event_Handler::handle_close() will be called with + * <ACE_Event_Handler::NULL_MASK>. + * ACE_Event_Handler::remove_reference() will also be called. */ virtual int remove_handler (ACE_HANDLE handle, - ACE_Reactor_Mask mask); + ACE_Reactor_Mask masks); /** - * Removes all handles in <handle_set>. If <mask> == - * <ACE_Event_Handler::DONT_CALL> then the <handle_close> method of - * the associated <event_handler>s is not invoked. + * Remove <masks> from <event_handler> registration. + * + * Same as remove_handler(ACE_HANDLE,ACE_Reactor_Mask), except + * <handle> comes from ACE_Event_Handler::get_handle(). */ - virtual int remove_handler (const ACE_Handle_Set &handle_set, - ACE_Reactor_Mask mask); + virtual int remove_handler (ACE_Event_Handler *event_handler, + ACE_Reactor_Mask masks); /** + * Remove <masks> from multiple <handle> registrations. + * + * Shorthand for calling remove_handler(ACE_HANDLE,ACE_Reactor_Mask) + * multiple times for the same <masks> but different <handles>. + */ + virtual int remove_handler (const ACE_Handle_Set &handles, + ACE_Reactor_Mask masks); + + /** + * Remove signal handler registration. + * * Remove the ACE_Event_Handler currently associated with <signum>. * Install the new disposition (if given) and return the previous - * disposition (if desired by the caller). Returns 0 on success and - * -1 if <signum> is invalid. + * disposition (if desired by the caller). + * + * ACE_Event_Handler::handle_close() will be called with + * <ACE_Event_Handler::SIGNAL_MASK>. + * ACE_Event_Handler::remove_reference() will also be called. */ virtual int remove_handler (int signum, ACE_Sig_Action *new_disp, ACE_Sig_Action *old_disp = 0, int sigkey = -1); - /// Calls <remove_handler> for every signal in <sigset>. + /** + * Remove multiple signal handler registrations. + * + * Shorthand for calling + * remove_handler(int,ACE_Sig_Action*,ACE_Sig_Action*,int) multiple + * times for every signal in <sigset>. + */ virtual int remove_handler (const ACE_Sig_Set &sigset); // = Suspend and resume Handlers. - /// Suspend <event_handler> temporarily. Use - /// <ACE_Event_Handler::get_handle> to get the handle. - virtual int suspend_handler (ACE_Event_Handler *event_handler); - - /// Suspend <handle> temporarily. + /** + * Suspend <handle> temporarily. + */ virtual int suspend_handler (ACE_HANDLE handle); - /// Suspend all <handles> in handle set temporarily. + /** + * Suspend <event_handler> temporarily. + * + * Handle is obtained from ACE_Event_Handler::get_handle(). + */ + virtual int suspend_handler (ACE_Event_Handler *event_handler); + + /** + * Suspend <handles> temporarily. + * + * Shorthand for calling suspend_handler(ACE_HANDLE) with multiple + * <handles>. + */ virtual int suspend_handler (const ACE_Handle_Set &handles); - /// Suspend all <handles> temporarily. + /** + * Suspend all registered handles temporarily. + */ virtual int suspend_handlers (void); - /// Resume <event_handler>. Use <ACE_Event_Handler::get_handle> to - /// get the handle. - virtual int resume_handler (ACE_Event_Handler *event_handler); - - /// Resume <handle>. + /** + * Resume <handle>. + */ virtual int resume_handler (ACE_HANDLE handle); - /// Resume all <handles> in handle set. + /** + * Resume <event_handler>. + * + * Handle is obtained from ACE_Event_Handler::get_handle(). + */ + virtual int resume_handler (ACE_Event_Handler *event_handler); + + /** + * Resume <handles>. + * + * Shorthand for calling resume_handler(ACE_HANDLE) with multiple + * <handles>. + */ virtual int resume_handler (const ACE_Handle_Set &handles); - /// Resume all <handles>. + /** + * Resume all registered handles. + */ virtual int resume_handlers (void); /// Does the reactor allow the application to resume the handle on @@ -435,12 +531,19 @@ public: // = Timer management. /** - * Schedule an ACE_Event_Handler that will expire after an amount + * Schedule a timer event. + * + * Schedule a timer event that will expire after an <delay> amount * of time. The return value of this method, a timer_id value, - * uniquely identifies the event_handler in the ACE_Reactor's - * internal list of timers. - * This timer_id value can be used to cancel the timer - * with the cancel_timer() call. + * uniquely identifies the <event_handler> in the ACE_Reactor's + * internal list of timers. This timer_id value can be used to + * cancel the timer with the cancel_timer() call. + * + * Reactor will call ACE_Event_Handler::add_reference() on the + * handler. After the timeout occurs and + * ACE_Event_Handler::handle_timeout() has completed, the handler + * will be implicitly removed from the Reactor and + * ACE_Event_Handler::remove_reference() will be called. * * @see cancel_timer() * @see reset_timer_interval() @@ -457,33 +560,54 @@ public: const ACE_Time_Value &interval = ACE_Time_Value::zero); /** + * Reset recurring timer interval. + * * Resets the interval of the timer represented by <timer_id> to * <interval>, which is specified in relative time to the current * <gettimeofday>. If <interval> is equal to * <ACE_Time_Value::zero>, the timer will become a non-rescheduling * timer. Returns 0 if successful, -1 if not. + * + * This change will not take effect until the next timeout. */ virtual int reset_timer_interval (long timer_id, const ACE_Time_Value &interval); - /// Cancel all <Event_Handler>s that match the address of - /// <event_handler>. Returns number of handlers cancelled. - virtual int cancel_timer (ACE_Event_Handler *event_handler, - int dont_call_handle_close = 1); - /** - * Cancel the single <Event_Handler> that matches the <timer_id> - * value, which was returned from the schedule method. If arg is - * non-NULL then it will be set to point to the ``magic cookie'' - * argument passed in when the Event_Handler was registered. This - * makes it possible to free up the memory and avoid memory leaks. - * Returns 1 if cancellation succeeded and 0 if the <timer_id> - * wasn't found. + * Cancel timer. + * + * Cancel timer associated with <timer_id> that was returned from + * the schedule_timer() method. If arg is non-NULL then it will be + * set to point to the ``magic cookie'' argument passed in when the + * handler was registered. This makes it possible to free up the + * memory and avoid memory leaks. Returns 1 if cancellation + * succeeded and 0 if the <timer_id> wasn't found. + * + * On successful cancellation, ACE_Event_Handler::handle_close() + * will be called with <ACE_Event_Handler::TIMER_MASK>. + * ACE_Event_Handler::remove_reference() will also be called. */ virtual int cancel_timer (long timer_id, const void **arg = 0, int dont_call_handle_close = 1); + /** + * Cancel all timers associated with event handler. + * + * Shorthand for calling cancel_timer(long,const void **,int) + * multiple times for all timer associated with <event_handler>. + * + * ACE_Event_Handler::handle_close() will be called with + * <ACE_Event_Handler::TIMER_MASK> only once irrespective of the + * number of timers associated with the event handler. + * ACE_Event_Handler::remove_reference() will also be called once + * for every timer associated with the event handler. + * + * Returns number of handlers cancelled. + */ + virtual int cancel_timer (ACE_Event_Handler *event_handler, + int dont_call_handle_close = 1); + // = High-level Event_Handler scheduling operations /// Add <masks_to_be_added> to the <event_handler>'s entry. @@ -491,9 +615,9 @@ public: /// Note that this call does not cause the Reactor to re-examine /// its set of handlers - the new masks will be noticed the next /// time the Reactor waits for activity. If there is no other - /// activity expected, or you need immediate re-examination of - /// the wait masks, either call ACE_Reactor::notify after this - /// call, or use ACE_Reactor::register_handler instead. + /// activity expected, or you need immediate re-examination of the + /// wait masks, either call ACE_Reactor::notify after this call, or + /// use ACE_Reactor::register_handler instead. virtual int schedule_wakeup (ACE_Event_Handler *event_handler, ACE_Reactor_Mask masks_to_be_added); @@ -503,8 +627,8 @@ public: /// its set of handlers - the new masks will be noticed the next /// time the Reactor waits for activity. If there is no other /// activity expected, or you need immediate re-examination of - /// the wait masks, either call ACE_Reactor::notify after this - /// call, or use ACE_Reactor::register_handler instead. + /// the wait masks, either call ACE_Reactor::notify after this call, + /// or use ACE_Reactor::register_handler instead. virtual int schedule_wakeup (ACE_HANDLE handle, ACE_Reactor_Mask masks_to_be_added); @@ -531,16 +655,35 @@ public: // = Notification methods. /** - * Notify <event_handler> of <mask> event. The <ACE_Time_Value> - * indicates how long to blocking trying to notify. If <timeout> == - * 0, the caller will block until action is possible, else will wait - * until the relative time specified in <timeout> elapses). Note that - * <mask> can only be one of the pre-defined <ACE_Event_Handler> - * masks, e.g., <READ_MASK>, <WRITE_MASK>, or <EXCEPT_MASK>. + * Dispatch user specified events. + * + * Handler will be dispatched irrespective of whether it is + * registered, not registered, or suspended in the Reactor. + * + * If user specified event is successfully queued, + * ACE_Event_Handler::add_reference() will be called. After the + * notify occurs and the upcall to the handler completes, the + * handler will be implicitly removed from the Reactor and + * ACE_Event_Handler::remove_reference() will be called. No other + * upcall reference counting is done. + * + * For I/O or OS events, the upcall is invoked with an + * ACE_INVALID_HANDLE. + * + * For timer events, the upcall is invoked with a null ACT. + * + * @param event_handler: IN - Handler on which the event will be + * dispatched. + * @param masks: IN - Events to be dispatched - multiple events can + * be OR'd together. + * @param timeout: INOUT - Relative time up to which to wait for + * user specified event to be queued. If tv is 0, wait + * indefinitely. When the call returns, tv has the time remaining + * after the call completes. */ virtual int notify (ACE_Event_Handler *event_handler = 0, - ACE_Reactor_Mask mask = ACE_Event_Handler::EXCEPT_MASK, - ACE_Time_Value *tv = 0); + ACE_Reactor_Mask masks = ACE_Event_Handler::EXCEPT_MASK, + ACE_Time_Value *timeout = 0); /** * Set the maximum number of times that ACE_Reactor will @@ -564,10 +707,14 @@ public: /** * Purge any notifications pending in this reactor for the specified - * <ACE_Event_Handler> object. If <eh> == 0, all notifications for all - * handlers are removed (but not any notifications posted just to wake up - * the reactor itself). Returns the number of notifications purged. - * Returns -1 on error. + * <ACE_Event_Handler> object. If <eh> == 0, all notifications for + * all handlers are removed (but not any notifications posted just + * to wake up the reactor itself). Returns the number of + * notifications purged. Returns -1 on error. + * + * After the purging occurs, the handler will be implicitly removed + * from the Reactor and ACE_Event_Handler::remove_reference() will + * be called. */ virtual int purge_pending_notifications (ACE_Event_Handler *, ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); @@ -575,9 +722,21 @@ public: // = Assorted helper methods. /** + * Return the Event_Handler associated with <handle>. Return 0 if + * <handle> is not registered. + * + * Reactor will call ACE_Event_Handler::add_reference() on the + * handler before returning it. + */ + virtual ACE_Event_Handler *find_handler (ACE_HANDLE handle); + + /** * Check to see if <handle> is associated with a valid Event_Handler * bound to <mask>. Return the <event_handler> associated with this * <handler> if <event_handler> != 0. + * + * Reactor will call ACE_Event_Handler::add_reference() on the + * handler before returning it if <event_handler> != 0. */ virtual int handler (ACE_HANDLE handle, ACE_Reactor_Mask mask, diff --git a/ace/Reactor.i b/ace/Reactor.i index 9324bdcfe43..82f1e37aa8d 100644 --- a/ace/Reactor.i +++ b/ace/Reactor.i @@ -51,7 +51,7 @@ ACE_Reactor::run_event_loop (ACE_Time_Value &tv) if (r == 0) return -1; - return r->run_reactor_event_loop + return r->run_reactor_event_loop (tv, ACE_Reactor::check_reconfiguration); } @@ -83,7 +83,7 @@ ACE_Reactor::run_alertable_event_loop (ACE_Time_Value &tv) if (r == 0) return -1; - return r->run_alertable_reactor_event_loop + return r->run_alertable_reactor_event_loop (tv, ACE_Reactor::check_reconfiguration); } @@ -544,6 +544,12 @@ ACE_Reactor::purge_pending_notifications (ACE_Event_Handler *eh, return this->implementation ()->purge_pending_notifications (eh, mask); } +ACE_INLINE ACE_Event_Handler * +ACE_Reactor::find_handler (ACE_HANDLE handle) +{ + return this->implementation ()->find_handler (handle); +} + ACE_INLINE int ACE_Reactor::handler (ACE_HANDLE handle, ACE_Reactor_Mask mask, @@ -670,6 +676,3 @@ ACE_Reactor::uses_event_associations (void) { return this->implementation ()->uses_event_associations (); } - - - diff --git a/ace/Reactor_Impl.h b/ace/Reactor_Impl.h index 5ff0d2bcfb0..06df53fcf00 100644 --- a/ace/Reactor_Impl.h +++ b/ace/Reactor_Impl.h @@ -477,6 +477,12 @@ public: ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK) = 0; /** + * Return the Event_Handler associated with <handle>. Return 0 if + * <handle> is not registered. + */ + virtual ACE_Event_Handler *find_handler (ACE_HANDLE handle) = 0; + + /** * Check to see if <handle> is associated with a valid Event_Handler * bound to <mask>. Return the <event_handler> associated with this * <handler> if <event_handler> != 0. diff --git a/ace/Reactor_Timer_Interface.h b/ace/Reactor_Timer_Interface.h new file mode 100644 index 00000000000..f94bedc0993 --- /dev/null +++ b/ace/Reactor_Timer_Interface.h @@ -0,0 +1,50 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Reactor_Timer_Interface.h + * + * $Id$ + * + * @author Irfan Pyarali <irfan@oomworks.com> + */ +//============================================================================= + +#ifndef ACE_REACTOR_TIMER_INTERFACE_H +#define ACE_REACTOR_TIMER_INTERFACE_H +#include "ace/pre.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +class ACE_Event_Handler; + +/** + * @class ACE_Reactor_Timer_Interface + * + * @brief Interface for timer related methods on the Reactor. + */ +class ACE_Export ACE_Reactor_Timer_Interface +{ +public: + + virtual long schedule_timer (ACE_Event_Handler *event_handler, + const void *arg, + const ACE_Time_Value &delay, + const ACE_Time_Value &interval = ACE_Time_Value::zero) = 0; + + virtual int reset_timer_interval (long timer_id, + const ACE_Time_Value &interval) = 0; + + virtual int cancel_timer (long timer_id, + const void **arg = 0, + int dont_call_handle_close = 1) = 0; + + virtual int cancel_timer (ACE_Event_Handler *event_handler, + int dont_call_handle_close = 1) = 0; + +}; + +#include "ace/post.h" +#endif /* ACE_REACTOR_TIMER_INTERFACE_H */ diff --git a/ace/SSL/ACE_SSL_LIB.dsp b/ace/SSL/ACE_SSL_LIB.dsp index 194af6d9115..5a8da402bfc 100644 --- a/ace/SSL/ACE_SSL_LIB.dsp +++ b/ace/SSL/ACE_SSL_LIB.dsp @@ -4,7 +4,7 @@ # TARGTYPE "Win32 (x86) Static Library" 0x0104
-CFG=ACE_SSL_LIB - Win32 Debug
+CFG=ACE_SSL_LIB - Win32 Static Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
@@ -13,12 +13,12 @@ CFG=ACE_SSL_LIB - Win32 Debug !MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
-!MESSAGE NMAKE /f "ACE_SSL_LIB.mak" CFG="ACE_SSL_LIB - Win32 Debug"
+!MESSAGE NMAKE /f "ACE_SSL_LIB.mak" CFG="ACE_SSL_LIB - Win32 Static Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
-!MESSAGE "ACE_SSL_LIB - Win32 Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "ACE_SSL_LIB - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE "ACE_SSL_LIB - Win32 Static Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "ACE_SSL_LIB - Win32 Static Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
@@ -28,7 +28,7 @@ CFG=ACE_SSL_LIB - Win32 Debug CPP=cl.exe
RSC=rc.exe
-!IF "$(CFG)" == "ACE_SSL_LIB - Win32 Release"
+!IF "$(CFG)" == "ACE_SSL_LIB - Win32 Static Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
@@ -52,7 +52,7 @@ LIB32=link.exe -lib # ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"ACE_SSLs.lib"
-!ELSEIF "$(CFG)" == "ACE_SSL_LIB - Win32 Debug"
+!ELSEIF "$(CFG)" == "ACE_SSL_LIB - Win32 Static Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
@@ -80,8 +80,8 @@ LIB32=link.exe -lib # Begin Target
-# Name "ACE_SSL_LIB - Win32 Release"
-# Name "ACE_SSL_LIB - Win32 Debug"
+# Name "ACE_SSL_LIB - Win32 Static Release"
+# Name "ACE_SSL_LIB - Win32 Static Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
diff --git a/ace/Select_Reactor_Base.cpp b/ace/Select_Reactor_Base.cpp index f0e71bcffc3..7165fb9a802 100644 --- a/ace/Select_Reactor_Base.cpp +++ b/ace/Select_Reactor_Base.cpp @@ -123,10 +123,10 @@ int ACE_Select_Reactor_Handler_Repository::unbind_all (void) { // Unbind all of the <handle, ACE_Event_Handler>s. - for (int handle = 0; - handle < this->max_handlep1_; - handle++) - this->unbind (ACE_SELECT_REACTOR_HANDLE (handle), + for (int slot = 0; + slot < this->max_handlep1_; + slot++) + this->unbind (ACE_SELECT_REACTOR_HANDLE (slot), ACE_Event_Handler::ALL_EVENTS_MASK); return 0; @@ -207,25 +207,44 @@ ACE_Select_Reactor_Handler_Repository::bind (ACE_HANDLE handle, if (this->invalid_handle (handle)) return -1; + // Is this handle already in the Reactor? + int existing_handle = 0; + #if defined (ACE_WIN32) + int assigned_slot = -1; for (ssize_t i = 0; i < this->max_handlep1_; i++) { - // Found it, so let's just reuse this location. + // If handle is already registered. if (ACE_SELECT_REACTOR_HANDLE (i) == handle) { + // Cannot use a different handler for an existing handle. + if (ACE_SELECT_REACTOR_EVENT_HANDLER (this, i) != + event_handler) + return -1; + + // Remember location. assigned_slot = i; + + // Remember that this handle is already registered in the + // Reactor. + existing_handle = 1; + + // We can stop looking now. break; } - // Here's the first free slot, so let's take it. - else if (ACE_SELECT_REACTOR_HANDLE (i) == ACE_INVALID_HANDLE - && assigned_slot == -1) - assigned_slot = i; + else + // Here's the first free slot, so let's take it. + if (ACE_SELECT_REACTOR_HANDLE (i) == ACE_INVALID_HANDLE && + assigned_slot == -1) + { + assigned_slot = i; + } } if (assigned_slot > -1) - // We found a free spot, let's reuse it. + // We found a spot. { ACE_SELECT_REACTOR_HANDLE (assigned_slot) = handle; ACE_SELECT_REACTOR_EVENT_HANDLER (this, assigned_slot) = event_handler; @@ -243,11 +262,29 @@ ACE_Select_Reactor_Handler_Repository::bind (ACE_HANDLE handle, errno = ENOMEM; return -1; } + #else + + // Check if this handle is already registered. + ACE_Event_Handler *current_handler = + ACE_SELECT_REACTOR_EVENT_HANDLER (this, handle); + + if (current_handler) + { + // Cannot use a different handler for an existing handle. + if (current_handler != event_handler) + return -1; + + // Remember that this handle is already registered in the + // Reactor. + existing_handle = 1; + } + ACE_SELECT_REACTOR_EVENT_HANDLER (this, handle) = event_handler; if (this->max_handlep1_ < handle + 1) this->max_handlep1_ = handle + 1; + #endif /* ACE_WIN32 */ if (this->select_reactor_.is_suspended_i (handle)) @@ -270,15 +307,18 @@ ACE_Select_Reactor_Handler_Repository::bind (ACE_HANDLE handle, this->select_reactor_.state_changed_ = 1; } - /* - // @@NOTE: We used to do this in earlier versions of ACE+TAO. But - // this is totally wrong.. - // Clear any suspend masks for it too. - this->select_reactor_.bit_ops (handle, - mask, - this->select_reactor_.suspend_set_, - ACE_Reactor::CLR_MASK); - */ + // If new entry, call add_reference() if needed. + if (!existing_handle) + { + int requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + if (requires_reference_counting) + { + event_handler->add_reference (); + } + } return 0; } @@ -292,9 +332,9 @@ ACE_Select_Reactor_Handler_Repository::unbind (ACE_HANDLE handle, ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::unbind"); size_t slot; - ACE_Event_Handler *eh = this->find (handle, &slot); + ACE_Event_Handler *event_handler = this->find (handle, &slot); - if (eh == 0) + if (event_handler == 0) return -1; // Clear out the <mask> bits in the Select_Reactor's wait_set. @@ -314,11 +354,6 @@ ACE_Select_Reactor_Handler_Repository::unbind (ACE_HANDLE handle, // keep going or if it needs to reconsult select(). this->select_reactor_.state_changed_ = 1; - // Close down the <Event_Handler> unless we've been instructed not - // to. - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::DONT_CALL) == 0) - eh->handle_close (handle, mask); - // If there are no longer any outstanding events on this <handle> // then we can totally shut down the Event_Handler. @@ -331,14 +366,19 @@ ACE_Select_Reactor_Handler_Repository::unbind (ACE_HANDLE handle, || this->select_reactor_.suspend_set_.wr_mask_.is_set (handle) || this->select_reactor_.suspend_set_.ex_mask_.is_set (handle)); - if (!has_any_wait_mask - && !has_any_suspend_mask - && (this->find (handle, &slot) == eh)) -#if defined (ACE_WIN32) + int complete_removal = 0; + + if (!has_any_wait_mask && !has_any_suspend_mask) { - ACE_SELECT_REACTOR_HANDLE (slot) = ACE_INVALID_HANDLE; + // The handle has been completed removed. + complete_removal = 1; + ACE_SELECT_REACTOR_EVENT_HANDLER (this, slot) = 0; +#if defined (ACE_WIN32) + + ACE_SELECT_REACTOR_HANDLE (slot) = ACE_INVALID_HANDLE; + if (this->max_handlep1_ == (int) slot + 1) { // We've deleted the last entry (i.e., i + 1 == the current @@ -355,43 +395,60 @@ ACE_Select_Reactor_Handler_Repository::unbind (ACE_HANDLE handle, this->max_handlep1_ = i + 1; } - } + #else - { - ACE_SELECT_REACTOR_EVENT_HANDLER (this, handle) = 0; - if (this->max_handlep1_ == handle + 1) - { - // We've deleted the last entry, so we need to figure out - // the last valid place in the array that is worth looking - // at. - ACE_HANDLE wait_rd_max = this->select_reactor_.wait_set_.rd_mask_.max_set (); - ACE_HANDLE wait_wr_max = this->select_reactor_.wait_set_.wr_mask_.max_set (); - ACE_HANDLE wait_ex_max = this->select_reactor_.wait_set_.ex_mask_.max_set (); - - ACE_HANDLE suspend_rd_max = this->select_reactor_.suspend_set_.rd_mask_.max_set (); - ACE_HANDLE suspend_wr_max = this->select_reactor_.suspend_set_.wr_mask_.max_set (); - ACE_HANDLE suspend_ex_max = this->select_reactor_.suspend_set_.ex_mask_.max_set (); - - // Compute the maximum of six values. - this->max_handlep1_ = wait_rd_max; - if (this->max_handlep1_ < wait_wr_max) - this->max_handlep1_ = wait_wr_max; - if (this->max_handlep1_ < wait_ex_max) - this->max_handlep1_ = wait_ex_max; - - if (this->max_handlep1_ < suspend_rd_max) - this->max_handlep1_ = suspend_rd_max; - if (this->max_handlep1_ < suspend_wr_max) - this->max_handlep1_ = suspend_wr_max; - if (this->max_handlep1_ < suspend_ex_max) - this->max_handlep1_ = suspend_ex_max; - - this->max_handlep1_++; - } - } + if (this->max_handlep1_ == handle + 1) + { + // We've deleted the last entry, so we need to figure out + // the last valid place in the array that is worth looking + // at. + ACE_HANDLE wait_rd_max = this->select_reactor_.wait_set_.rd_mask_.max_set (); + ACE_HANDLE wait_wr_max = this->select_reactor_.wait_set_.wr_mask_.max_set (); + ACE_HANDLE wait_ex_max = this->select_reactor_.wait_set_.ex_mask_.max_set (); + + ACE_HANDLE suspend_rd_max = this->select_reactor_.suspend_set_.rd_mask_.max_set (); + ACE_HANDLE suspend_wr_max = this->select_reactor_.suspend_set_.wr_mask_.max_set (); + ACE_HANDLE suspend_ex_max = this->select_reactor_.suspend_set_.ex_mask_.max_set (); + + // Compute the maximum of six values. + this->max_handlep1_ = wait_rd_max; + if (this->max_handlep1_ < wait_wr_max) + this->max_handlep1_ = wait_wr_max; + if (this->max_handlep1_ < wait_ex_max) + this->max_handlep1_ = wait_ex_max; + + if (this->max_handlep1_ < suspend_rd_max) + this->max_handlep1_ = suspend_rd_max; + if (this->max_handlep1_ < suspend_wr_max) + this->max_handlep1_ = suspend_wr_max; + if (this->max_handlep1_ < suspend_ex_max) + this->max_handlep1_ = suspend_ex_max; + + this->max_handlep1_++; + } + #endif /* ACE_WIN32 */ + } + + int requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + // Close down the <Event_Handler> unless we've been instructed not + // to. + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::DONT_CALL) == 0) + event_handler->handle_close (handle, mask); + + // Call remove_reference() if the removal is complete and reference + // counting is needed. + if (complete_removal && + requires_reference_counting) + { + event_handler->remove_reference (); + } + return 0; } @@ -466,13 +523,13 @@ ACE_Select_Reactor_Handler_Repository::dump (void) const this->max_handlep1_, this->max_size_)); ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("["))); - ACE_Event_Handler *eh = 0; + ACE_Event_Handler *event_handler = 0; for (ACE_Select_Reactor_Handler_Repository_Iterator iter (this); - iter.next (eh) != 0; + iter.next (event_handler) != 0; iter.advance ()) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT (" (eh = %x, eh->handle_ = %d)"), - eh, eh->get_handle ())); + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT (" (event_handler = %x, event_handler->handle_ = %d)"), + event_handler, event_handler->get_handle ())); ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT (" ]"))); ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); @@ -549,6 +606,18 @@ ACE_Select_Reactor_Notify::purge_pending_notifications (ACE_Event_Handler *eh, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("enqueue_head")), -1); + + ACE_Event_Handler *event_handler = buffer->eh_; + + int requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + if (requires_reference_counting) + { + event_handler->remove_reference (); + } + ++number_purged; } else @@ -696,7 +765,7 @@ ACE_Select_Reactor_Notify::close (void) } int -ACE_Select_Reactor_Notify::notify (ACE_Event_Handler *eh, +ACE_Select_Reactor_Notify::notify (ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask, ACE_Time_Value *timeout) { @@ -707,7 +776,22 @@ ACE_Select_Reactor_Notify::notify (ACE_Event_Handler *eh, if (this->select_reactor_ == 0) return 0; - ACE_Notification_Buffer buffer (eh, mask); + ACE_Event_Handler_var safe_handler; + + if (event_handler) + { + int requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + if (requires_reference_counting) + { + event_handler->add_reference (); + safe_handler = event_handler; + } + } + + ACE_Notification_Buffer buffer (event_handler, mask); #if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) // Artificial scope to limit the duration of the mutex. @@ -765,6 +849,9 @@ ACE_Select_Reactor_Notify::notify (ACE_Event_Handler *eh, if (n == -1) return -1; + // No failures. + safe_handler.release (); + return 0; } @@ -866,7 +953,9 @@ int ACE_Select_Reactor_Notify::dispatch_notify (ACE_Notification_Buffer &buffer) { int result = 0; + #if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) + // Dispatch all messages that are in the <notify_queue_>. { // We acquire the lock in a block to make sure we're not @@ -890,35 +979,8 @@ ACE_Select_Reactor_Notify::dispatch_notify (ACE_Notification_Buffer &buffer) -1); } - // If eh == 0 then another thread is unblocking the - // <ACE_Select_Reactor> to update the <ACE_Select_Reactor>'s - // internal structures. Otherwise, we need to dispatch the - // appropriate handle_* method on the <ACE_Event_Handler> - // pointer we've been passed. - if (buffer.eh_ != 0) - { +#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ - switch (buffer.mask_) - { - case ACE_Event_Handler::READ_MASK: - case ACE_Event_Handler::ACCEPT_MASK: - result = buffer.eh_->handle_input (ACE_INVALID_HANDLE); - break; - case ACE_Event_Handler::WRITE_MASK: - result = buffer.eh_->handle_output (ACE_INVALID_HANDLE); - break; - case ACE_Event_Handler::EXCEPT_MASK: - result = buffer.eh_->handle_exception (ACE_INVALID_HANDLE); - break; - default: - // Should we bail out if we get an invalid mask? - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("invalid mask = %d\n"), buffer.mask_)); - } - if (result == -1) - buffer.eh_->handle_close (ACE_INVALID_HANDLE, - ACE_Event_Handler::EXCEPT_MASK); - } -#else // If eh == 0 then another thread is unblocking the // <ACE_Select_Reactor> to update the <ACE_Select_Reactor>'s // internal structures. Otherwise, we need to dispatch the @@ -926,23 +988,30 @@ ACE_Select_Reactor_Notify::dispatch_notify (ACE_Notification_Buffer &buffer) // pointer we've been passed. if (buffer.eh_ != 0) { + ACE_Event_Handler *event_handler = + buffer.eh_; + + int requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + switch (buffer.mask_) { case ACE_Event_Handler::READ_MASK: case ACE_Event_Handler::ACCEPT_MASK: - result = buffer.eh_->handle_input (ACE_INVALID_HANDLE); + result = event_handler->handle_input (ACE_INVALID_HANDLE); break; case ACE_Event_Handler::WRITE_MASK: - result = buffer.eh_->handle_output (ACE_INVALID_HANDLE); + result = event_handler->handle_output (ACE_INVALID_HANDLE); break; case ACE_Event_Handler::EXCEPT_MASK: - result = buffer.eh_->handle_exception (ACE_INVALID_HANDLE); + result = event_handler->handle_exception (ACE_INVALID_HANDLE); break; case ACE_Event_Handler::QOS_MASK: - result = buffer.eh_->handle_qos (ACE_INVALID_HANDLE); + result = event_handler->handle_qos (ACE_INVALID_HANDLE); break; case ACE_Event_Handler::GROUP_QOS_MASK: - result = buffer.eh_->handle_group_qos (ACE_INVALID_HANDLE); + result = event_handler->handle_group_qos (ACE_INVALID_HANDLE); break; default: // Should we bail out if we get an invalid mask? @@ -950,12 +1019,16 @@ ACE_Select_Reactor_Notify::dispatch_notify (ACE_Notification_Buffer &buffer) ACE_LIB_TEXT ("invalid mask = %d\n"), buffer.mask_)); } + if (result == -1) - buffer.eh_->handle_close (ACE_INVALID_HANDLE, - ACE_Event_Handler::EXCEPT_MASK); - } + event_handler->handle_close (ACE_INVALID_HANDLE, + ACE_Event_Handler::EXCEPT_MASK); -#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ + if (requires_reference_counting) + { + event_handler->remove_reference (); + } + } return 1; } diff --git a/ace/Select_Reactor_T.cpp b/ace/Select_Reactor_T.cpp index 78c3a3ada1f..18fdc9e37c3 100644 --- a/ace/Select_Reactor_T.cpp +++ b/ace/Select_Reactor_T.cpp @@ -343,6 +343,15 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::register_handler return this->register_handler_i (handles, handler, mask); } +template <class ACE_SELECT_REACTOR_TOKEN> ACE_Event_Handler * +ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::find_handler + (ACE_HANDLE handle) +{ + ACE_TRACE ("ACE_Select_Reactor_T::handler"); + ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, 0)); + return this->find_handler_i (handle); +} + template <class ACE_SELECT_REACTOR_TOKEN> int ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::handler (ACE_HANDLE handle, @@ -835,12 +844,28 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::notify_handle if (event_handler == 0) return; + int reference_counting_required = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + // Call add_reference() if needed. + if (reference_counting_required) + { + event_handler->add_reference (); + } + int status = (event_handler->*ptmf) (handle); if (status < 0) this->remove_handler_i (handle, mask); else if (status > 0) ready_mask.set_bit (handle); + + // Call remove_reference() if needed. + if (reference_counting_required) + { + event_handler->remove_reference (); + } } // Perform GET, CLR, SET, and ADD operations on the select() @@ -863,9 +888,42 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::mask_ops { ACE_TRACE ("ACE_Select_Reactor_T::mask_ops"); ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); - return this->bit_ops (handle, mask, - this->wait_set_, - ops); + + // If the handle is not suspended, then set the ops on the + // <wait_set_>, otherwise set the <suspend_set_>. + + if (this->is_suspended_i (handle)) + return this->bit_ops (handle, mask, + this->suspend_set_, + ops); + else + return this->bit_ops (handle, mask, + this->wait_set_, + ops); +} + +template <class ACE_SELECT_REACTOR_TOKEN> ACE_Event_Handler * +ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::find_handler_i + (ACE_HANDLE handle) +{ + ACE_TRACE ("ACE_Select_Reactor_T::handler_i"); + + ACE_Event_Handler *event_handler = + this->handler_rep_.find (handle); + + if (event_handler) + { + int requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + if (requires_reference_counting) + { + event_handler->add_reference (); + } + } + + return event_handler; } // Must be called with locks held. @@ -874,12 +932,13 @@ template <class ACE_SELECT_REACTOR_TOKEN> int ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::handler_i (ACE_HANDLE handle, ACE_Reactor_Mask mask, - ACE_Event_Handler **handler) + ACE_Event_Handler **eh) { ACE_TRACE ("ACE_Select_Reactor_T::handler_i"); - ACE_Event_Handler *h = this->handler_rep_.find (handle); + ACE_Event_Handler *event_handler = + this->handler_rep_.find (handle); - if (h == 0) + if (event_handler == 0) return -1; else { @@ -895,8 +954,20 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::handler_i return -1; } - if (handler != 0) - *handler = h; + if (eh != 0) + { + *eh = event_handler; + + int requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + if (requires_reference_counting) + { + event_handler->add_reference (); + } + } + return 0; } diff --git a/ace/Select_Reactor_T.h b/ace/Select_Reactor_T.h index ca51ff20d0d..292730d8677 100644 --- a/ace/Select_Reactor_T.h +++ b/ace/Select_Reactor_T.h @@ -559,6 +559,13 @@ public: virtual int owner (ACE_thread_t *); // = Miscellaneous Handler operations. + + /** + * Return the Event_Handler associated with <handle>. Return 0 if + * <handle> is not registered. + */ + virtual ACE_Event_Handler *find_handler (ACE_HANDLE handle); + /** * Check to see if <handle> is associated with a valid Event_Handler * bound to <mask>. Return the <eh> associated with this <handler> @@ -635,6 +642,9 @@ protected: virtual int resume_i (ACE_HANDLE handle); /// Implement the public <handler> method. + virtual ACE_Event_Handler *find_handler_i (ACE_HANDLE handle); + + /// Implement the public <handler> method. virtual int handler_i (ACE_HANDLE handle, ACE_Reactor_Mask, ACE_Event_Handler ** = 0); diff --git a/ace/TP_Reactor.cpp b/ace/TP_Reactor.cpp index 16822dc36e7..0d6da2830fa 100644 --- a/ace/TP_Reactor.cpp +++ b/ace/TP_Reactor.cpp @@ -1,6 +1,5 @@ // $Id$ - #include "ace/TP_Reactor.h" #include "ace/Reactor.h" #include "ace/Thread.h" @@ -11,7 +10,6 @@ ACE_RCSID(ace, TP_Reactor, "$Id$") - ACE_ALLOC_HOOK_DEFINE (ACE_TP_Reactor) int @@ -39,7 +37,6 @@ ACE_TP_Token_Guard::grab_token (ACE_Time_Value *max_wait_time) ACE_MT (result = this->token_.acquire_read (&ACE_TP_Reactor::no_op_sleep_hook)); } - // Now that this thread owns the token let us make // Check for timeouts and errors. if (result == -1) { @@ -55,7 +52,6 @@ ACE_TP_Token_Guard::grab_token (ACE_Time_Value *max_wait_time) return result; } - int ACE_TP_Token_Guard::acquire_token (ACE_Time_Value *max_wait_time) { @@ -79,7 +75,6 @@ ACE_TP_Token_Guard::acquire_token (ACE_Time_Value *max_wait_time) ACE_MT (result = this->token_.acquire ()); } - // Now that this thread owns the token let us make // Check for timeouts and errors. if (result == -1) { @@ -148,14 +143,14 @@ ACE_TP_Reactor::handle_events (ACE_Time_Value *max_wait_time) // called. ACE_Countdown_Time countdown (max_wait_time); + // // The order of these events is very subtle, modify with care. - + // // Instantiate the token guard which will try grabbing the token for // this thread. ACE_TP_Token_Guard guard (this->token_); - int result = guard.grab_token (max_wait_time); // If the guard is NOT the owner just return the retval @@ -169,145 +164,10 @@ ACE_TP_Reactor::handle_events (ACE_Time_Value *max_wait_time) // Update the countdown to reflect time waiting for the token. countdown.update (); - return this->dispatch_i (max_wait_time, guard); } - -int -ACE_TP_Reactor::remove_handler (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask) -{ - int result = 0; - // Artificial scoping for grabbing and releasing the token - { - ACE_TP_Token_Guard guard (this->token_); - - // Acquire the token - result = guard.acquire_token (); - - if (!guard.is_owner ()) - return result; - - // Call the remove_handler_i () with a DONT_CALL mask. We dont - // want to call the handle_close with the token held. - result = this->remove_handler_i (eh->get_handle (), - mask | ACE_Event_Handler::DONT_CALL); - - if (result == -1) - return -1; - } - - // Close down the <Event_Handler> unless we've been instructed not - // to. - if (result == 0 && (ACE_BIT_ENABLED (mask, ACE_Event_Handler::DONT_CALL) == 0)) - eh->handle_close (ACE_INVALID_HANDLE, mask); - - return 0; -} - -int -ACE_TP_Reactor::remove_handler (ACE_HANDLE handle, - ACE_Reactor_Mask mask) -{ - - ACE_Event_Handler *eh = 0; - int result = 0; - // Artificial scoping for grabbing and releasing the token - { - ACE_TP_Token_Guard guard (this->token_); - - // Acquire the token - result = guard.acquire_token (); - - if (!guard.is_owner ()) - return result; - - size_t slot = 0; - eh = this->handler_rep_.find (handle, &slot); - - if (eh == 0) - return -1; - - // Call the remove_handler_i () with a DONT_CALL mask. We dont - // want to call the handle_close with the token held. - result = this->remove_handler_i (handle, - mask | ACE_Event_Handler::DONT_CALL); - - if (result == -1) - return -1; - } - - // Close down the <Event_Handler> unless we've been instructed not - // to. - // @@ Note: The check for result ==0 may be redundant, but shouldnt - // be a problem. - if (result ==0 && (ACE_BIT_ENABLED (mask, ACE_Event_Handler::DONT_CALL) == 0)) - eh->handle_close (handle, mask); - - return 0; -} - - -int -ACE_TP_Reactor::remove_handler (const ACE_Handle_Set &handles, - ACE_Reactor_Mask m) -{ - // Array of <Event_Handlers> corresponding to <handles> - ACE_Event_Handler **aeh = 0; - - // Allocate memory for the size of the handle set - ACE_NEW_RETURN (aeh, - ACE_Event_Handler *[handles.num_set ()], - -1); - - size_t index = 0; - - // Artificial scoping for grabbing and releasing the token - { - ACE_TP_Token_Guard guard (this->token_); - - // Acquire the token - int result = guard.acquire_token (); - - if (!guard.is_owner ()) - return result; - - ACE_HANDLE h; - - ACE_Handle_Set_Iterator handle_iter (handles); - - while ((h = handle_iter ()) != ACE_INVALID_HANDLE) - { - size_t slot = 0; - ACE_Event_Handler *eh = - this->handler_rep_.find (h, &slot); - - if (this->remove_handler_i (h, - m | ACE_Event_Handler::DONT_CALL) == -1) - { - delete [] aeh; - return -1; - } - - aeh [index] = eh; - index ++; - } - } - - // Close down the <Event_Handler> unless we've been instructed not - // to. - if (ACE_BIT_ENABLED (m, ACE_Event_Handler::DONT_CALL) == 0) - { - for (size_t i = 0; i < index; i++) - aeh[i]->handle_close (ACE_INVALID_HANDLE, m); - } - - delete [] aeh; - return 0; -} - int ACE_TP_Reactor::register_handler (int, ACE_Event_Handler *, @@ -378,22 +238,6 @@ ACE_TP_Reactor::register_handler (const ACE_Handle_Set &handles, } int -ACE_TP_Reactor::remove_handler (int /*signum*/, - ACE_Sig_Action * /*new_disp*/, - ACE_Sig_Action * /*old_disp*/, - int /*sigkey*/) -{ - ACE_NOTSUP_RETURN (-1); -} - -int -ACE_TP_Reactor::remove_handler (const ACE_Sig_Set & /*sigset*/) -{ - ACE_NOTSUP_RETURN (-1); -} - - -int ACE_TP_Reactor::dispatch_i (ACE_Time_Value *max_wait_time, ACE_TP_Token_Guard &guard) { @@ -413,6 +257,7 @@ ACE_TP_Reactor::dispatch_i (ACE_Time_Value *max_wait_time, // a later point of time, we decide to handle signals we have to // release the lock before we make any upcalls.. What is here // now is not the right thing... + // // @@ We need to do better.. return this->handle_signals (event_count, guard); @@ -421,8 +266,8 @@ ACE_TP_Reactor::dispatch_i (ACE_Time_Value *max_wait_time, // If there are no signals and if we had received a proper // event_count then first look at dispatching timeouts. We need to // handle timers early since they may have higher latency - // constraints than I/O handlers. Ideally, the order of - // dispatching should be a strategy... + // constraints than I/O handlers. Ideally, the order of dispatching + // should be a strategy... // NOTE: The event count does not have the number of timers that // needs dispatching. But we are still passing this along. We dont @@ -435,14 +280,13 @@ ACE_TP_Reactor::dispatch_i (ACE_Time_Value *max_wait_time, if (result > 0) return result; - - // Else justgo ahead fall through for further handling + // Else just go ahead fall through for further handling. if (event_count > 0) { // Next dispatch the notification handlers (if there are any to - // dispatch). These are required to handle multiple-threads that - // are trying to update the <Reactor>. + // dispatch). These are required to handle multiple-threads + // that are trying to update the <Reactor>. result = this->handle_notify_events (event_count, guard); @@ -460,12 +304,8 @@ ACE_TP_Reactor::dispatch_i (ACE_Time_Value *max_wait_time, } return 0; - } - - - int ACE_TP_Reactor::handle_signals (int & /*event_count*/, ACE_TP_Token_Guard & /*guard*/) @@ -496,7 +336,7 @@ ACE_TP_Reactor::handle_signals (int & /*event_count*/, // result of signals they should be dispatched since // they may be time critical... active_handle_count = this->any_ready (dispatch_set); - #else +#else // active_handle_count = 0; #endif @@ -525,14 +365,25 @@ ACE_TP_Reactor::handle_timer_events (int & /*event_count*/, if (this->timer_queue_->dispatch_info (cur_time, info)) { + const void *upcall_act = 0; + + // Preinvoke. + this->timer_queue_->preinvoke (info, + cur_time, + upcall_act); + // Release the token before dispatching notifies... guard.release_token (); // call the functor - this->timer_queue_->upcall (info.type_, - info.act_, + this->timer_queue_->upcall (info, cur_time); + // Postinvoke + this->timer_queue_->postinvoke (info, + cur_time, + upcall_act); + // We have dispatched a timer return 1; } @@ -540,8 +391,6 @@ ACE_TP_Reactor::handle_timer_events (int & /*event_count*/, return 0; } - - int ACE_TP_Reactor::handle_notify_events (int & /*event_count*/, ACE_TP_Token_Guard &guard) @@ -568,7 +417,7 @@ ACE_TP_Reactor::handle_notify_events (int & /*event_count*/, while (this->notify_handler_->read_notify_pipe (notify_handle, buffer) > 0) { - // Just figure out whether we can read any buffer that has + // Just figure out whether we can read any buffer that has // dispatchable info. If not we have just been unblocked by // another thread trying to update the reactor. If we get any // buffer that needs dispatching we will dispatch that after @@ -612,109 +461,54 @@ ACE_TP_Reactor::handle_socket_events (int &event_count, return 0; } - // Suspend the handler so that other threads don't start - // dispatching it. + // Suspend the handler so that other threads don't start dispatching + // it. + // // NOTE: This check was performed in older versions of the // TP_Reactor. Looks like it is a waste.. if (dispatch_info.event_handler_ != this->notify_handler_) this->suspend_i (dispatch_info.handle_); - // Release the lock. Others threads can start waiting. - guard.release_token (); + int resume_flag = + dispatch_info.event_handler_->resume_handler (); - int result = 0; + int reference_counting_required = + dispatch_info.event_handler_->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; - // If there was an event handler ready, dispatch it. - // Decrement the event left - --event_count; - - if (this->dispatch_socket_event (dispatch_info) == 0) - ++result; // Dispatched an event - - // This is to get around a problem/ which is well described in - // 1361. This is just a work around that would help applications - // from resuming handles at the most inopportune moment. - int flag = - ACE_Event_Handler::ACE_EVENT_HANDLER_NOT_RESUMED; - - // Acquire the token since we want to access the handler - // repository. The call to find () does not hold a lock and hence - // this is required. - guard.acquire_token (); - - // Get the handler for the handle that we have dispatched to. - ACE_Event_Handler *eh = - this->handler_rep_.find (dispatch_info.handle_); - - // This check is required for the following reasons - // 1. If dispatch operation returned a -1, then there is a - // possibility that the event handler could be deleted. In such - // cases the pointer to the event_handler that <dispatch_info> - // holds is set to 0. - // - // 2. If the application did its own memory management, a return - // value of 0 cannot be believed since the event handler could - // be deleted by the application based on some conditions. This - // is *bad*. But we dont have much of a choice with the existing - // reactor setup. To get around this, we can make a check for - // the handler registered with the repository for the handle - // that we have and compare with the handler that we - // posses. Yeah, I know it is like touching your nose by taking - // your hand around your head. But that is the way it is. This - // is a fix for [BUGID 1231] - - if (dispatch_info.event_handler_ != 0 && - eh == dispatch_info.event_handler_) + // Call add_reference() if needed. + if (reference_counting_required) { - flag = - dispatch_info.event_handler_->resume_handler (); + dispatch_info.event_handler_->add_reference (); } - // Use resume_i () since we hold the token already. - if (dispatch_info.handle_ != ACE_INVALID_HANDLE && - dispatch_info.event_handler_ != this->notify_handler_ && - flag == ACE_Event_Handler::ACE_REACTOR_RESUMES_HANDLER) - this->resume_i (dispatch_info.handle_); - - // Let me release the token here. This is not required since the - // destruction of the object on the stack will take care of this. + // Release the lock. Others threads can start waiting. guard.release_token (); - return result; -} - -int -ACE_TP_Reactor::mask_ops (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - int ops) -{ - ACE_TRACE ("ACE_TP_Reactor::mask_ops"); - ACE_MT (ACE_GUARD_RETURN (ACE_Select_Reactor_Token, - ace_mon, this->token_, -1)); - int result = 0; - // If it looks like the handle isn't suspended, then - // set the ops on the wait_set_, otherwise set the suspend_set_. + // If there was an event handler ready, dispatch it. + // Decrement the event left + --event_count; - if (this->suspend_set_.rd_mask_.is_set (handle) == 0 - && this->suspend_set_.wr_mask_.is_set (handle) == 0 - && this->suspend_set_.ex_mask_.is_set (handle) == 0) + // Dispatched an event + if (this->dispatch_socket_event (dispatch_info) == 0) + ++result; - result = this->bit_ops (handle, mask, - this->wait_set_, - ops); - else + // Resume handler if required. + if (dispatch_info.event_handler_ != this->notify_handler_ && + resume_flag == ACE_Event_Handler::ACE_REACTOR_RESUMES_HANDLER) + this->resume_handler (dispatch_info.handle_); - result = this->bit_ops (handle, mask, - this->suspend_set_, - ops); + // Call remove_reference() if needed. + if (reference_counting_required) + { + dispatch_info.event_handler_->remove_reference (); + } return result; } - - int ACE_TP_Reactor::get_event_for_dispatching (ACE_Time_Value *max_wait_time) { @@ -756,7 +550,8 @@ ACE_TP_Reactor::get_event_for_dispatching (ACE_Time_Value *max_wait_time) int ACE_TP_Reactor::get_socket_event_info (ACE_EH_Dispatch_Info &event) { - event.reset (); // Nothing to dispatch yet + // Nothing to dispatch yet + event.reset (); // Check for dispatch in write, except, read. Only catch one, but if // one is caught, be sure to clear the handle from each mask in case @@ -863,10 +658,6 @@ ACE_TP_Reactor::dispatch_socket_event (ACE_EH_Dispatch_Info &dispatch_info) int retval = this->remove_handler (handle, mask); - // As the handler is no longer valid, invalidate the handle - dispatch_info.event_handler_ = 0; - dispatch_info.handle_ = ACE_INVALID_HANDLE; - return retval; } @@ -886,14 +677,6 @@ ACE_TP_Reactor::handle_events (ACE_Time_Value &max_wait_time) return this->handle_events (&max_wait_time); } -int -ACE_TP_Reactor::mask_ops (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask, - int ops) -{ - return this->mask_ops (eh->get_handle (), mask, ops); -} - void ACE_TP_Reactor::notify_handle (ACE_HANDLE, ACE_Reactor_Mask, diff --git a/ace/TP_Reactor.h b/ace/TP_Reactor.h index 41a80215dd9..1deac0552bc 100644 --- a/ace/TP_Reactor.h +++ b/ace/TP_Reactor.h @@ -133,34 +133,33 @@ private: /** * @class ACE_TP_Reactor * - * @brief Specialization of Select Reactor to support thread-pool based - * event dispatching. + * @brief Specialization of Select Reactor to support thread-pool + * based event dispatching. * - * One of the short comings of the Select_Reactor in ACE is that - * it did not support a thread pool based event dispatching - * model, similar to the one in WFMO_Reactor. In - * Select_Reactor, only thread can be blocked in <handle_events> - * at any given time. - * A new Reactor has been added to ACE that removes this - * short-coming. TP_Reactor is a specialization of Select - * Reactor to support thread-pool based event dispatching. This - * Reactor takes advantage of the fact that events reported by - * <select> are persistent if not acted upon immediately. It - * works by remembering the event handler that just got - * activated, releasing the internal lock (so that some other - * thread can start waiting in the event loop) and then - * dispatching the event handler outside the context of the - * Reactor lock. - * This Reactor is best suited for situations when the callbacks - * to event handlers can take arbitrarily long and/or a number - * of threads are available to run the event loops. - * Note that callback code in Event Handlers - * (e.g. Event_Handler::handle_input) does not have to be - * modified or made thread-safe for this Reactor. This is - * because an activated Event Handler is suspended in the - * Reactor before the upcall is made and resumed after the - * upcall completes. Therefore, one Event Handler cannot be - * called by multiple threads simultaneously. + * One of the short comings of the Select_Reactor in ACE is that it + * did not support a thread pool based event dispatching model, + * similar to the one in WFMO_Reactor. In Select_Reactor, only thread + * can be blocked in <handle_events> at any given time. + * + * A new Reactor has been added to ACE that removes this short-coming. + * TP_Reactor is a specialization of Select Reactor to support + * thread-pool based event dispatching. This Reactor takes advantage + * of the fact that events reported by <select> are persistent if not + * acted upon immediately. It works by remembering the event handler + * that just got activated, releasing the internal lock (so that some + * other thread can start waiting in the event loop) and then + * dispatching the event handler outside the context of the Reactor + * lock. + * + * This Reactor is best suited for situations when the callbacks to + * event handlers can take arbitrarily long and/or a number of threads + * are available to run the event loops. Note that callback code in + * Event Handlers (e.g. Event_Handler::handle_input) does not have to + * be modified or made thread-safe for this Reactor. This is because + * an activated Event Handler is suspended in the Reactor before the + * upcall is made and resumed after the upcall completes. Therefore, + * one Event Handler cannot be called by multiple threads + * simultaneously. */ class ACE_Export ACE_TP_Reactor : public ACE_Select_Reactor { @@ -212,41 +211,9 @@ public: virtual int handle_events (ACE_Time_Value &max_wait_time); - - /// The following two overloaded methods are necessary as we dont - /// want the TP_Reactor to call handle_close () with the token - /// held. - /** - * Removes the <mask> binding of <eh> from the Select_Reactor. If - * there are no more bindings for this <eh> then it is removed from - * the Select_Reactor. Note that the Select_Reactor will call - * <ACE_Event_Handler::get_handle> to extract the underlying I/O - * handle. - */ - virtual int remove_handler (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask); - - /** - * Removes the <mask> bind of <Event_Handler> whose handle is - * <handle> from the Select_Reactor. If there are no more bindings - * for this <eh> then it is removed from the Select_Reactor. - */ - virtual int remove_handler (ACE_HANDLE handle, - ACE_Reactor_Mask); - - /** - * Removes all the <mask> bindings for handles in the <handle_set> - * bind of <Event_Handler>. If there are no more bindings for any - * of these handlers then they are removed from the Select_Reactor. - */ - virtual int remove_handler (const ACE_Handle_Set &handle_set, - ACE_Reactor_Mask); - -/* @todo The following methods are not supported. Support for + /* @todo The following methods are not supported. Support for * signals is not available in the TP_Reactor. These methods will be - * supported once signal handling is supported. We have to include - * these two methods in the TP_Reactor to keep some compilers - * silent. + * supported once signal handling is supported. */ virtual int register_handler (int signum, ACE_Event_Handler *new_sh, @@ -257,20 +224,6 @@ public: virtual int register_handler (const ACE_Sig_Set &sigset, ACE_Event_Handler *new_sh, ACE_Sig_Action *new_disp = 0); - /** - * Remove the ACE_Event_Handler currently associated with <signum>. - * <sigkey> is ignored in this implementation since there is only - * one instance of a signal handler. Install the new disposition - * (if given) and return the previous disposition (if desired by the - * caller). Returns 0 on success and -1 if <signum> is invalid. - */ - virtual int remove_handler (int signum, - ACE_Sig_Action *new_disp, - ACE_Sig_Action *old_disp = 0, - int sigkey = -1); - - /// Calls <remove_handler> for every signal in <sigset>. - virtual int remove_handler (const ACE_Sig_Set &sigset); /** * The following template methods have been declared here to avoid @@ -317,18 +270,6 @@ public: /// resume handles. So return a +ve value. virtual int resumable_handler (void); - /// GET/SET/ADD/CLR the dispatch mask "bit" bound with the <eh> and - /// <mask>. - virtual int mask_ops (ACE_Event_Handler *eh, - ACE_Reactor_Mask mask, - int ops); - - /// GET/SET/ADD/CLR the dispatch mask "bit" bound with the <handle> - /// and <mask>. - virtual int mask_ops (ACE_HANDLE handle, - ACE_Reactor_Mask mask, - int ops); - /// Called from handle events static void no_op_sleep_hook (void *); @@ -345,8 +286,8 @@ public: ACE_ALLOC_HOOK_DECLARE; protected: - // = Internal methods that do the actual work. + // = Internal methods that do the actual work. /// Dispatch just 1 signal, timer, notification handlers int dispatch_i (ACE_Time_Value *max_wait_time, @@ -384,7 +325,7 @@ protected: private: /// Get the handle of the notify pipe from the ready set if there is - /// an event in the notify pipe. + /// an event in the notify pipe. ACE_HANDLE get_notify_handle (void); /// Get socket event dispatch information. diff --git a/ace/TP_Reactor.i b/ace/TP_Reactor.i index bfb3f02e2dd..a3a9de3d1de 100644 --- a/ace/TP_Reactor.i +++ b/ace/TP_Reactor.i @@ -50,8 +50,8 @@ ACE_EH_Dispatch_Info::dispatch (void) const ACE_INLINE ACE_TP_Token_Guard::ACE_TP_Token_Guard (ACE_Select_Reactor_Token &token) - :token_ (token), - owner_ (0) + : token_ (token), + owner_ (0) { } @@ -87,6 +87,7 @@ ACE_TP_Token_Guard::is_owner (void) /************************************************************************/ // Methods for ACE_TP_Reactor /************************************************************************/ + ACE_INLINE void ACE_TP_Reactor::no_op_sleep_hook (void *) { diff --git a/ace/Timer_Hash_T.cpp b/ace/Timer_Hash_T.cpp index a83a5e3acb6..db0c090e1f0 100644 --- a/ace/Timer_Hash_T.cpp +++ b/ace/Timer_Hash_T.cpp @@ -16,19 +16,23 @@ ACE_RCSID(ace, Timer_Hash_T, "$Id$") +template <class TYPE> struct Hash_Token { Hash_Token (const void *act, size_t pos, - long orig_id) + long orig_id, + const TYPE &type) : act_ (act), pos_ (pos), - orig_id_ (orig_id) + orig_id_ (orig_id), + type_ (type) {} const void *act_; size_t pos_; long orig_id_; + TYPE type_; }; // Default constructor @@ -49,63 +53,103 @@ ACE_Timer_Hash_Upcall<TYPE, FUNCTOR, ACE_LOCK>::ACE_Timer_Hash_Upcall (ACE_Timer // Nothing } -// Calls up to timer_hash's upcall functor - template <class TYPE, class FUNCTOR, class ACE_LOCK> int -ACE_Timer_Hash_Upcall<TYPE, FUNCTOR, ACE_LOCK>::timeout (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler, - const void *arg, - const ACE_Time_Value &cur_time) +ACE_Timer_Hash_Upcall<TYPE, FUNCTOR, ACE_LOCK>::registration (TIMER_QUEUE &, + ACE_Event_Handler *, + const void *) { - ACE_UNUSED_ARG (timer_queue); + // Registration will be handled by the upcall functor of the timer + // hash. + return 0; +} - Hash_Token *h = ACE_reinterpret_cast (Hash_Token *, - ACE_const_cast (void *, - arg)); - int result = - this->timer_hash_->upcall_functor ().timeout (*this->timer_hash_, - handler, - h->act_, - cur_time); - delete h; - return result; +template <class TYPE, class FUNCTOR, class ACE_LOCK> int +ACE_Timer_Hash_Upcall<TYPE, FUNCTOR, ACE_LOCK>::preinvoke (TIMER_QUEUE &, + ACE_Event_Handler *, + const void *, + int, + const ACE_Time_Value &, + const void *&) +{ + // This method should never be invoked since we don't invoke + // expire() on the buckets. + ACE_ASSERT (0); + return 0; } +template <class TYPE, class FUNCTOR, class ACE_LOCK> int +ACE_Timer_Hash_Upcall<TYPE, FUNCTOR, ACE_LOCK>::postinvoke (TIMER_QUEUE &, + ACE_Event_Handler *, + const void *, + int, + const ACE_Time_Value &, + const void *) +{ + // This method should never be invoked since we don't invoke + // expire() on the buckets. + ACE_ASSERT (0); + return 0; +} // Calls up to timer_hash's upcall functor - template <class TYPE, class FUNCTOR, class ACE_LOCK> int -ACE_Timer_Hash_Upcall<TYPE, FUNCTOR, ACE_LOCK>::cancellation (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler) +ACE_Timer_Hash_Upcall<TYPE, FUNCTOR, ACE_LOCK>::timeout (TIMER_QUEUE &, + ACE_Event_Handler *, + const void *, + int, + const ACE_Time_Value &) { - ACE_UNUSED_ARG (timer_queue); - return this->timer_hash_->upcall_functor ().cancellation (*this->timer_hash_, - handler); + // This method should never be invoked since we don't invoke + // expire() on the buckets. + ACE_ASSERT (0); + return 0; } +template <class TYPE, class FUNCTOR, class ACE_LOCK> int +ACE_Timer_Hash_Upcall<TYPE, FUNCTOR, ACE_LOCK>::cancel_type (TIMER_QUEUE &, + ACE_Event_Handler *, + int, + int &) +{ + // Cancellation will be handled by the upcall functor of the timer + // hash. + return 0; +} -// Calls up to timer_hash's upcall functor +template <class TYPE, class FUNCTOR, class ACE_LOCK> int +ACE_Timer_Hash_Upcall<TYPE, FUNCTOR, ACE_LOCK>::cancel_timer (TIMER_QUEUE &, + ACE_Event_Handler *, + int, + int) +{ + // Cancellation will be handled by the upcall functor of the timer + // hash. + return 0; +} template <class TYPE, class FUNCTOR, class ACE_LOCK> int -ACE_Timer_Hash_Upcall<TYPE, FUNCTOR, ACE_LOCK>::deletion (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler, +ACE_Timer_Hash_Upcall<TYPE, FUNCTOR, ACE_LOCK>::deletion (TIMER_QUEUE &, + ACE_Event_Handler *event_handler, const void *arg) { - ACE_UNUSED_ARG (timer_queue); + // Call up to the upcall functor of the timer hash since the timer + // hash does not invoke deletion() on its upcall functor directly. + Hash_Token<TYPE> *h = + ACE_reinterpret_cast (Hash_Token<TYPE> *, + ACE_const_cast (void *, + arg)); - Hash_Token *h = ACE_reinterpret_cast (Hash_Token *, - ACE_const_cast (void *, - arg)); int result = - this->timer_hash_->upcall_functor ().deletion (*this->timer_hash_, - handler, - h->act_); + this->timer_hash_->upcall_functor (). + deletion (*this->timer_hash_, + event_handler, + h->act_); + delete h; + return result; } - - template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> ACE_Timer_Hash_Iterator_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::ACE_Timer_Hash_Iterator_T (ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET> &hash) : timer_hash_ (hash) @@ -325,51 +369,72 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::reschedule (ACE_Timer_Node_T< { ACE_TRACE ("ACE_Timer_Hash_T::reschedule"); - size_t position = - expired->get_timer_value ().sec () % this->table_size_; + Hash_Token<TYPE> *h = + ACE_reinterpret_cast (Hash_Token<TYPE> *, + ACE_const_cast (void *, + expired->get_act ())); - Hash_Token *h = ACE_reinterpret_cast (Hash_Token *, - ACE_const_cast (void *, - expired->get_act ())); + h->pos_ = + expired->get_timer_value ().sec () % this->table_size_; - h->orig_id_ = this->table_[position]->schedule (expired->get_type (), - h, - expired->get_timer_value (), - expired->get_interval ()); + h->orig_id_ = + this->table_[h->pos_]->schedule (expired->get_type (), + h, + expired->get_timer_value (), + expired->get_interval ()); + ACE_ASSERT (h->orig_id_ != -1); + +#if 0 + ACE_DEBUG ((LM_DEBUG, "Hash::reschedule() resets %d in slot %d where it's id is %d and token is %x\n", + expired->get_timer_value ().msec (), + h->pos_, + h->orig_id_, + h)); +#endif if (this->table_[this->earliest_position_]->is_empty () - || this->table_[position]->earliest_time () + || this->table_[h->pos_]->earliest_time () < this->table_[this->earliest_position_]->earliest_time ()) - this->earliest_position_ = position; + this->earliest_position_ = h->pos_; } // Insert a new handler that expires at time future_time; if interval // is > 0, the handler will be reinvoked periodically. template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> long -ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::schedule (const TYPE &type, - const void *act, - const ACE_Time_Value &future_time, - const ACE_Time_Value &interval) +ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::schedule_i (const TYPE &type, + const void *act, + const ACE_Time_Value &future_time, + const ACE_Time_Value &interval) { - ACE_TRACE ("ACE_Timer_Hash_T::schedule"); - ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); + ACE_TRACE ("ACE_Timer_Hash_T::schedule_i"); size_t position = future_time.sec () % this->table_size_; - Hash_Token *h; + Hash_Token<TYPE> *h; ACE_NEW_RETURN (h, - Hash_Token (act, - position, - 0), + Hash_Token<TYPE> (act, + position, + 0, + type), -1); - h->orig_id_ = this->table_[position]->schedule (type, - h, - future_time, - interval); + h->orig_id_ = + this->table_[position]->schedule (type, + h, + future_time, + interval); + ACE_ASSERT (h->orig_id_ != -1); + +#if 0 + ACE_DEBUG ((LM_DEBUG, "Hash::schedule() placing %d in slot %d where it's id is %d and token is %x\n", + future_time.msec (), + position, + h->orig_id_, + h)); +#endif if (this->table_[this->earliest_position_]->is_empty () || this->table_[position]->earliest_time () @@ -413,11 +478,13 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::reset_interval (long timer_id #if defined (ACE_WIN64) unsigned long timer_offset = ACE_static_cast (unsigned long, timer_id); - Hash_Token *h = ACE_reinterpret_cast (Hash_Token *, - (this->pointer_base_ + timer_offset)); + Hash_Token<TYPE> *h = + ACE_reinterpret_cast (Hash_Token<TYPE> *, + (this->pointer_base_ + timer_offset)); #else - Hash_Token *h = ACE_reinterpret_cast (Hash_Token *, - timer_id); + Hash_Token<TYPE> *h = + ACE_reinterpret_cast (Hash_Token<TYPE> *, + timer_id); #endif /* ACE_WIN64 */ return this->table_[h->pos_]->reset_interval (h->orig_id_, @@ -442,26 +509,46 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::cancel (long timer_id, #if defined (ACE_WIN64) unsigned long timer_offset = ACE_static_cast (unsigned long, timer_id); - Hash_Token *h = ACE_reinterpret_cast (Hash_Token *, - (this->pointer_base_ + timer_offset)); + Hash_Token<TYPE> *h = + ACE_reinterpret_cast (Hash_Token<TYPE> *, + (this->pointer_base_ + timer_offset)); #else - Hash_Token *h = ACE_reinterpret_cast (Hash_Token *, - timer_id); + Hash_Token<TYPE> *h = + ACE_reinterpret_cast (Hash_Token<TYPE> *, + timer_id); #endif /* ACE_WIN64 */ int result = this->table_[h->pos_]->cancel (h->orig_id_, - act, + 0, dont_call); - if (h->pos_ == this->earliest_position_) - this->find_new_earliest (); + if (result == 1) + { + // Call the close hooks. + int cookie = 0; - if (act != 0) - *act = h->act_; + // cancel_type() called once per <type>. + this->upcall_functor ().cancel_type (*this, + h->type_, + dont_call, + cookie); - delete h; + // cancel_timer() called once per <timer>. + this->upcall_functor ().cancel_timer (*this, + h->type_, + dont_call, + cookie); - --this->size_; + if (h->pos_ == this->earliest_position_) + this->find_new_earliest (); + + if (act != 0) + *act = h->act_; + + delete h; + + --this->size_; + } return result; } @@ -478,10 +565,10 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::cancel (const TYPE &type, size_t i; // loop variable. - Hash_Token **timer_ids; + Hash_Token<TYPE> **timer_ids; ACE_NEW_RETURN (timer_ids, - Hash_Token *[this->size_], + Hash_Token<TYPE> *[this->size_], -1); size_t pos = 0; @@ -499,7 +586,7 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::cancel (const TYPE &type, iter.next ()) if (iter.item ()->get_type () == type) timer_ids[pos++] = - ACE_reinterpret_cast (Hash_Token *, + ACE_reinterpret_cast (Hash_Token<TYPE> *, ACE_const_cast (void *, iter.item ()->get_act ())); } @@ -509,20 +596,42 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::cancel (const TYPE &type, for (i = 0; i < pos; i++) { - this->table_[timer_ids[i]->pos_]->cancel (timer_ids[i]->orig_id_, - 0, - 1); + int result = + this->table_[timer_ids[i]->pos_]->cancel (timer_ids[i]->orig_id_, + 0, + dont_call); + ACE_ASSERT (result == 1); + ACE_UNUSED_ARG (result); + delete timer_ids[i]; + --this->size_; } delete [] timer_ids; - if (dont_call == 0) - this->upcall_functor ().cancellation (*this, - type); this->find_new_earliest (); + // Call the close hooks. + int cookie = 0; + + // cancel_type() called once per <type>. + this->upcall_functor ().cancel_type (*this, + type, + dont_call, + cookie); + + for (i = 0; + i < pos; + ++i) + { + // cancel_timer() called once per <timer>. + this->upcall_functor ().cancel_timer (*this, + type, + dont_call, + cookie); + } + return ACE_static_cast (int, pos); } @@ -570,6 +679,27 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::get_first (void) return this->table_[this->earliest_position_]->get_first (); } +template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> int +ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::dispatch_info_i (const ACE_Time_Value &cur_time, + ACE_Timer_Node_Dispatch_Info_T<TYPE> &info) +{ + int result = + ACE_Timer_Queue_T<TYPE,FUNCTOR,ACE_LOCK>::dispatch_info_i (cur_time, + info); + + if (result == 1) + { + Hash_Token<TYPE> *h = + ACE_reinterpret_cast (Hash_Token<TYPE> *, + ACE_const_cast (void *, + info.act_)); + + info.act_ = h->act_; + } + + return result; +} + // Dummy version of expire to get rid of warnings in Sun CC 4.2 template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> int @@ -596,21 +726,35 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::expire (const ACE_Time_Value i < this->table_size_; i++) { - while (!this->table_[i]->is_empty () + while (!this->table_[i]->is_empty () && this->table_[i]->earliest_time () <= cur_time) { - expired = this->table_[i]->get_first (); - TYPE type = expired->get_type (); + expired = this->table_[i]->remove_first (); const void *act = expired->get_act (); int reclaim = 1; + Hash_Token<TYPE> *h = + ACE_reinterpret_cast (Hash_Token<TYPE> *, + ACE_const_cast (void *, + act)); + + ACE_ASSERT (h->pos_ == i); + +#if 0 + ACE_DEBUG ((LM_DEBUG, "Hash::expire() expiring %d in slot %d where it's id is %d and token is %x\n", + expired->get_timer_value ().msec (), + h->pos_, + h->orig_id_, + h)); +#endif + // Check if this is an interval timer. if (expired->get_interval () > ACE_Time_Value::zero) { // Make sure that we skip past values that have already // "expired". do - expired->set_timer_value (expired->get_timer_value () + expired->set_timer_value (expired->get_timer_value () + expired->get_interval ()); while (expired->get_timer_value () <= cur_time); @@ -620,29 +764,34 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::expire (const ACE_Time_Value reclaim = 0; } - // Now remove the timer from the original table... if - // it's a simple, non-recurring timer, it's got to be - // removed anyway. If it was rescheduled, it's been - // scheduled into the correct table (regardless of whether - // it's the same one or not) already. - this->table_[i]->cancel (expired->get_timer_id ()); - - Hash_Token *h = ACE_reinterpret_cast (Hash_Token *, - ACE_const_cast (void *, - act)); - // Call the functor. - this->upcall (type, - h->act_, - cur_time); + ACE_Timer_Node_Dispatch_Info_T<TYPE> info; + + // Get the dispatch info + expired->get_dispatch_info (info); + + info.act_ = h->act_; + + const void *upcall_act = 0; + + this->preinvoke (info, cur_time, upcall_act); + + this->upcall (info, cur_time); + + this->postinvoke (info, cur_time, upcall_act); + if (reclaim) { --this->size_; delete h; } + number_of_timers_expired++; - } + } } + if (number_of_timers_expired > 0) + this->find_new_earliest (); + return number_of_timers_expired; } diff --git a/ace/Timer_Hash_T.h b/ace/Timer_Hash_T.h index 3e0d0548427..ca72ea9ff2c 100644 --- a/ace/Timer_Hash_T.h +++ b/ace/Timer_Hash_T.h @@ -50,15 +50,45 @@ public: /// Constructor that specifies a Timer_Hash to call up to ACE_Timer_Hash_Upcall (ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK> *timer_hash); - /// This method is called when the timer expires + /// This method is called when a timer is registered. + int registration (TIMER_QUEUE &timer_queue, + ACE_Event_Handler *handler, + const void *arg); + + /// This method is called before the timer expires. + int preinvoke (TIMER_QUEUE &timer_queue, + ACE_Event_Handler *handler, + const void *arg, + int recurring_timer, + const ACE_Time_Value &cur_time, + const void *&upcall_act); + + /// This method is called when the timer expires. int timeout (TIMER_QUEUE &timer_queue, ACE_Event_Handler *handler, const void *arg, + int recurring_timer, const ACE_Time_Value &cur_time); - /// This method is called when the timer is cancelled - int cancellation (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler); + /// This method is called after the timer expires. + int postinvoke (TIMER_QUEUE &timer_queue, + ACE_Event_Handler *handler, + const void *arg, + int recurring_timer, + const ACE_Time_Value &cur_time, + const void *upcall_act); + + /// This method is called when a handler is cancelled + int cancel_type (TIMER_QUEUE &timer_queue, + ACE_Event_Handler *handler, + int dont_call, + int &requires_reference_counting); + + /// This method is called when a timer is cancelled + int cancel_timer (TIMER_QUEUE &timer_queue, + ACE_Event_Handler *handler, + int dont_call, + int requires_reference_counting); /// This method is called when the timer queue is destroyed and /// the timer is still contained in it @@ -169,22 +199,6 @@ public: virtual const ACE_Time_Value &earliest_time (void) const; /** - * Schedule <type> that will expire at <future_time>, - * which is specified in absolute time. If it expires then <act> is - * passed in as the value to the <functor>. If <interval> is != to - * <ACE_Time_Value::zero> then it is used to reschedule the <type> - * automatically, using relative time to the current <gettimeofday>. - * This method returns a <timer_id> that is a pointer to a token - * which stores information about the event. This <timer_id> can be - * used to cancel the timer before it expires. Returns -1 on - * failure. - */ - virtual long schedule (const TYPE &type, - const void *act, - const ACE_Time_Value &future_time, - const ACE_Time_Value &interval = ACE_Time_Value::zero); - - /** * Resets the interval of the timer represented by <timer_id> to * <interval>, which is specified in relative time to the current * <gettimeofday>. If <interval> is equal to @@ -242,6 +256,27 @@ public: virtual ACE_Timer_Node_T<TYPE> *get_first (void); private: + + /** + * Schedule <type> that will expire at <future_time>, + * which is specified in absolute time. If it expires then <act> is + * passed in as the value to the <functor>. If <interval> is != to + * <ACE_Time_Value::zero> then it is used to reschedule the <type> + * automatically, using relative time to the current <gettimeofday>. + * This method returns a <timer_id> that is a pointer to a token + * which stores information about the event. This <timer_id> can be + * used to cancel the timer before it expires. Returns -1 on + * failure. + */ + virtual long schedule_i (const TYPE &type, + const void *act, + const ACE_Time_Value &future_time, + const ACE_Time_Value &interval); + + /// Non-locking version of dispatch_info () + virtual int dispatch_info_i (const ACE_Time_Value ¤t_time, + ACE_Timer_Node_Dispatch_Info_T<TYPE> &info); + /// Reschedule an "interval" <ACE_Timer_Node>. virtual void reschedule (ACE_Timer_Node_T<TYPE> *); diff --git a/ace/Timer_Heap_T.cpp b/ace/Timer_Heap_T.cpp index a9aae8639fc..16d60f1e738 100644 --- a/ace/Timer_Heap_T.cpp +++ b/ace/Timer_Heap_T.cpp @@ -174,8 +174,11 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::~ACE_Timer_Heap_T (void) delete iterator_; + size_t current_size = + this->cur_size_; + // Clean up all the nodes still in the queue - for (size_t i = 0; i < this->cur_size_; i++) + for (size_t i = 0; i < current_size; i++) { this->upcall_functor ().deletion (*this, this->heap_[i]->get_type (), @@ -374,7 +377,7 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::remove (size_t slot) // parent it needs be moved down the heap. size_t parent = ACE_HEAP_PARENT (slot); - if (moved_node->get_timer_value () + if (moved_node->get_timer_value () >= this->heap_[parent]->get_timer_value ()) this->reheap_down (moved_node, slot, @@ -401,13 +404,13 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::reheap_down (ACE_Timer_Node_T<TYPE> * { // Choose the smaller of the two children. if (child + 1 < this->cur_size_ - && this->heap_[child + 1]->get_timer_value () + && this->heap_[child + 1]->get_timer_value () < this->heap_[child]->get_timer_value ()) child++; // Perform a <copy> if the child has a larger timeout value than // the <moved_node>. - if (this->heap_[child]->get_timer_value () + if (this->heap_[child]->get_timer_value () < moved_node->get_timer_value ()) { this->copy (slot, @@ -434,7 +437,7 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::reheap_up (ACE_Timer_Node_T<TYPE> *mo { // If the parent node is greater than the <moved_node> we need // to copy it down. - if (moved_node->get_timer_value () + if (moved_node->get_timer_value () < this->heap_[parent]->get_timer_value ()) { this->copy (slot, this->heap_[parent]); @@ -490,7 +493,7 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::grow_heap (void) ssize_t *new_timer_ids = 0; - ACE_NEW (new_timer_ids, + ACE_NEW (new_timer_ids, ssize_t[new_size]); ACE_OS::memcpy (new_timer_ids, @@ -594,7 +597,6 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::alloc_node (void) template <class TYPE, class FUNCTOR, class ACE_LOCK> void ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::free_node (ACE_Timer_Node_T<TYPE> *node) { - // Return this timer id to the freelist. this->push_freelist (node->get_timer_id ()); @@ -612,15 +614,13 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::free_node (ACE_Timer_Node_T<TYPE> *no // > 0, the handler will be reinvoked periodically. template <class TYPE, class FUNCTOR, class ACE_LOCK> long -ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::schedule (const TYPE &type, - const void *act, - const ACE_Time_Value &future_time, - const ACE_Time_Value &interval) +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::schedule_i (const TYPE &type, + const void *act, + const ACE_Time_Value &future_time, + const ACE_Time_Value &interval) { ACE_TRACE ("ACE_Timer_Heap_T::schedule"); - ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); - if ((this->cur_size_ + this->cur_limbo_) < this->max_size_) { // Obtain the next unique sequence number. @@ -660,14 +660,14 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::cancel (long timer_id, // Locate the ACE_Timer_Node that corresponds to the timer_id. // Check to see if the timer_id is out of range - if (timer_id < 0 + if (timer_id < 0 || (size_t) timer_id > this->max_size_) return 0; ssize_t timer_node_slot = this->timer_ids_[timer_id]; // Check to see if timer_id is still valid. - if (timer_node_slot < 0) + if (timer_node_slot < 0) return 0; if (timer_id != this->heap_[timer_node_slot]->get_timer_id ()) @@ -680,10 +680,20 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::cancel (long timer_id, ACE_Timer_Node_T<TYPE> *temp = this->remove (timer_node_slot); - if (dont_call == 0) - // Call the close hook. - this->upcall_functor ().cancellation (*this, - temp->get_type ()); + // Call the close hooks. + int cookie = 0; + + // cancel_type() called once per <type>. + this->upcall_functor ().cancel_type (*this, + temp->get_type (), + dont_call, + cookie); + + // cancel_timer() called once per <timer>. + this->upcall_functor ().cancel_timer (*this, + temp->get_type (), + dont_call, + cookie); if (act != 0) *act = temp->get_act (); @@ -695,8 +705,8 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::cancel (long timer_id, // Locate and update the inteval on the timer_id -template <class TYPE, class FUNCTOR, class ACE_LOCK> int -ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::reset_interval (long timer_id, +template <class TYPE, class FUNCTOR, class ACE_LOCK> int +ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::reset_interval (long timer_id, const ACE_Time_Value &interval) { ACE_TRACE ("ACE_Timer_Heap_T::reset_interval"); @@ -705,14 +715,14 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::reset_interval (long timer_id, // Locate the ACE_Timer_Node that corresponds to the timer_id. // Check to see if the timer_id is out of range - if (timer_id < 0 + if (timer_id < 0 || (size_t) timer_id > this->max_size_) return -1; ssize_t timer_node_slot = this->timer_ids_[timer_id]; // Check to see if timer_id is still valid. - if (timer_node_slot < 0) + if (timer_node_slot < 0) return -1; if (timer_id != this->heap_[timer_node_slot]->get_timer_id ()) @@ -735,30 +745,45 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::cancel (const TYPE &type, int dont_call) { ACE_TRACE ("ACE_Timer_Heap_T::cancel"); + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); int number_of_cancellations = 0; // Try to locate the ACE_Timer_Node that matches the timer_id. - { - ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); - - for (size_t i = 0; i < this->cur_size_; ) - { - if (this->heap_[i]->get_type () == type) - { - ACE_Timer_Node_T<TYPE> *temp = this->remove (i); - - number_of_cancellations++; - - this->free_node (temp); - } - else - i++; - } - } - - if (dont_call == 0) - this->upcall_functor ().cancellation (*this, type); + + for (size_t i = 0; i < this->cur_size_; ) + { + if (this->heap_[i]->get_type () == type) + { + ACE_Timer_Node_T<TYPE> *temp = this->remove (i); + + number_of_cancellations++; + + this->free_node (temp); + } + else + i++; + } + + // Call the close hooks. + int cookie = 0; + + // cancel_type() called once per <type>. + this->upcall_functor ().cancel_type (*this, + type, + dont_call, + cookie); + + for (int j = 0; + j < number_of_cancellations; + ++j) + { + // cancel_timer() called once per <timer>. + this->upcall_functor ().cancel_timer (*this, + type, + dont_call, + cookie); + } return number_of_cancellations; } diff --git a/ace/Timer_Heap_T.h b/ace/Timer_Heap_T.h index 73ba57dd3e2..6633bb848c7 100644 --- a/ace/Timer_Heap_T.h +++ b/ace/Timer_Heap_T.h @@ -130,27 +130,6 @@ public: virtual const ACE_Time_Value &earliest_time (void) const; /** - * Schedule a timer that may optionally auto-reset. - * Schedule <type> that will expire at <future_time>, - * which is specified in absolute time. If it expires then <act> is - * passed in as the value to the <functor>. If <interval> is != to - * <ACE_Time_Value::zero> then it is used to reschedule the <type> - * automatically, using relative time to the current <gettimeofday>. - * This method returns a <timer_id> that uniquely identifies the the - * <type> entry in an internal list. This <timer_id> can be used to - * cancel the timer before it expires. The cancellation ensures - * that <timer_ids> are unique up to values of greater than 2 - * billion timers. As long as timers don't stay around longer than - * this there should be no problems with accidentally deleting the - * wrong timer. Returns -1 on failure (which is guaranteed never to - * be a valid <timer_id>). - */ - virtual long schedule (const TYPE &type, - const void *act, - const ACE_Time_Value &future_time, - const ACE_Time_Value &interval = ACE_Time_Value::zero); - - /** * Resets the interval of the timer represented by <timer_id> to * <interval>, which is specified in relative time to the current * <gettimeofday>. If <interval> is equal to @@ -201,6 +180,28 @@ public: virtual ACE_Timer_Node_T<TYPE> *get_first (void); protected: + + /** + * Schedule a timer that may optionally auto-reset. + * Schedule <type> that will expire at <future_time>, + * which is specified in absolute time. If it expires then <act> is + * passed in as the value to the <functor>. If <interval> is != to + * <ACE_Time_Value::zero> then it is used to reschedule the <type> + * automatically, using relative time to the current <gettimeofday>. + * This method returns a <timer_id> that uniquely identifies the the + * <type> entry in an internal list. This <timer_id> can be used to + * cancel the timer before it expires. The cancellation ensures + * that <timer_ids> are unique up to values of greater than 2 + * billion timers. As long as timers don't stay around longer than + * this there should be no problems with accidentally deleting the + * wrong timer. Returns -1 on failure (which is guaranteed never to + * be a valid <timer_id>). + */ + virtual long schedule_i (const TYPE &type, + const void *act, + const ACE_Time_Value &future_time, + const ACE_Time_Value &interval); + /// Reschedule an "interval" <ACE_Timer_Node>. virtual void reschedule (ACE_Timer_Node_T<TYPE> *); diff --git a/ace/Timer_List_T.cpp b/ace/Timer_List_T.cpp index ecf2d71544d..52516cbd4d9 100644 --- a/ace/Timer_List_T.cpp +++ b/ace/Timer_List_T.cpp @@ -126,14 +126,24 @@ ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::~ACE_Timer_List_T (void) delete iterator_; - if (! this->is_empty()) { - for (ACE_Timer_Node_T<TYPE>* n = this->get_first(); n != this->head_;) { - ACE_Timer_Node_T<TYPE>* next = n->get_next(); - this->upcall_functor ().deletion (*this, n->get_type(), n->get_act()); - this->free_node(n); - n = next; + if (!this->is_empty()) + { + for (ACE_Timer_Node_T<TYPE>* n = this->get_first(); + n != this->head_; + ) + { + this->upcall_functor ().deletion (*this, + n->get_type(), + n->get_act()); + + ACE_Timer_Node_T<TYPE> *next = + n->get_next (); + + this->free_node (n); + + n = next; + } } - } // delete the dummy node delete this->head_; @@ -174,13 +184,12 @@ ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::reschedule (ACE_Timer_Node_T<TYPE>* n // is > 0, the handler will be reinvoked periodically. template <class TYPE, class FUNCTOR, class ACE_LOCK> long -ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::schedule (const TYPE &type, - const void *act, - const ACE_Time_Value &future_time, - const ACE_Time_Value &interval) +ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::schedule_i (const TYPE &type, + const void *act, + const ACE_Time_Value &future_time, + const ACE_Time_Value &interval) { ACE_TRACE ("ACE_Timer_List_T::schedule"); - ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); ACE_Timer_Node_T<TYPE>* n = this->alloc_node(); @@ -203,7 +212,7 @@ ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::schedule (const TYPE &type, /// The shared scheduling functionality between schedule() and reschedule() template <class TYPE, class FUNCTOR, class ACE_LOCK> void ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::schedule_i (ACE_Timer_Node_T<TYPE>* n, - const ACE_Time_Value& expire) + const ACE_Time_Value& expire) { if (this->is_empty()) { n->set_prev(this->head_); @@ -230,7 +239,7 @@ ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::schedule_i (ACE_Timer_Node_T<TYPE>* n template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_Timer_Node_T<TYPE>* -ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::find_node(long timer_id) const +ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::find_node (long timer_id) const { ACE_Timer_Node_T<TYPE>* n = this->get_first_i(); if (n == 0) @@ -269,12 +278,31 @@ ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::cancel (long timer_id, ACE_TRACE ("ACE_Timer_List_T::cancel"); ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); ACE_Timer_Node_T<TYPE>* n = this->find_node(timer_id); - if (n != 0) { - if (act != 0) - *act = n->get_act(); - this->cancel_i(n, skip_close); - return 1; - } + if (n != 0) + { + if (act != 0) + *act = n->get_act (); + + // Call the close hooks. + int cookie = 0; + + // cancel_type() called once per <type>. + this->upcall_functor ().cancel_type (*this, + n->get_type (), + skip_close, + cookie); + + // cancel_timer() called once per <timer>. + this->upcall_functor ().cancel_timer (*this, + n->get_type (), + skip_close, + cookie); + + this->cancel_i (n, skip_close); + + return 1; + } + return 0; } @@ -287,30 +315,48 @@ ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::cancel (const TYPE &type, int skip_cl int num_canceled = 0; // Note : Technically this can overflow. - if (! this->is_empty()) { - - for (ACE_Timer_Node_T<TYPE>* n = this->get_first(); n != this->head_;) + if (!this->is_empty ()) { - if (n->get_type() == type) // Note: Typically Type is an ACE_Event_Handler* - { - ++num_canceled; - - ACE_Timer_Node_T<TYPE>* tmp = n; - n = n->get_next(); - int always_skip_close = 1; // todo : Is this correct? - this->cancel_i(tmp, always_skip_close); - } - else - { - n = n->get_next(); - } + for (ACE_Timer_Node_T<TYPE>* n = this->get_first(); + n != this->head_; + ) + { + if (n->get_type() == type) // Note: Typically Type is an ACE_Event_Handler* + { + ++num_canceled; + + ACE_Timer_Node_T<TYPE>* tmp = n; + n = n->get_next(); + + this->cancel_i (tmp, skip_close); + } + else + { + n = n->get_next(); + } + } } - } + // Call the close hooks. + int cookie = 0; + + // cancel_type() called once per <type>. + this->upcall_functor ().cancel_type (*this, + type, + skip_close, + cookie); + + for (int i = 0; + i < num_canceled; + ++i) + { + // cancel_timer() called once per <timer>. + this->upcall_functor ().cancel_timer (*this, + type, + skip_close, + cookie); + } - if (! skip_close) { // && num_canceled > 0) { - this->upcall_functor().cancellation (*this, type); - } return num_canceled; } @@ -325,13 +371,11 @@ ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::unlink (ACE_Timer_Node_T<TYPE>* n) /// Shared subset of the two cancel() methods. template <class TYPE, class FUNCTOR, class ACE_LOCK> void -ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::cancel_i (ACE_Timer_Node_T<TYPE>* n, int skip_close) +ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::cancel_i (ACE_Timer_Node_T<TYPE>* n, + int skip_close) { - this->unlink(n); + this->unlink (n); this->free_node (n); - if (! skip_close) { - this->upcall_functor().cancellation (*this, n->get_type()); - } } // Reads the first node on the list and returns it. diff --git a/ace/Timer_List_T.h b/ace/Timer_List_T.h index 0f13647e591..42ce2a2eab0 100644 --- a/ace/Timer_List_T.h +++ b/ace/Timer_List_T.h @@ -33,7 +33,7 @@ class ACE_Timer_List_T; * node of a timer queue. */ template <class TYPE, class FUNCTOR, class ACE_LOCK> -class ACE_Timer_List_Iterator_T +class ACE_Timer_List_Iterator_T : public ACE_Timer_Queue_Iterator_T <TYPE, FUNCTOR, ACE_LOCK> { public: @@ -116,26 +116,6 @@ public: virtual const ACE_Time_Value& earliest_time (void) const; /** - * Schedule <type> that will expire at <future_time>, - * which is specified in absolute time. If it expires then <act> is - * passed in as the value to the <functor>. If <interval> is != to - * <ACE_Time_Value::zero> then it is used to reschedule the <type> - * automatically, using relative time to the current <gettimeofday>. - * This method returns a <timer_id> that uniquely identifies the the - * <type> entry in an internal list. This <timer_id> can be used to - * cancel the timer before it expires. The cancellation ensures - * that <timer_ids> are unique up to values of greater than 2 - * billion timers. As long as timers don't stay around longer than - * this there should be no problems with accidentally deleting the - * wrong timer. Returns -1 on failure (which is guaranteed never to - * be a valid <timer_id>). - */ - virtual long schedule (const TYPE& type, - const void* act, - const ACE_Time_Value& future_time, - const ACE_Time_Value& interval = ACE_Time_Value::zero); - - /** * Resets the interval of the timer represented by <timer_id> to * <interval>, which is specified in relative time to the current * <gettimeofday>. If <interval> is equal to @@ -184,10 +164,34 @@ public: private: + /** + * Schedule <type> that will expire at <future_time>, which is + * specified in absolute time. If it expires then <act> is passed + * in as the value to the <functor>. If <interval> is != to + * <ACE_Time_Value::zero> then it is used to reschedule the <type> + * automatically, using relative time to the current <gettimeofday>. + * This method returns a <timer_id> that uniquely identifies the the + * <type> entry in an internal list. This <timer_id> can be used to + * cancel the timer before it expires. The cancellation ensures + * that <timer_ids> are unique up to values of greater than 2 + * billion timers. As long as timers don't stay around longer than + * this there should be no problems with accidentally deleting the + * wrong timer. Returns -1 on failure (which is guaranteed never to + * be a valid <timer_id>). + */ + virtual long schedule_i (const TYPE& type, + const void* act, + const ACE_Time_Value& future_time, + const ACE_Time_Value& interval); + void schedule_i(ACE_Timer_Node_T<TYPE>* n, const ACE_Time_Value& exp); + ACE_Timer_Node_T<TYPE>* find_node(long timer_id) const; + void cancel_i (ACE_Timer_Node_T<TYPE>* n, int skip_close); + void unlink (ACE_Timer_Node_T<TYPE>* n); + ACE_Timer_Node_T<TYPE>* get_first_i(void) const; private: diff --git a/ace/Timer_Queue.h b/ace/Timer_Queue.h index 54a0a8f1137..999dc5ac7d5 100644 --- a/ace/Timer_Queue.h +++ b/ace/Timer_Queue.h @@ -6,7 +6,7 @@ * * $Id$ * - * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> and + * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> and * Irfan Pyarali <irfan@cs.wustl.edu>. */ //============================================================================= diff --git a/ace/Timer_Queue_T.cpp b/ace/Timer_Queue_T.cpp index c25af115715..bcff7136756 100644 --- a/ace/Timer_Queue_T.cpp +++ b/ace/Timer_Queue_T.cpp @@ -12,6 +12,7 @@ #include "ace/Signal.h" #include "ace/Timer_Queue_T.h" #include "ace/Log_Msg.h" +#include "ace/Reactor_Timer_Interface.h" #if !defined (__ACE_INLINE__) #include "ace/Timer_Queue_T.i" @@ -52,8 +53,6 @@ ACE_Timer_Node_T<TYPE>::~ACE_Timer_Node_T (void) ACE_TRACE ("ACE_Timer_Node_T::~ACE_Timer_Node_T"); } - - template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_Timer_Queue_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::ACE_Timer_Queue_Iterator_T (void) { @@ -208,6 +207,33 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::mutex (void) return this->mutex_; } +template <class TYPE, class FUNCTOR, class ACE_LOCK> long +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::schedule (const TYPE &type, + const void *act, + const ACE_Time_Value &future_time, + const ACE_Time_Value &interval) +{ + ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); + + // Schedule the timer. + int result = + this->schedule_i (type, + act, + future_time, + interval); + + // Return on failure. + if (result == -1) + return result; + + // Inform upcall functor of successful registration. + this->upcall_functor ().registration (*this, + type, + act); + + // Return result; + return result; +} // Run the <handle_timeout> method for all Timers whose values are <= // <cur_time>. @@ -231,8 +257,13 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::expire (const ACE_Time_Value &cur_ti while ((result = this->dispatch_info_i (cur_time, info)) != 0) { - // call the functor - this->upcall (info.type_, info.act_, cur_time); + const void *upcall_act = 0; + + this->preinvoke (info, cur_time, upcall_act); + + this->upcall (info, cur_time); + + this->postinvoke (info, cur_time, upcall_act); number_of_timers_expired++; @@ -242,7 +273,6 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::expire (const ACE_Time_Value &cur_ti return number_of_timers_expired; } - template <class TYPE, class FUNCTOR, class ACE_LOCK> int ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::dispatch_info_i (const ACE_Time_Value &cur_time, ACE_Timer_Node_Dispatch_Info_T<TYPE> &info) @@ -267,7 +297,8 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::dispatch_info_i (const ACE_Time_Valu // Make sure that we skip past values that have already // "expired". do - expired->set_timer_value (expired->get_timer_value () + expired->get_interval ()); + expired->set_timer_value (expired->get_timer_value () + + expired->get_interval ()); while (expired->get_timer_value () <= cur_time); // Since this is an interval timer, we need to reschedule @@ -286,7 +317,6 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::dispatch_info_i (const ACE_Time_Valu return 0; } - template <class TYPE, class FUNCTOR, class ACE_LOCK> void ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::return_node (ACE_Timer_Node_T<TYPE> *node) { @@ -306,51 +336,142 @@ ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>::~ACE_Event_Handler_Handle_Tim } template <class ACE_LOCK> int +ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>::registration (TIMER_QUEUE &, + ACE_Event_Handler *event_handler, + const void *) +{ + int requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + if (requires_reference_counting) + { + event_handler->add_reference (); + } + + return 0; +} + +template <class ACE_LOCK> int +ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>::preinvoke (TIMER_QUEUE & /* timer_queue */, + ACE_Event_Handler *event_handler, + const void * /* timer_act */, + int /* recurring_timer */, + const ACE_Time_Value & /* cur_time */, + const void *&upcall_act) +{ + int requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + if (requires_reference_counting) + { + event_handler->add_reference (); + + upcall_act = &this->requires_reference_counting_; + } + + return 0; +} + +template <class ACE_LOCK> int +ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>::postinvoke (TIMER_QUEUE & /* timer_queue */, + ACE_Event_Handler *event_handler, + const void * /* timer_act */, + int /* recurring_timer */, + const ACE_Time_Value & /* cur_time */, + const void *upcall_act) +{ + if (upcall_act == &this->requires_reference_counting_) + { + event_handler->remove_reference (); + } + + return 0; +} + +template <class ACE_LOCK> int ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>::timeout (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler, + ACE_Event_Handler *event_handler, const void *act, + int recurring_timer, const ACE_Time_Value &cur_time) { - // Upcall to the <handler>s handle_timeout() method. - if (handler->handle_timeout (cur_time, act) == -1) + int requires_reference_counting = 0; + + if (!recurring_timer) { -#if 0 - // Commented out until we figure out how to break the coupling that results... - if (handler->reactor ()) - // Call the reactor's cancel_timer() method to minimize locking. - handler->reactor ()->cancel_timer (handler, 0); // 0 means "call handle_close()". + requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + } + + // Upcall to the <handler>s handle_timeout method. + if (event_handler->handle_timeout (cur_time, act) == -1) + { + if (event_handler->reactor ()) + event_handler->reactor_timer_interface ()->cancel_timer (event_handler, 0); else -#endif - timer_queue.cancel (handler, 0); + timer_queue.cancel (event_handler, 0); // 0 means "call handle_close()". + } + + if (!recurring_timer && + requires_reference_counting) + { + event_handler->remove_reference (); } return 0; } template <class ACE_LOCK> int -ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>::cancellation (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler) +ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>::cancel_type (TIMER_QUEUE &, + ACE_Event_Handler *event_handler, + int dont_call, + int &requires_reference_counting) { - ACE_UNUSED_ARG (timer_queue); + requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; // Upcall to the <handler>s handle_close method - handler->handle_close (ACE_INVALID_HANDLE, - ACE_Event_Handler::TIMER_MASK); + if (dont_call == 0) + event_handler->handle_close (ACE_INVALID_HANDLE, + ACE_Event_Handler::TIMER_MASK); + + return 0; +} + +template <class ACE_LOCK> int +ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>::cancel_timer (TIMER_QUEUE &, + ACE_Event_Handler *event_handler, + int, + int requires_reference_counting) +{ + if (requires_reference_counting) + event_handler->remove_reference (); + return 0; } template <class ACE_LOCK> int ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>::deletion (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler, - const void *arg) + ACE_Event_Handler *event_handler, + const void *) { - ACE_UNUSED_ARG (timer_queue); - ACE_UNUSED_ARG (handler); - ACE_UNUSED_ARG (arg); + int requires_reference_counting = 0; + + this->cancel_type (timer_queue, + event_handler, + 0, + requires_reference_counting); - // Does nothing + this->cancel_timer (timer_queue, + event_handler, + 0, + requires_reference_counting); return 0; } -#endif /* ACE_TIMER_QUEUE_T_C*/ +#endif /* ACE_TIMER_QUEUE_T_C */ diff --git a/ace/Timer_Queue_T.h b/ace/Timer_Queue_T.h index 1cae4f56e8d..99294df491b 100644 --- a/ace/Timer_Queue_T.h +++ b/ace/Timer_Queue_T.h @@ -22,7 +22,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/Test_and_Set.h" +#include "ace/Event_Handler.h" /** * @class ACE_Timer_Node_Dispatch_Info_T @@ -39,6 +39,9 @@ public: /// Asynchronous completion token associated with the timer. const void *act_; + + /// Flag to check if the timer is recurring. + int recurring_timer_; }; /** @@ -226,9 +229,9 @@ public: virtual const ACE_Time_Value &earliest_time (void) const = 0; /** - * Schedule <type> that will expire at <future_time>, - * which is specified in absolute time. If it expires then <act> is - * passed in as the value to the <functor>. If <interval> is != to + * Schedule <type> that will expire at <future_time>, which is + * specified in absolute time. If it expires then <act> is passed + * in as the value to the <functor>. If <interval> is != to * <ACE_Time_Value::zero> then it is used to reschedule the <type> * automatically, using relative time to the current <gettimeofday>. * This method returns a <timer_id> that uniquely identifies the the @@ -243,7 +246,7 @@ public: virtual long schedule (const TYPE &type, const void *act, const ACE_Time_Value &future_time, - const ACE_Time_Value &interval = ACE_Time_Value::zero) = 0; + const ACE_Time_Value &interval = ACE_Time_Value::zero); /** * Resets the interval of the timer represented by <timer_id> to @@ -291,8 +294,8 @@ public: * there is a node whose value <= <cur_time> else returns a 0. * */ - int dispatch_info (const ACE_Time_Value ¤t_time, - ACE_Timer_Node_Dispatch_Info_T<TYPE> &info); + virtual int dispatch_info (const ACE_Time_Value ¤t_time, + ACE_Timer_Node_Dispatch_Info_T<TYPE> &info); /** * Run the <functor> for all timers whose values are <= @@ -346,7 +349,7 @@ public: /// Determine the next event to timeout. Returns <max> if there are /// no pending timers or if all pending timers are longer than max. - /// This method acquires a lock internally since it modifies internal state. + /// This method acquires a lock internally since it modifies internal state. virtual ACE_Time_Value *calculate_timeout (ACE_Time_Value *max); /** @@ -354,7 +357,7 @@ public: * no pending timers or if all pending timers are longer than max. * <the_timeout> should be a pointer to storage for the timeout value, * and this value is also returned. This method does not acquire a - * lock internally since it doesn't modify internal state. If you + * lock internally since it doesn't modify internal state. If you * need to call this method when the queue is being modified * concurrently, however, you should make sure to acquire the <mutex()> * externally before making the call. @@ -390,14 +393,28 @@ public: /// after it is returned by a method like <remove_first>. virtual void return_node (ACE_Timer_Node_T<TYPE> *); + /// This method will call the preinvoke() on <functor>. + void preinvoke (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info, + const ACE_Time_Value &cur_time, + const void *&upcall_act); + + /// This method will call the timeout() on <functor>. + void upcall (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info, + const ACE_Time_Value &cur_time); - /// This method will call the <functor> with the <type>, <act> and - /// <cur_time> - /* virtual */ void upcall (TYPE &type, - const void *act, - const ACE_Time_Value &cur_time); + /// This method will call the postinvoke() on <functor>. + void postinvoke (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info, + const ACE_Time_Value &cur_time, + const void *upcall_act); protected: + + /// Schedule a timer. + virtual long schedule_i (const TYPE &type, + const void *act, + const ACE_Time_Value &future_time, + const ACE_Time_Value &interval) = 0; + /// Reschedule an "interval" <ACE_Timer_Node>. virtual void reschedule (ACE_Timer_Node_T<TYPE> *) = 0; @@ -408,8 +425,8 @@ protected: virtual void free_node (ACE_Timer_Node_T<TYPE> *); /// Non-locking version of dispatch_info () - int dispatch_info_i (const ACE_Time_Value ¤t_time, - ACE_Timer_Node_Dispatch_Info_T<TYPE> &info); + virtual int dispatch_info_i (const ACE_Time_Value ¤t_time, + ACE_Timer_Node_Dispatch_Info_T<TYPE> &info); /// Synchronization variable for <ACE_Timer_Queue>. /// NOTE: the right name would be lock_, but HP/C++ will choke on that! @@ -467,22 +484,58 @@ public: /// Destructor. ~ACE_Event_Handler_Handle_Timeout_Upcall (void); - /// This method is called when the timer expires + /// This method is called when a timer is registered. + int registration (TIMER_QUEUE &timer_queue, + ACE_Event_Handler *handler, + const void *arg); + + /// This method is called before the timer expires. + int preinvoke (TIMER_QUEUE &timer_queue, + ACE_Event_Handler *handler, + const void *arg, + int recurring_timer, + const ACE_Time_Value &cur_time, + const void *&upcall_act); + + /// This method is called when the timer expires. int timeout (TIMER_QUEUE &timer_queue, ACE_Event_Handler *handler, const void *arg, + int recurring_timer, const ACE_Time_Value &cur_time); - /// This method is called when the timer is cancelled - int cancellation (TIMER_QUEUE &timer_queue, - ACE_Event_Handler *handler); + /// This method is called after the timer expires. + int postinvoke (TIMER_QUEUE &timer_queue, + ACE_Event_Handler *handler, + const void *arg, + int recurring_timer, + const ACE_Time_Value &cur_time, + const void *upcall_act); + + /// This method is called when a handler is cancelled + int cancel_type (TIMER_QUEUE &timer_queue, + ACE_Event_Handler *handler, + int dont_call, + int &requires_reference_counting); + + /// This method is called when a timer is cancelled + int cancel_timer (TIMER_QUEUE &timer_queue, + ACE_Event_Handler *handler, + int dont_call, + int requires_reference_counting); /// This method is called when the timer queue is destroyed and /// the timer is still contained in it int deletion (TIMER_QUEUE &timer_queue, ACE_Event_Handler *handler, const void *arg); + private: + + /// Flag indicating that reference counting is required for this + /// event handler upcall. + int requires_reference_counting_; + // = Don't allow these operations for now. ACE_UNIMPLEMENTED_FUNC (ACE_Event_Handler_Handle_Timeout_Upcall (const ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK> &)) ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK> &)) diff --git a/ace/Timer_Queue_T.i b/ace/Timer_Queue_T.i index 8af63669a6f..5a72678f105 100644 --- a/ace/Timer_Queue_T.i +++ b/ace/Timer_Queue_T.i @@ -126,6 +126,8 @@ ACE_Timer_Node_T<TYPE>::get_dispatch_info (ACE_Timer_Node_Dispatch_Info_T<TYPE> // Yes, do a copy info.type_ = this->type_; info.act_ = this->act_; + info.recurring_timer_ = + this->interval_ > ACE_Time_Value::zero; } template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE void @@ -160,13 +162,41 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::dispatch_info (const ACE_Time_Value } template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE void -ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::upcall (TYPE &type, - const void *act, - const ACE_Time_Value &cur_time) +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::upcall (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info, + const ACE_Time_Value &cur_time) { - this->upcall_functor ().timeout (*this, type, act, cur_time); + this->upcall_functor ().timeout (*this, + info.type_, + info.act_, + info.recurring_timer_, + cur_time); } +template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE void +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::preinvoke (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info, + const ACE_Time_Value &cur_time, + const void *&upcall_act) +{ + this->upcall_functor ().preinvoke (*this, + info.type_, + info.act_, + info.recurring_timer_, + cur_time, + upcall_act); +} + +template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE void +ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::postinvoke (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info, + const ACE_Time_Value &cur_time, + const void *upcall_act) +{ + this->upcall_functor ().postinvoke (*this, + info.type_, + info.act_, + info.recurring_timer_, + cur_time, + upcall_act); +} template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE ACE_Time_Value ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::gettimeofday (void) diff --git a/ace/Timer_Wheel_T.cpp b/ace/Timer_Wheel_T.cpp index 2272210f92f..dab38390c41 100644 --- a/ace/Timer_Wheel_T.cpp +++ b/ace/Timer_Wheel_T.cpp @@ -92,24 +92,24 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::ACE_Timer_Wheel_T template <class TYPE, class FUNCTOR, class ACE_LOCK> int ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::power2bits (int n, - int min_bits, + int min_bits, int max_bits) { int max = (1 << max_bits) - 1; - if (n > max) + if (n > max) return max_bits; // count the bits in n. int i = 0; int tmp = n; - do + do { tmp >>= 1; ++i; - } + } while (tmp != 0); - if (i <= min_bits) + if (i <= min_bits) return min_bits; // Which is nearest? @@ -177,7 +177,9 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::~ACE_Timer_Wheel_T (void) for (ACE_Timer_Node_T<TYPE>* n = root->get_next (); n != root;) { ACE_Timer_Node_T<TYPE>* next = n->get_next (); - this->upcall_functor ().deletion (*this, n->get_type (), n->get_act ()); + this->upcall_functor ().deletion (*this, + n->get_type (), + n->get_act ()); this->free_node (n); n = next; } @@ -380,15 +382,12 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::generate_timer_id (u_int spoke) * -1 on failure. */ template <class TYPE, class FUNCTOR, class ACE_LOCK> long -ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::schedule ( - const TYPE& type, - const void* act, - const ACE_Time_Value& future_time, - const ACE_Time_Value& interval - ) +ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::schedule_i (const TYPE& type, + const void* act, + const ACE_Time_Value& future_time, + const ACE_Time_Value& interval) { ACE_TRACE ("ACE_Timer_Wheel_T::schedule"); - ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); ACE_Timer_Node_T<TYPE>* n = this->alloc_node (); @@ -533,8 +532,8 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::cancel (const TYPE& type, int skip_c ACE_Timer_Node_T<TYPE>* tmp = n; n = n->get_next (); - int always_skip_close = 1; // todo : Is this correct? - this->cancel_i (tmp, always_skip_close); + + this->cancel_i (tmp, skip_close); } else { @@ -547,8 +546,25 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::cancel (const TYPE& type, int skip_c this->recalc_earliest (last); } - if (!skip_close) // && num_canceled > 0) - this->upcall_functor().cancellation (*this, type); + // Call the close hooks. + int cookie = 0; + + // cancel_type() called once per <type>. + this->upcall_functor ().cancel_type (*this, + type, + skip_close, + cookie); + + for (int i = 0; + i < num_canceled; + ++i) + { + // cancel_timer() called once per <timer>. + this->upcall_functor ().cancel_timer (*this, + type, + skip_close, + cookie); + } return num_canceled; } @@ -582,12 +598,31 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::cancel (long timer_id, if (n != 0) { ACE_Time_Value last = n->get_timer_value (); + int recalc = (this->get_first_i () == n); + + // Call the close hooks. + int cookie = 0; + + // cancel_type() called once per <type>. + this->upcall_functor ().cancel_type (*this, + n->get_type (), + skip_close, + cookie); + + // cancel_timer() called once per <timer>. + this->upcall_functor ().cancel_timer (*this, + n->get_type (), + skip_close, + cookie); if (act != 0) *act = n->get_act (); + this->cancel_i (n, skip_close); + if (recalc) this->recalc_earliest (last); + return 1; } return 0; @@ -597,17 +632,14 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::cancel (long timer_id, template <class TYPE, class FUNCTOR, class ACE_LOCK> void ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::cancel_i (ACE_Timer_Node_T<TYPE>* n, int skip_close) { - //ACE_ERROR((LM_ERROR, "Canceling %x\n", (long) n)); this->unlink (n); this->free_node (n); - if (!skip_close) - this->upcall_functor ().cancellation (*this, n->get_type ()); } /// There are a few places where we have to figure out which timer /// will expire next. This method makes the assumption that spokes /// are always sorted, and that timers are always in the correct spoke -/// determined from their expiration time. +/// determined from their expiration time. /// The last time is always passed in, even though you can often calculate /// it as get_first()->get_timer_value(). template <class TYPE, class FUNCTOR, class ACE_LOCK> void @@ -619,7 +651,7 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::recalc_earliest return; ACE_Time_Value et = ACE_Time_Value::zero; - + u_int spoke = this->earliest_spoke_; // We will have to go around the wheel at most one time. @@ -655,14 +687,14 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::dump (void) const { ACE_TRACE ("ACE_Timer_Wheel_T::dump"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nspoke_count_ = %d"), this->spoke_count_)); ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nresolution_ = %d"), 1 << this->res_bits_)); ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nwheel_ = \n"))); - + for (u_int i = 0; i < this->spoke_count_; ++i) { ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("%d\n"), i)); @@ -674,7 +706,7 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::dump (void) const n->dump (); } } - + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); } @@ -720,7 +752,7 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::remove_first_expired (const ACE_Time * * @return The earliest timer node. */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_Timer_Node_T<TYPE>* ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::get_first (void) { @@ -728,7 +760,7 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::get_first (void) return this->get_first_i (); } -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_Timer_Node_T<TYPE>* ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::get_first_i (void) const { @@ -743,7 +775,7 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::get_first_i (void) const /** * @return The iterator */ -template <class TYPE, class FUNCTOR, class ACE_LOCK> +template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_Timer_Queue_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>& ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::iter (void) { @@ -763,7 +795,7 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::expire () /** * This is a specialized version of expire that is more suited for the -* internal data representation. +* internal data representation. * * @param cur_time The time to expire timers up to. * @@ -780,15 +812,32 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::expire (const ACE_Time_Value& cur_ti while (n != 0) { - ++ expcount; + ++expcount; //ACE_ERROR((LM_ERROR, "Expiring %x\n", (long) n)); - this->upcall (n->get_type (), n->get_act (), cur_time); + ACE_Timer_Node_Dispatch_Info_T<TYPE> info; + + // Get the dispatch info + n->get_dispatch_info (info); + + const void *upcall_act = 0; + + this->preinvoke (info, cur_time, upcall_act); + + this->upcall (info, cur_time); + + this->postinvoke (info, cur_time, upcall_act); if (n->get_interval () > ACE_Time_Value::zero) { - n->set_timer_value (cur_time + n->get_interval ()); + // Make sure that we skip past values that have already + // "expired". + do + n->set_timer_value (n->get_timer_value () + + n->get_interval ()); + while (n->get_timer_value () <= cur_time); + this->reschedule (n); } else @@ -806,7 +855,7 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::expire (const ACE_Time_Value& cur_ti /////////////////////////////////////////////////////////////////////////// // ACE_Timer_Wheel_Iterator_T - + /** * Just initializes the iterator with a ACE_Timer_Wheel_T and then calls * first() to initialize the rest of itself. @@ -814,7 +863,7 @@ ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK>::expire (const ACE_Time_Value& cur_ti * @param wheel A reference for a timer queue to iterate over */ template <class TYPE, class FUNCTOR, class ACE_LOCK> -ACE_Timer_Wheel_Iterator_T<TYPE,FUNCTOR,ACE_LOCK>::ACE_Timer_Wheel_Iterator_T +ACE_Timer_Wheel_Iterator_T<TYPE,FUNCTOR,ACE_LOCK>::ACE_Timer_Wheel_Iterator_T (Wheel& wheel) : timer_wheel_ (wheel) { diff --git a/ace/Timer_Wheel_T.h b/ace/Timer_Wheel_T.h index 9505d918741..62f7ab916f1 100644 --- a/ace/Timer_Wheel_T.h +++ b/ace/Timer_Wheel_T.h @@ -119,13 +119,6 @@ public: /// Must be called on a non-empty queue. virtual const ACE_Time_Value& earliest_time (void) const; - /// Schedules a timer. - virtual long schedule (const TYPE& type, - const void* act, - const ACE_Time_Value& future_time, - const ACE_Time_Value& interval - = ACE_Time_Value::zero); - /// Changes the interval of a timer (and can make it periodic or non /// periodic by setting it to ACE_Time_Value::zero or not). virtual int reset_interval (long timer_id, @@ -165,7 +158,15 @@ public: /// Reads the earliest node from the queue and returns it. virtual ACE_Timer_Node_T<TYPE>* get_first (void); - + +protected: + + /// Schedules a timer. + virtual long schedule_i (const TYPE& type, + const void* act, + const ACE_Time_Value& future_time, + const ACE_Time_Value& interval); + private: // The following are documented in the .cpp file. ACE_Timer_Node_T<TYPE>* get_first_i (void) const; diff --git a/ace/WFMO_Reactor.cpp b/ace/WFMO_Reactor.cpp index 3f55ad7a693..19e4cea62e0 100644 --- a/ace/WFMO_Reactor.cpp +++ b/ace/WFMO_Reactor.cpp @@ -652,6 +652,15 @@ ACE_WFMO_Reactor_Handler_Repository::bind_i (int io_entry, this->handles_to_be_added_++; + int requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + if (requires_reference_counting) + { + event_handler->add_reference (); + } + // Wake up all threads in WaitForMultipleObjects so that they can // reconsult the handle set this->wfmo_reactor_.wakeup_all_threads (); @@ -672,7 +681,8 @@ ACE_WFMO_Reactor_Handler_Repository::make_changes_in_current_infos (void) // have been schedule for deletion if (this->handles_to_be_deleted_ > 0 || this->handles_to_be_suspended_ > 0) { - for (size_t i = 0; i < this->max_handlep1_; i++) + size_t i = 0; + while (i < this->max_handlep1_) { // This stuff is necessary here, since we should not make // the upcall until all the internal data structures have @@ -747,11 +757,29 @@ ACE_WFMO_Reactor_Handler_Repository::make_changes_in_current_infos (void) this->current_handles_[last_valid_slot] = ACE_INVALID_HANDLE; this->max_handlep1_--; } + else + { + // This current entry is not up for deletion or + // suspension. Proceed to the next entry in the current + // handles. + ++i; + } // Now that all internal structures have been updated, make // the upcall. if (event_handler != 0) - event_handler->handle_close (handle, masks); + { + int requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + event_handler->handle_close (handle, masks); + + if (requires_reference_counting) + { + event_handler->remove_reference (); + } + } } } @@ -764,7 +792,8 @@ ACE_WFMO_Reactor_Handler_Repository::make_changes_in_suspension_infos (void) // Go through the <suspended_handle> array if (this->handles_to_be_deleted_ > 0 || this->handles_to_be_resumed_ > 0) { - for (size_t i = 0; i < this->suspended_handles_; i++) + size_t i = 0; + while (i < this->suspended_handles_) { // This stuff is necessary here, since we should not make // the upcall until all the internal data structures have @@ -836,11 +865,29 @@ ACE_WFMO_Reactor_Handler_Repository::make_changes_in_suspension_infos (void) this->current_suspended_info_[last_valid_slot].reset (); this->suspended_handles_--; } + else + { + // This current entry is not up for deletion or + // resumption. Proceed to the next entry in the + // suspended handles. + ++i; + } // Now that all internal structures have been updated, make // the upcall. if (event_handler != 0) - event_handler->handle_close (handle, masks); + { + int requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + event_handler->handle_close (handle, masks); + + if (requires_reference_counting) + { + event_handler->remove_reference (); + } + } } } @@ -920,7 +967,18 @@ ACE_WFMO_Reactor_Handler_Repository::make_changes_in_to_be_added_infos (void) // Now that all internal structures have been updated, make the // upcall. if (event_handler != 0) - event_handler->handle_close (handle, masks); + { + int requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + event_handler->handle_close (handle, masks); + + if (requires_reference_counting) + { + event_handler->remove_reference (); + } + } } // Since all to be added handles have been taken care of, reset the @@ -1282,12 +1340,15 @@ ACE_WFMO_Reactor::register_handler_i (ACE_HANDLE event_handle, // If this is a Winsock 1 system, the underlying event assignment will // not work, so don't try. Winsock 1 must use ACE_Select_Reactor for // reacting to socket activity. + #if !defined (ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2 == 0) + ACE_UNUSED_ARG (event_handle); ACE_UNUSED_ARG (io_handle); ACE_UNUSED_ARG (event_handler); ACE_UNUSED_ARG (new_masks); ACE_NOTSUP_RETURN (-1); + #else // Make sure that the <handle> is valid @@ -1361,7 +1422,9 @@ ACE_WFMO_Reactor::register_handler_i (ACE_HANDLE event_handle, } else return -1; -#endif /* ACE_HAS_PHARLAP */ + +#endif /* ACE_HAS_WINSOCK2 || ACE_HAS_WINSOCK2 == 0 */ + } int @@ -1467,15 +1530,22 @@ ACE_WFMO_Reactor_Handler_Repository::modify_network_events_i (ACE_HANDLE io_hand return found; } -int +ACE_Event_Handler * +ACE_WFMO_Reactor_Handler_Repository::find_handler (ACE_HANDLE handle) +{ + long existing_masks_ignored = 0; + return this->handler (handle, + existing_masks_ignored); +} + +ACE_Event_Handler * ACE_WFMO_Reactor_Handler_Repository::handler (ACE_HANDLE handle, - ACE_Reactor_Mask user_masks, - ACE_Event_Handler **user_event_handler) + long &existing_masks) { int found = 0; size_t i = 0; ACE_Event_Handler *event_handler = 0; - long existing_masks = 0; + existing_masks = 0; // Look for the handle first @@ -1521,7 +1591,36 @@ ACE_WFMO_Reactor_Handler_Repository::handler (ACE_HANDLE handle, existing_masks = this->to_be_added_info_[i].network_events_; } - // If the handle is not found, return failure. + if (event_handler) + { + int requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + if (requires_reference_counting) + { + event_handler->add_reference (); + } + } + + return event_handler; +} + +int +ACE_WFMO_Reactor_Handler_Repository::handler (ACE_HANDLE handle, + ACE_Reactor_Mask user_masks, + ACE_Event_Handler **user_event_handler) +{ + long existing_masks = 0; + int found = 0; + + ACE_Event_Handler_var safe_event_handler = + this->handler (handle, + existing_masks); + + if (safe_event_handler.handler ()) + found = 1; + if (!found) return -1; @@ -1529,8 +1628,8 @@ ACE_WFMO_Reactor_Handler_Repository::handler (ACE_HANDLE handle, // are on. if (found && ACE_BIT_ENABLED (user_masks, ACE_Event_Handler::READ_MASK)) - if (!ACE_BIT_ENABLED (existing_masks, FD_READ) - && !ACE_BIT_ENABLED (existing_masks, FD_CLOSE)) + if (!ACE_BIT_ENABLED (existing_masks, FD_READ) && + !ACE_BIT_ENABLED (existing_masks, FD_CLOSE)) found = 0; if (found && @@ -1565,7 +1664,7 @@ ACE_WFMO_Reactor_Handler_Repository::handler (ACE_HANDLE handle, if (found && user_event_handler) - *user_event_handler = event_handler; + *user_event_handler = safe_event_handler.release (); if (found) return 0; @@ -1899,14 +1998,29 @@ ACE_WFMO_Reactor::simple_dispatch_handler (DWORD slot, // siginfo_t is an ACE - specific fabrication. Constructor exists. siginfo_t sig (event_handle); - ACE_Event_Handler *eh = + ACE_Event_Handler *event_handler = this->handler_rep_.current_info ()[slot].event_handler_; + int requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + if (requires_reference_counting) + { + event_handler->add_reference (); + } + // Upcall - if (eh->handle_signal (0, &sig) == -1) + if (event_handler->handle_signal (0, &sig) == -1) this->handler_rep_.unbind (event_handle, ACE_Event_Handler::NULL_MASK); + // Call remove_reference() if needed. + if (requires_reference_counting) + { + event_handler->remove_reference (); + } + return 0; } @@ -1941,10 +2055,30 @@ ACE_WFMO_Reactor::complex_dispatch_handler (DWORD slot, events.lNetworkEvents &= current_info.network_events_; while (events.lNetworkEvents != 0) { + ACE_Event_Handler *event_handler = + current_info.event_handler_; + + int reference_counting_required = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + // Call add_reference() if needed. + if (reference_counting_required) + { + event_handler->add_reference (); + } + // Upcall problems |= this->upcall (current_info.event_handler_, current_info.io_handle_, events); + + // Call remove_reference() if needed. + if (reference_counting_required) + { + event_handler->remove_reference (); + } + if (this->handler_rep_.scheduled_for_deletion (slot)) break; } @@ -2046,7 +2180,7 @@ ACE_WFMO_Reactor::upcall (ACE_Event_Handler *event_handler, } } - if (ACE_BIT_ENABLED (actual_events, FD_ACCEPT)) + if (ACE_BIT_ENABLED (actual_events, FD_ACCEPT)) { action = event_handler->handle_input (io_handle); if (action <= 0) @@ -2276,25 +2410,32 @@ ACE_WFMO_Reactor_Notify::handle_signal (int signum, if (buffer->eh_ != 0) { + ACE_Event_Handler *event_handler = + buffer->eh_; + + int requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + int result = 0; switch (buffer->mask_) { case ACE_Event_Handler::READ_MASK: case ACE_Event_Handler::ACCEPT_MASK: - result = buffer->eh_->handle_input (ACE_INVALID_HANDLE); + result = event_handler->handle_input (ACE_INVALID_HANDLE); break; case ACE_Event_Handler::WRITE_MASK: - result = buffer->eh_->handle_output (ACE_INVALID_HANDLE); + result = event_handler->handle_output (ACE_INVALID_HANDLE); break; case ACE_Event_Handler::EXCEPT_MASK: - result = buffer->eh_->handle_exception (ACE_INVALID_HANDLE); + result = event_handler->handle_exception (ACE_INVALID_HANDLE); break; case ACE_Event_Handler::QOS_MASK: - result = buffer->eh_->handle_qos (ACE_INVALID_HANDLE); + result = event_handler->handle_qos (ACE_INVALID_HANDLE); break; case ACE_Event_Handler::GROUP_QOS_MASK: - result = buffer->eh_->handle_group_qos (ACE_INVALID_HANDLE); + result = event_handler->handle_group_qos (ACE_INVALID_HANDLE); break; default: ACE_ERROR ((LM_ERROR, @@ -2302,9 +2443,15 @@ ACE_WFMO_Reactor_Notify::handle_signal (int signum, buffer->mask_)); break; } + if (result == -1) - buffer->eh_->handle_close (ACE_INVALID_HANDLE, - ACE_Event_Handler::EXCEPT_MASK); + event_handler->handle_close (ACE_INVALID_HANDLE, + ACE_Event_Handler::EXCEPT_MASK); + + if (requires_reference_counting) + { + event_handler->remove_reference (); + } } // Make sure to delete the memory regardless of success or @@ -2333,11 +2480,11 @@ ACE_WFMO_Reactor_Notify::handle_signal (int signum, // thread of control. int -ACE_WFMO_Reactor_Notify::notify (ACE_Event_Handler *eh, +ACE_WFMO_Reactor_Notify::notify (ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask, ACE_Time_Value *timeout) { - if (eh != 0) + if (event_handler != 0) { ACE_Message_Block *mb = 0; ACE_NEW_RETURN (mb, @@ -2346,7 +2493,7 @@ ACE_WFMO_Reactor_Notify::notify (ACE_Event_Handler *eh, ACE_Notification_Buffer *buffer = (ACE_Notification_Buffer *) mb->base (); - buffer->eh_ = eh; + buffer->eh_ = event_handler; buffer->mask_ = mask; // Convert from relative time to absolute time by adding the @@ -2361,6 +2508,15 @@ ACE_WFMO_Reactor_Notify::notify (ACE_Event_Handler *eh, mb->release (); return -1; } + + int requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + if (requires_reference_counting) + { + event_handler->add_reference (); + } } return this->wakeup_one_thread_.signal (); @@ -2433,22 +2589,33 @@ ACE_WFMO_Reactor_Notify::purge_pending_notifications (ACE_Event_Handler *eh, ACE_BIT_DISABLED (buffer->mask_, ~mask)) // the existing notification mask // is left with nothing when // applying the mask - { - mb->release (); - ++number_purged; - } + { + ACE_Event_Handler *event_handler = buffer->eh_; + + int requires_reference_counting = + event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + if (requires_reference_counting) + { + event_handler->remove_reference (); + } + + mb->release (); + ++number_purged; + } else - { - // To preserve it, move it to the local_queue. But first, if - // this is not a Reactor notify (it is for a - // particularhandler), and it matches the specified handler - // (or purging all), then apply the mask - if ((0 != buffer->eh_) && - (0 == eh || eh == buffer->eh_)) - ACE_CLR_BITS(buffer->mask_, mask); - if (-1 == local_queue.enqueue_head (mb)) - return -1; - } + { + // To preserve it, move it to the local_queue. But first, if + // this is not a Reactor notify (it is for a + // particularhandler), and it matches the specified handler + // (or purging all), then apply the mask + if ((0 != buffer->eh_) && + (0 == eh || eh == buffer->eh_)) + ACE_CLR_BITS(buffer->mask_, mask); + if (-1 == local_queue.enqueue_head (mb)) + return -1; + } } if (this->message_queue_.message_count ()) diff --git a/ace/WFMO_Reactor.h b/ace/WFMO_Reactor.h index 37dbf1727e6..53b068e71f9 100644 --- a/ace/WFMO_Reactor.h +++ b/ace/WFMO_Reactor.h @@ -403,6 +403,12 @@ public: ACE_Reactor_Mask to_be_removed_masks); /** + * Return the Event_Handler associated with <handle>. Return 0 if + * <handle> is not registered. + */ + ACE_Event_Handler *find_handler (ACE_HANDLE handle); + + /** * Check to see if <handle> is associated with a valid Event_Handler * bound to <mask>. Return the <event_handler> associated with this * <handler> if <event_handler> != 0. @@ -411,6 +417,13 @@ public: ACE_Reactor_Mask mask, ACE_Event_Handler **event_handler = 0); + /** + * Check to see if <handle> is associated with a valid + * Event_Handler. Return Event_Handler and associated masks. + */ + ACE_Event_Handler *handler (ACE_HANDLE handle, + long &existing_masks); + /// Dump the state of an object. void dump (void) const; @@ -1057,6 +1070,12 @@ public: // = Assorted helper methods. /** + * Return the Event_Handler associated with <handle>. Return 0 if + * <handle> is not registered. + */ + ACE_Event_Handler *find_handler (ACE_HANDLE handle); + + /** * Check to see if <handle> is associated with a valid Event_Handler * bound to <mask>. Return the <event_handler> associated with this * <handler> if <event_handler> != 0. diff --git a/ace/WFMO_Reactor.i b/ace/WFMO_Reactor.i index 98c6c5d81ba..472a2d20fdc 100644 --- a/ace/WFMO_Reactor.i +++ b/ace/WFMO_Reactor.i @@ -1082,11 +1082,21 @@ ACE_WFMO_Reactor::ready_ops (ACE_HANDLE handle, ACE_NOTSUP_RETURN (-1); } +ACE_INLINE ACE_Event_Handler * +ACE_WFMO_Reactor::find_handler (ACE_HANDLE handle) +{ + ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, 0); + + return this->handler_rep_.find_handler (handle); +} + ACE_INLINE int ACE_WFMO_Reactor::handler (ACE_HANDLE handle, ACE_Reactor_Mask mask, ACE_Event_Handler **event_handler) { + ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); + return this->handler_rep_.handler (handle, mask, event_handler); diff --git a/apps/Gateway/Gateway/Connection_Handler_Connector.cpp b/apps/Gateway/Gateway/Connection_Handler_Connector.cpp index d5a250cec60..d019f76a3b2 100644 --- a/apps/Gateway/Gateway/Connection_Handler_Connector.cpp +++ b/apps/Gateway/Gateway/Connection_Handler_Connector.cpp @@ -25,52 +25,42 @@ Connection_Handler_Connector::initiate_connection (Connection_Handler *connectio if (connection_handler->local_addr ().addr_to_string (addr_buf, sizeof addr_buf) == -1 || connection_handler->remote_addr ().addr_to_string (addr_buf, sizeof addr_buf) == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", - "can't obtain peer's address"), -1); + "can't obtain peer's address"), -1); // Try to connect to the Peer. if (this->connect (connection_handler, connection_handler->remote_addr (), - synch_options, + synch_options, connection_handler->local_addr ()) == -1) { if (errno != EWOULDBLOCK) - { - connection_handler->state (Connection_Handler::FAILED); - ACE_DEBUG ((LM_DEBUG, "(%t) %p on address %s\n", - "connect", addr_buf)); - return -1; - } + { + connection_handler->state (Connection_Handler::FAILED); + ACE_DEBUG ((LM_DEBUG, "(%t) %p on address %s\n", + "connect", addr_buf)); + return -1; + } else - { - connection_handler->state (Connection_Handler::CONNECTING); - ACE_DEBUG ((LM_DEBUG, - "(%t) in the process of connecting to %s\n", - addr_buf)); - } + { + connection_handler->state (Connection_Handler::CONNECTING); + ACE_DEBUG ((LM_DEBUG, + "(%t) in the process of connecting to %s\n", + addr_buf)); + } } else { connection_handler->state (Connection_Handler::ESTABLISHED); ACE_DEBUG ((LM_DEBUG, "(%t) connected to %s on %d\n", - addr_buf, connection_handler->get_handle ())); + addr_buf, connection_handler->get_handle ())); } return 0; } #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Connector<Connection_Handler, ACE_SOCK_CONNECTOR>; -template class ACE_Svc_Tuple<Connection_Handler>; -template class ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Connection_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<Connection_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Connection_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Connection_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<Connection_Handler> *>; +template class ACE_NonBlocking_Connect_Handler<Connection_Handler>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Connector<Connection_Handler, ACE_SOCK_CONNECTOR> -#pragma instantiate ACE_Svc_Tuple<Connection_Handler> -#pragma instantiate ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Connection_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<Connection_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Connection_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Connection_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<Connection_Handler> *> +#pragma instantiate ACE_NonBlocking_Connect_Handler<Connection_Handler> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/apps/Gateway/Peer/Peer.cpp b/apps/Gateway/Peer/Peer.cpp index c19790fd9bf..b45901cde3c 100644 --- a/apps/Gateway/Peer/Peer.cpp +++ b/apps/Gateway/Peer/Peer.cpp @@ -214,7 +214,7 @@ Peer_Handler::nonblk_put (ACE_Message_Block *mb) -1); return 0; } - else + else return n; } @@ -888,21 +888,11 @@ ACE_SVC_FACTORY_DEFINE (Peer_Factory) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Acceptor<Peer_Handler, ACE_SOCK_ACCEPTOR>; template class ACE_Connector<Peer_Handler, ACE_SOCK_CONNECTOR>; -template class ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Peer_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Peer_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Peer_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<Peer_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<Peer_Handler> *>; template class ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>; -template class ACE_Svc_Tuple<Peer_Handler>; +template class ACE_NonBlocking_Connect_Handler<Peer_Handler>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Acceptor<Peer_Handler, ACE_SOCK_ACCEPTOR> #pragma instantiate ACE_Connector<Peer_Handler, ACE_SOCK_CONNECTOR> -#pragma instantiate ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Peer_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<Peer_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Peer_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Peer_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<Peer_Handler> *> #pragma instantiate ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> -#pragma instantiate ACE_Svc_Tuple<Peer_Handler> +#pragma instantiate ACE_NonBlocking_Connect_Handler<Peer_Handler> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/apps/JAWS/clients/Blobby/Blob.cpp b/apps/JAWS/clients/Blobby/Blob.cpp index 207a9cc5ded..c33bbd6dab7 100644 --- a/apps/JAWS/clients/Blobby/Blob.cpp +++ b/apps/JAWS/clients/Blobby/Blob.cpp @@ -76,18 +76,8 @@ ACE_Blob::close (void) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Connector<ACE_Blob_Handler, ACE_SOCK_CONNECTOR>; -template class ACE_Svc_Tuple <ACE_Blob_Handler>; -template class ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple <ACE_Blob_Handler> *>; -template class ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple <ACE_Blob_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple <ACE_Blob_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple <ACE_Blob_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple <ACE_Blob_Handler> *, ACE_SYNCH_RW_MUTEX>; +template class ACE_NonBlocking_Connect_Handler<ACE_Blob_Handler>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Connector<ACE_Blob_Handler, ACE_SOCK_CONNECTOR> -#pragma instantiate ACE_Svc_Tuple <ACE_Blob_Handler> -#pragma instantiate ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple <ACE_Blob_Handler> *> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple <ACE_Blob_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple <ACE_Blob_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple <ACE_Blob_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple <ACE_Blob_Handler> *, ACE_SYNCH_RW_MUTEX> +#pragma instantiate ACE_NonBlocking_Connect_Handler<ACE_Blob_Handler> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/apps/JAWS/clients/Caching/http_handler.cpp b/apps/JAWS/clients/Caching/http_handler.cpp index 7a1ceafd086..e5bc86b5dc8 100644 --- a/apps/JAWS/clients/Caching/http_handler.cpp +++ b/apps/JAWS/clients/Caching/http_handler.cpp @@ -34,8 +34,8 @@ HTTP_Handler::HTTP_Handler (const char * path) // Make the request. if ((u_int) this->request_size_ < sizeof (this->request_)) ACE_OS::sprintf (this->request_, - "GET %s HTTP/1.0\r\nAccept: HTTP/1.0\r\n\r\n", - path); + "GET %s HTTP/1.0\r\nAccept: HTTP/1.0\r\n\r\n", + path); // Find the filename. const char *last = ACE_OS::strrchr (path, '/'); @@ -88,19 +88,19 @@ HTTP_Handler::svc (void) buf[count] = '\0'; if (count < 2) - continue; + continue; done = ACE_OS::strcmp (buf + count - 4, "\n\n") == 0; if (done) - break; + break; if (count < 4) - continue; + continue; done = ACE_OS::strcmp (buf + count - 4, "\r\n\r\n") == 0; if (done) - break; + break; } if (!done) @@ -120,11 +120,11 @@ HTTP_Handler::svc (void) } else { - contentlength = ACE_OS::strstr (buf, "\nContent-length:"); + contentlength = ACE_OS::strstr (buf, "\nContent-length:"); if (!contentlength) contentlength = - ACE_OS::strstr (buf, "\nContent-Length:"); + ACE_OS::strstr (buf, "\nContent-Length:"); } } @@ -136,13 +136,13 @@ HTTP_Handler::svc (void) &this->response_size_) == 1)) { ACE_Filecache_Handle afh (this->filename_, - this->response_size_); + this->response_size_); this->peer ().recv_n (afh.address (), this->response_size_); ACE_DEBUG ((LM_DEBUG, - " ``%s'' is now cached.\n", - this->filename_)); + " ``%s'' is now cached.\n", + this->filename_)); } else { @@ -156,7 +156,7 @@ HTTP_Handler::svc (void) // Perhaps make ACE_Filecache_Handle more savvy, and allow a // constructor which accepts a PEER as a parameter. ACE_DEBUG ((LM_DEBUG, - "HTTP_Handler, no content-length header!\n")); + "HTTP_Handler, no content-length header!\n")); } return 0; @@ -178,8 +178,8 @@ HTTP_Connector::connect (const char * url) if (this->parseurl (url, host, &port, path) == -1) { ACE_DEBUG ((LM_DEBUG, - "HTTP_Connector, error parsing url: %s\n", - url)); + "HTTP_Connector, error parsing url: %s\n", + url)); return -1; } @@ -190,7 +190,7 @@ HTTP_Connector::connect (const char * url) if (ACE_Filecache::instance ()->find (hh.filename ()) == 0) { ACE_DEBUG ((LM_DEBUG, " ``%s'' is already cached.\n", - hh.filename ())); + hh.filename ())); return 0; } @@ -202,9 +202,9 @@ HTTP_Connector::connect (const char * url) // extract the main components of a URL int HTTP_Connector::parseurl (const char *url, - char *host, - u_short *port, - char *path) + char *host, + u_short *port, + char *path) { int status = 0; @@ -212,20 +212,20 @@ HTTP_Connector::parseurl (const char *url, if (3 != ::sscanf (url, "http://%[^:/]:%hu%s", host, port, path)) { if (2 != ::sscanf (url, "http://%[^:/]:%hu", host, port)) - { - if (2 != ::sscanf (url, "http://%[^:/]%s", host, path)) - { - if (1 != ::sscanf (url, "http://%[^:/]", host)) - status = -1; - else - { - *port = DEFAULT_SERVER_PORT; - ACE_OS::strcpy (path, "/"); - } - } - else - *port = DEFAULT_SERVER_PORT; - } + { + if (2 != ::sscanf (url, "http://%[^:/]%s", host, path)) + { + if (1 != ::sscanf (url, "http://%[^:/]", host)) + status = -1; + else + { + *port = DEFAULT_SERVER_PORT; + ACE_OS::strcpy (path, "/"); + } + } + else + *port = DEFAULT_SERVER_PORT; + } else ACE_OS::strcpy (path, "/"); } @@ -236,20 +236,10 @@ HTTP_Connector::parseurl (const char *url, #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Connector<HTTP_Handler, ACE_SOCK_CONNECTOR>; -template class ACE_Svc_Tuple<HTTP_Handler>; +template class ACE_NonBlocking_Connect_Handler<HTTP_Handler>; template class ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>; -template class ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<HTTP_Handler>*>; -template class ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<HTTP_Handler>*, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<HTTP_Handler>*, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<HTTP_Handler>*, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<HTTP_Handler>*, ACE_SYNCH_RW_MUTEX>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Connector<HTTP_Handler, ACE_SOCK_CONNECTOR> -#pragma instantiate ACE_Svc_Tuple<HTTP_Handler> +#pragma instantiate ACE_NonBlocking_Connect_Handler<HTTP_Handler> #pragma instantiate ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> -#pragma instantiate ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<HTTP_Handler>*> -#pragma instantiate ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<HTTP_Handler>*, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<HTTP_Handler>*, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<HTTP_Handler>*, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<HTTP_Handler>*, ACE_SYNCH_RW_MUTEX> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/apps/JAWS/clients/Caching/http_handler.h b/apps/JAWS/clients/Caching/http_handler.h index 83bab4811d5..3922c1ab857 100644 --- a/apps/JAWS/clients/Caching/http_handler.h +++ b/apps/JAWS/clients/Caching/http_handler.h @@ -22,6 +22,7 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Connector.h" +#include "ace/Svc_Handler.h" class HTTP_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> // = TITLE @@ -78,4 +79,3 @@ private: // Factory that actively establishes a connection with an HTTP // server. }; - diff --git a/bin/msvc_auto_compile.pl b/bin/msvc_auto_compile.pl index 89a9dee0fd6..6caf1759adb 100755 --- a/bin/msvc_auto_compile.pl +++ b/bin/msvc_auto_compile.pl @@ -276,6 +276,16 @@ while ( $#ARGV >= 0 && $ARGV[0] =~ /^(-|\/)/ ) push @directories, ("$ACE_ROOT\\TAO\\orbsvcs\\tests\\Notify\\lib"); push @directories, ("$ACE_ROOT\\TAO"); } + elsif ($ARGV[0] =~ '-tests_TAO') { # Build TAO tests + print "Building TAO tests\n" if ( $verbose ); + $use_custom_dir = 1; + push @directories, ("$ACE_ROOT\\TAO\\tests"); + } + elsif ($ARGV[0] =~ '-examples_TAO') { # Build TAO examples + print "Building TAO examples\n" if ( $verbose ); + $use_custom_dir = 1; + push @directories, ("$ACE_ROOT\\TAO\\examples"); + } elsif ($ARGV[0] =~ '-dir') { # Compile only a specific directory shift; print "Adding directory $ARGV[0]\n" if ( $verbose ); diff --git a/bin/tao_orb_tests.lst b/bin/tao_orb_tests.lst index 54055c1a957..2d599354c63 100644 --- a/bin/tao_orb_tests.lst +++ b/bin/tao_orb_tests.lst @@ -93,6 +93,7 @@ TAO/tests/MT_Timeout/run_test.pl: !MINIMUM !ST TAO/tests/Timed_Buffered_Oneways/run_test.pl: !MINIMUM TAO/tests/Single_Read/run_test.pl: TAO/tests/Connection_Timeout/run_test.pl: !MINIMUM +TAO/tests/Connection_Failure/run_test.pl TAO/tests/MProfile_Connection_Timeout/run_test.pl: !MINIMUM TAO/tests/Codec/run_test.pl TAO/tests/IDL_Test/run_test.pl diff --git a/examples/ASX/Event_Server/Transceiver/transceiver.cpp b/examples/ASX/Event_Server/Transceiver/transceiver.cpp index 2e2aedb7fc9..f19ed7366fc 100644 --- a/examples/ASX/Event_Server/Transceiver/transceiver.cpp +++ b/examples/ASX/Event_Server/Transceiver/transceiver.cpp @@ -131,9 +131,9 @@ Event_Transceiver::Event_Transceiver (int argc, char *argv[]) ACE_ERROR ((LM_ERROR, "%p\n", this->host_name_)); - ACE_Reactor::instance()->remove_handler (sig_set); - ACE_Event_Handler::remove_stdin_handler (ACE_Reactor::instance(), - ACE_Thread_Manager::instance()); + ACE_Reactor::instance()->remove_handler (sig_set); + ACE_Event_Handler::remove_stdin_handler (ACE_Reactor::instance(), + ACE_Thread_Manager::instance()); } } } @@ -235,19 +235,9 @@ main (int argc, char *argv[]) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Connector<Event_Transceiver, ACE_SOCK_CONNECTOR>; template class ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>; -template class ACE_Svc_Tuple<Event_Transceiver>; -template class ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<Event_Transceiver> *>; -template class ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<Event_Transceiver> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Event_Transceiver> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Event_Transceiver> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Event_Transceiver> *, ACE_SYNCH_RW_MUTEX>; +template class ACE_NonBlocking_Connect_Handler<Event_Transceiver>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Connector<Event_Transceiver, ACE_SOCK_CONNECTOR> #pragma instantiate ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> -#pragma instantiate ACE_Svc_Tuple<Event_Transceiver> -#pragma instantiate ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<Event_Transceiver> *> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<Event_Transceiver> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Event_Transceiver> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Event_Transceiver> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Event_Transceiver> *, ACE_SYNCH_RW_MUTEX> +#pragma instantiate ACE_NonBlocking_Connect_Handler<Event_Transceiver> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/examples/Connection/blocking/SPIPE-connector.cpp b/examples/Connection/blocking/SPIPE-connector.cpp index 284417cc1de..83ef0f5350a 100644 --- a/examples/Connection/blocking/SPIPE-connector.cpp +++ b/examples/Connection/blocking/SPIPE-connector.cpp @@ -32,32 +32,32 @@ Peer_Handler::open (void *) if (iterations_ == 0) { this->display_menu (); - if (ACE_Event_Handler::register_stdin_handler + if (ACE_Event_Handler::register_stdin_handler (this, ACE_Reactor::instance (), ACE_Thread_Manager::instance ()) == -1) - ACE_ERROR_RETURN ((LM_ERROR, + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "register_stdin_handler"), -1); else - return 0; + return 0; } else // If iterations_ has been set, send iterations_ buffers. { char *buffer = - "Oh give me a home\n" - "Where the buffalo roam,\n" - "And the deer and the antelope play.\n" - "Where seldom is heard\n" - "A discouraging word,\n" - "And the skies are not cloudy all day.\n"; + "Oh give me a home\n" + "Where the buffalo roam,\n" + "And the deer and the antelope play.\n" + "Where seldom is heard\n" + "A discouraging word,\n" + "And the skies are not cloudy all day.\n"; int length = ACE_OS::strlen (buffer); while (iterations_-- > 0 - && this->peer ().send_n (buffer, + && this->peer ().send_n (buffer, length) == length) - continue; + continue; this->peer ().close (); ACE_Reactor::end_event_loop(); @@ -82,12 +82,12 @@ Peer_Handler::handle_input (ACE_HANDLE) -1); else if (n == 0) // Explicitly close the connection. { - if (this->peer ().close () == -1) - ACE_ERROR_RETURN ((LM_ERROR, + if (this->peer ().close () == -1) + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "close"), 1); - return -1; + return -1; } else this->display_menu (); @@ -96,7 +96,7 @@ Peer_Handler::handle_input (ACE_HANDLE) int Peer_Handler::handle_close (ACE_HANDLE, - ACE_Reactor_Mask) + ACE_Reactor_Mask) { ACE_DEBUG ((LM_DEBUG, "Shutting down\n")); @@ -137,7 +137,7 @@ IPC_Client::init (int argc, char *argv[]) return -1; // Handle signals through the ACE_Reactor. else if (ACE_Reactor::instance ()->register_handler - (SIGINT, + (SIGINT, &this->done_handler_) == -1) return -1; @@ -153,12 +153,12 @@ IPC_Client::init (int argc, char *argv[]) // Connect to the peer, reusing the local addr if necessary. if (this->connect (ph, - ACE_SPIPE_Addr (rendezvous_), - ACE_Synch_Options::defaults, - ACE_sap_any_cast (ACE_SPIPE_Addr &), - 0, - O_RDWR | FILE_FLAG_OVERLAPPED, - 0) == -1) + ACE_SPIPE_Addr (rendezvous_), + ACE_Synch_Options::defaults, + ACE_sap_any_cast (ACE_SPIPE_Addr &), + 0, + O_RDWR | FILE_FLAG_OVERLAPPED, + 0) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "connect"), @@ -197,23 +197,23 @@ IPC_Client::parse_args (int argc, char *argv[]) for (int c; (c = get_opt ()) != -1; ) { switch (c) - { - case 'r': - ACE_OS::strncpy (rendezvous_, - ACE_TEXT_CHAR_TO_TCHAR (get_opt.opt_arg ()), - sizeof rendezvous_ / sizeof ACE_TCHAR); - break; - case 'i': - iterations_ = ACE_OS::atoi (get_opt.opt_arg ()); - break; - case 'u': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %n -i <iterations>\n" - "-r <rendezvous>\n"), + { + case 'r': + ACE_OS::strncpy (rendezvous_, + ACE_TEXT_CHAR_TO_TCHAR (get_opt.opt_arg ()), + sizeof rendezvous_ / sizeof ACE_TCHAR); + break; + case 'i': + iterations_ = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'u': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %n -i <iterations>\n" + "-r <rendezvous>\n"), -1); - break; - } + break; + } } return 0; @@ -225,18 +225,10 @@ IPC_Client::parse_args (int argc, char *argv[]) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Connector<Peer_Handler, ACE_SPIPE_CONNECTOR>; -template class ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<Peer_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Peer_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Peer_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Peer_Handler> *, ACE_SYNCH_RW_MUTEX>; template class ACE_Svc_Handler<ACE_SPIPE_STREAM, ACE_NULL_SYNCH>; -template class ACE_Svc_Tuple<Peer_Handler>; +template class ACE_NonBlocking_Connect_Handler<Peer_Handler>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Connector<Peer_Handler, ACE_SPIPE_CONNECTOR> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<Peer_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Peer_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Peer_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Peer_Handler> *, ACE_SYNCH_RW_MUTEX> #pragma instantiate ACE_Svc_Handler<ACE_SPIPE_STREAM, ACE_NULL_SYNCH> -#pragma instantiate ACE_Svc_Tuple<Peer_Handler> +#pragma instantiate ACE_NonBlocking_Connect_Handler<Peer_Handler> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/examples/Connection/misc/test_upipe.cpp b/examples/Connection/misc/test_upipe.cpp index 29d414f4d06..77fb38d19d6 100644 --- a/examples/Connection/misc/test_upipe.cpp +++ b/examples/Connection/misc/test_upipe.cpp @@ -23,15 +23,10 @@ template class ACE_Acceptor<Server_Service, ACE_UPIPE_ACCEPTOR>; template class ACE_Concurrency_Strategy<Server_Service>; template class ACE_Connector<Client_Service, ACE_UPIPE_CONNECTOR>; template class ACE_Creation_Strategy<Server_Service>; -template class ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<Client_Service> *>; -template class ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<Client_Service> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Client_Service> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Client_Service> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Client_Service> *, ACE_SYNCH_RW_MUTEX>; template class ACE_Scheduling_Strategy<Server_Service>; template class ACE_Strategy_Acceptor<Server_Service, ACE_UPIPE_ACCEPTOR>; template class ACE_Svc_Handler<ACE_UPIPE_STREAM, ACE_NULL_SYNCH>; -template class ACE_Svc_Tuple<Client_Service>; +template class ACE_NonBlocking_Connect_Handler<Client_Service>; template class ACE_Thread_Strategy<Server_Service>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Accept_Strategy<Server_Service, ACE_UPIPE_ACCEPTOR> @@ -39,15 +34,10 @@ template class ACE_Thread_Strategy<Server_Service>; #pragma instantiate ACE_Concurrency_Strategy<Server_Service> #pragma instantiate ACE_Connector<Client_Service, ACE_UPIPE_CONNECTOR> #pragma instantiate ACE_Creation_Strategy<Server_Service> -#pragma instantiate ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<Client_Service> *> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<Client_Service> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Client_Service> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Client_Service> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Client_Service> *, ACE_SYNCH_RW_MUTEX> #pragma instantiate ACE_Scheduling_Strategy<Server_Service> #pragma instantiate ACE_Strategy_Acceptor<Server_Service, ACE_UPIPE_ACCEPTOR> #pragma instantiate ACE_Svc_Handler<ACE_UPIPE_STREAM, ACE_NULL_SYNCH> -#pragma instantiate ACE_Svc_Tuple<Client_Service> +#pragma instantiate ACE_NonBlocking_Connect_Handler<Client_Service> #pragma instantiate ACE_Thread_Strategy<Server_Service> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ @@ -58,7 +48,7 @@ class Server : public ACE_Strategy_Acceptor <Server_Service, ACE_UPIPE_ACCEPTOR> // and creates/activates Server_Service objects. public: Server (ACE_Thread_Manager *thr_mgr, - ACE_Reactor *reactor) + ACE_Reactor *reactor) : reactor_ (reactor), thr_mgr_ (thr_mgr) { @@ -73,10 +63,10 @@ public: ACE_UPIPE_Addr local_addr (l_addr); if (this->thr_strategy_.open (this->thr_mgr_, THR_DETACHED | THR_NEW_LWP) == -1) - return -1; + return -1; else if (this->open (local_addr, this->reactor_, - 0, 0, &this->thr_strategy_) == -1) - return -1; + 0, 0, &this->thr_strategy_) == -1) + return -1; // Give server a chance to register the STREAM pipe. ACE_OS::sleep (ACE_Time_Value (4)); @@ -125,7 +115,7 @@ private: ACE_Thread_Manager *thr_mgr_; }; -int +int main (int argc, char *argv[]) { ACE_Service_Config svc_conf; diff --git a/examples/Connection/non_blocking/CPP-connector.cpp b/examples/Connection/non_blocking/CPP-connector.cpp index af4bc3ab8dd..e784ace2f9b 100644 --- a/examples/Connection/non_blocking/CPP-connector.cpp +++ b/examples/Connection/non_blocking/CPP-connector.cpp @@ -4,7 +4,7 @@ #define CPP_CONNECTOR_C #include "CPP-connector.h" - + ACE_RCSID(non_blocking, CPP_connector, "$Id$") #define PR_ST_1 ACE_PEER_STREAM_1 @@ -30,7 +30,7 @@ Peer_Handler<PR_ST_2>::open (void *) this->action_ = &Peer_Handler<PR_ST_2>::connected; ACE_DEBUG ((LM_DEBUG, - "please enter input..: ")); + "please enter input..: ")); if (this->reactor ()) @@ -49,15 +49,24 @@ Peer_Handler<PR_ST_2>::open (void *) else { while (this->connected () != -1) - continue; + continue; - this->handle_close (ACE_INVALID_HANDLE, - ACE_Event_Handler::READ_MASK); + this->handle_close (ACE_INVALID_HANDLE, + ACE_Event_Handler::READ_MASK); } return 0; } template <PR_ST_1> int +Peer_Handler<PR_ST_2>::close (u_long) +{ + ACE_ERROR ((LM_ERROR, + "Connect not successful: ending reactor event loop\n")); + this->reactor ()->end_reactor_event_loop(); + return 0; +} + +template <PR_ST_1> int Peer_Handler<PR_ST_2>::uninitialized (void) { ACE_DEBUG ((LM_DEBUG, @@ -74,18 +83,18 @@ Peer_Handler<PR_ST_2>::connected (void) buf, sizeof buf); - if (n > 0 + if (n > 0 && this->peer ().send_n (buf, n) != n) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "write failed"), -1); - else if (n == 0) + else if (n == 0) { // Explicitly close the connection. - if (this->peer ().close () == -1) - ACE_ERROR_RETURN ((LM_ERROR, + if (this->peer ().close () == -1) + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "close"), 1); @@ -94,7 +103,7 @@ Peer_Handler<PR_ST_2>::connected (void) else { ACE_DEBUG ((LM_DEBUG, - "please enter input..: ")); + "please enter input..: ")); return 0; } } @@ -106,7 +115,7 @@ Peer_Handler<PR_ST_2>::stdio (void) ACE_DEBUG ((LM_DEBUG, "in stdio\nplease enter input..: ")); - + ssize_t n = ACE_OS::read (ACE_STDIN, buf, sizeof buf); @@ -121,11 +130,20 @@ Peer_Handler<PR_ST_2>::stdio (void) -1); return 0; } - else + else return -1; } template <PR_ST_1> int +Peer_Handler<PR_ST_2>::handle_timeout (const ACE_Time_Value &, + const void *) +{ + ACE_ERROR ((LM_ERROR, + "Connect timedout. ")); + return this->close (); +} + +template <PR_ST_1> int Peer_Handler<PR_ST_2>::handle_output (ACE_HANDLE) { ACE_DEBUG ((LM_DEBUG, @@ -160,7 +178,7 @@ Peer_Handler<PR_ST_2>::handle_input (ACE_HANDLE) template <PR_ST_1> int Peer_Handler<PR_ST_2>::handle_close (ACE_HANDLE h, - ACE_Reactor_Mask mask) + ACE_Reactor_Mask mask) { ACE_DEBUG ((LM_DEBUG, "closing down handle %d with mask %d\n", @@ -229,12 +247,12 @@ IPC_Client<SVH, PR_CO_2>::init (int argc, char *argv[]) // initialization. this->inherited::open (ACE_Reactor::instance ()); - const char *r_addr = argc > 1 ? argv[1] : - ACE_SERVER_ADDRESS (ACE_DEFAULT_SERVER_HOST, - ACE_DEFAULT_SERVER_PORT_STR); - ACE_Time_Value timeout (argc > 2 - ? ACE_OS::atoi (argv[2]) - : ACE_DEFAULT_TIMEOUT); + const char *r_addr = argc > 1 ? argv[1] : + ACE_SERVER_ADDRESS (ACE_DEFAULT_SERVER_HOST, + ACE_DEFAULT_SERVER_PORT_STR); + ACE_Time_Value timeout (argc > 2 + ? ACE_OS::atoi (argv[2]) + : ACE_DEFAULT_TIMEOUT); // Handle signals through the ACE_Reactor. if (ACE_Reactor::instance ()->register_handler @@ -266,32 +284,11 @@ IPC_Client<SVH, PR_CO_2>::init (int argc, char *argv[]) return 0; } -template <class SVH, PR_CO_1> +template <class SVH, PR_CO_1> IPC_Client<SVH, PR_CO_2>::~IPC_Client (void) { } -template <class SVH, PR_CO_1> int -IPC_Client<SVH, PR_CO_2>::handle_close (ACE_HANDLE h, - ACE_Reactor_Mask) -{ - if (h == ACE_INVALID_HANDLE) - ACE_ERROR ((LM_ERROR, - "%p on %d\n", - "connection failed", - h)); - else - { - // We are closing down the connector. - ACE_DEBUG ((LM_DEBUG, - "closing down IPC_Client\n")); - this->inherited::handle_close (); - } - - ACE_Reactor::end_event_loop(); - return 0; -} - #undef PR_ST_1 #undef PR_ST_2 #undef PR_CO_1 diff --git a/examples/Connection/non_blocking/CPP-connector.h b/examples/Connection/non_blocking/CPP-connector.h index a37aa82dad6..98494282b54 100644 --- a/examples/Connection/non_blocking/CPP-connector.h +++ b/examples/Connection/non_blocking/CPP-connector.h @@ -28,6 +28,9 @@ public: virtual int open (void * = 0); // Activate the handler when connection is established. + virtual int close (u_long flags = 0); + // Called on failed connection attempt. + // = Demultiplexing hooks. virtual int handle_output (ACE_HANDLE); virtual int handle_input (ACE_HANDLE); @@ -36,6 +39,8 @@ public: virtual int handle_signal (int signum, siginfo_t * = 0, ucontext_t * = 0); + virtual int handle_timeout (const ACE_Time_Value &time, + const void *); protected: // = These methods implement the State pattern. int uninitialized (void); @@ -69,9 +74,6 @@ public: virtual int svc (void); // Run the svc. - virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask); - // Report connection errors. - private: typedef ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2> inherited; diff --git a/examples/Connection/non_blocking/test_lsock_connector.cpp b/examples/Connection/non_blocking/test_lsock_connector.cpp index e38f7bf86ea..c6e1d8a4f4b 100644 --- a/examples/Connection/non_blocking/test_lsock_connector.cpp +++ b/examples/Connection/non_blocking/test_lsock_connector.cpp @@ -46,25 +46,15 @@ main (int argc, char *argv[]) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Connector<PEER_HANDLER, ACE_LSOCK_CONNECTOR>; template class ACE_Svc_Handler<ACE_LSOCK_STREAM, ACE_SYNCH>; -template class ACE_Svc_Tuple<PEER_HANDLER>; +template class ACE_NonBlocking_Connect_Handler<PEER_HANDLER>; template class IPC_Client<PEER_HANDLER, ACE_LSOCK_CONNECTOR>; template class Peer_Handler<ACE_LSOCK_STREAM>; -template class ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *>; -template class ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Connector<PEER_HANDLER, ACE_LSOCK_CONNECTOR> #pragma instantiate ACE_Svc_Handler<ACE_LSOCK_STREAM, ACE_SYNCH> -#pragma instantiate ACE_Svc_Tuple<PEER_HANDLER> +#pragma instantiate ACE_NonBlocking_Connect_Handler<PEER_HANDLER> #pragma instantiate IPC_Client<PEER_HANDLER, ACE_LSOCK_CONNECTOR> #pragma instantiate Peer_Handler<ACE_LSOCK_STREAM> -#pragma instantiate ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ #endif /* ! ACE_LACKS_UNIX_DOMAIN_SOCKETS */ diff --git a/examples/Connection/non_blocking/test_sock_connector.cpp b/examples/Connection/non_blocking/test_sock_connector.cpp index befa6be50a1..e8a0fd17c1c 100644 --- a/examples/Connection/non_blocking/test_sock_connector.cpp +++ b/examples/Connection/non_blocking/test_sock_connector.cpp @@ -50,23 +50,13 @@ main (int argc, char *argv[]) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Connector<PEER_HANDLER, ACE_SOCK_CONNECTOR>; template class ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_SYNCH>; -template class ACE_Svc_Tuple<PEER_HANDLER>; +template class ACE_NonBlocking_Connect_Handler<PEER_HANDLER>; template class IPC_Client<PEER_HANDLER, ACE_SOCK_CONNECTOR>; template class Peer_Handler<ACE_SOCK_STREAM>; -template class ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *>; -template class ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Connector<PEER_HANDLER, ACE_SOCK_CONNECTOR> #pragma instantiate ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_SYNCH> -#pragma instantiate ACE_Svc_Tuple<PEER_HANDLER> +#pragma instantiate ACE_NonBlocking_Connect_Handler<PEER_HANDLER> #pragma instantiate IPC_Client<PEER_HANDLER, ACE_SOCK_CONNECTOR> #pragma instantiate Peer_Handler<ACE_SOCK_STREAM> -#pragma instantiate ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/examples/Connection/non_blocking/test_spipe_connector.cpp b/examples/Connection/non_blocking/test_spipe_connector.cpp index 84a96705b0d..3dd395952d7 100644 --- a/examples/Connection/non_blocking/test_spipe_connector.cpp +++ b/examples/Connection/non_blocking/test_spipe_connector.cpp @@ -32,23 +32,13 @@ main (int argc, char *argv[]) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Connector<PEER_HANDLER, ACE_SPIPE_CONNECTOR>; template class ACE_Svc_Handler<ACE_SPIPE_STREAM, ACE_SYNCH>; -template class ACE_Svc_Tuple<PEER_HANDLER>; -template class ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *>; -template class ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX>; +template class ACE_NonBlocking_Connect_Handler<PEER_HANDLER>; template class IPC_Client<PEER_HANDLER, ACE_SPIPE_CONNECTOR>; template class Peer_Handler<ACE_SPIPE_STREAM>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Connector<PEER_HANDLER, ACE_SPIPE_CONNECTOR> #pragma instantiate ACE_Svc_Handler<ACE_SPIPE_STREAM, ACE_SYNCH> -#pragma instantiate ACE_Svc_Tuple<PEER_HANDLER> -#pragma instantiate ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX> +#pragma instantiate ACE_NonBlocking_Connect_Handler<PEER_HANDLER> #pragma instantiate IPC_Client<PEER_HANDLER, ACE_SPIPE_CONNECTOR> #pragma instantiate Peer_Handler<ACE_SPIPE_STREAM> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/examples/Connection/non_blocking/test_tli_connector.cpp b/examples/Connection/non_blocking/test_tli_connector.cpp index 25e729d1801..819f8318dd9 100644 --- a/examples/Connection/non_blocking/test_tli_connector.cpp +++ b/examples/Connection/non_blocking/test_tli_connector.cpp @@ -32,23 +32,13 @@ main (int argc, char *argv[]) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Connector<PEER_HANDLER, ACE_TLI_CONNECTOR>; template class ACE_Svc_Handler<ACE_TLI_STREAM, ACE_SYNCH>; -template class ACE_Svc_Tuple<PEER_HANDLER>; -template class ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *>; -template class ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX>; +template class ACE_NonBlocking_Connect_Handler<PEER_HANDLER>; template class IPC_Client<PEER_HANDLER, ACE_TLI_CONNECTOR>; template class Peer_Handler<ACE_TLI_STREAM>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Connector<PEER_HANDLER, ACE_TLI_CONNECTOR> #pragma instantiate ACE_Svc_Handler<ACE_TLI_STREAM, ACE_SYNCH> -#pragma instantiate ACE_Svc_Tuple<PEER_HANDLER> -#pragma instantiate ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<PEER_HANDLER> *, ACE_SYNCH_RW_MUTEX> +#pragma instantiate ACE_NonBlocking_Connect_Handler<PEER_HANDLER> #pragma instantiate IPC_Client<PEER_HANDLER, ACE_TLI_CONNECTOR> #pragma instantiate Peer_Handler<ACE_TLI_STREAM> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/examples/Logger/Acceptor-server/server_loggerd.cpp b/examples/Logger/Acceptor-server/server_loggerd.cpp index 247aa5d1197..90c76b0c718 100644 --- a/examples/Logger/Acceptor-server/server_loggerd.cpp +++ b/examples/Logger/Acceptor-server/server_loggerd.cpp @@ -13,6 +13,7 @@ #include "ace/Singleton.h" #include "ace/streams.h" #include "ace/Log_Record.h" +#include "ace/Test_and_Set.h" #include "server_loggerd.h" diff --git a/examples/Web_Crawler/URL_Visitor.cpp b/examples/Web_Crawler/URL_Visitor.cpp index ad4ac701f4c..db7604aa5cb 100644 --- a/examples/Web_Crawler/URL_Visitor.cpp +++ b/examples/Web_Crawler/URL_Visitor.cpp @@ -69,7 +69,7 @@ HTTP_Header_Processing_Strategy::execute (void) int status_index = line.find ("HTTP", 0); ACE_CString status = line.substring (status_index + 9, //HTTP/1.1 200 3); - + URL_Status *url_status = 0; ACE_NEW_RETURN (url_status, URL_Status, @@ -92,7 +92,7 @@ HTTP_Header_Processing_Strategy::execute (void) } } return 0; - + } HTML_Body_Validation_Strategy::HTML_Body_Validation_Strategy (URL &url, @@ -109,7 +109,7 @@ HTML_Body_Validation_Strategy::execute (void) char host_name_buf[BUFSIZ + 1]; ACE_CString host_name (host_name_buf); host_name.set (url_.url_addr ().get_host_name (),1); - + // All to facilitate relative paths char temp[BUFSIZ + 1]; ACE_CString prev_location (temp); @@ -117,19 +117,19 @@ HTML_Body_Validation_Strategy::execute (void) prev_location.set (this->url_.url_addr ().get_path_name (), ACE_OS::strlen (this->url_.url_addr ().get_path_name ()), 1); - int index = prev_location.rfind ('/', prev_location.length ()); + int index = prev_location.rfind ('/', prev_location.length ()); ACE_CString str = prev_location.substring (0, index + 1); prev_location.set (str.c_str (), 1); - + // Note: prev_location always ends with '/' if (prev_location[0] != '/') - prev_location = "/" + prev_location; + prev_location = "/" + prev_location; // Build the url portion which can be attached to teh relative paths. prev_location = host_name + prev_location; - + char url_string[BUFSIZ + 1]; - ACE_CString url (url_string); + ACE_CString url (url_string); while (this->iterator_.next (url) > 0) { @@ -144,15 +144,15 @@ HTML_Body_Validation_Strategy::execute (void) } if (url[0] == '.' && url[1] == '/') url.set (&url[2], 1); - + url = prev_location + url; } - else + else url.set (&url[7], 1); // Double slash at the end works!e.g www.cs.wustl.edu/~kirthika// - if (url.find (".html") < 0) - url = url + "/"; - + if (url.find (".html") < 0) + url = url + "/"; + // Create the new URL address. ACE_URL_Addr *url_addr; ACE_NEW_RETURN (url_addr, @@ -171,7 +171,7 @@ HTML_Body_Validation_Strategy::execute (void) ACE_NEW_RETURN (url_command, URL_Command (http_url), 0); - + OPTIONS::instance ()->command_processor ()->insert (url_command); } } @@ -203,7 +203,7 @@ URL_Validation_Visitation_Strategy_Factory::make_header_strategy (URL_Iterator & { URL_Processing_Strategy *ps; ACE_NEW_RETURN (ps, - HTTP_Header_Processing_Strategy (*this->url_, + HTTP_Header_Processing_Strategy (*this->url_, iterator), 0); return ps; @@ -256,15 +256,10 @@ template class ACE_Creation_Strategy<Client_Svc_Handler>; template class ACE_Hash_Map_Entry<ACE_ADDR, Client_Svc_Handler *>; template class ACE_Hash<ACE_ADDR>; template class ACE_Equal_To<ACE_ADDR>; -template class ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<Client_Svc_Handler> *>; -template class ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Client_Svc_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<Client_Svc_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Client_Svc_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Client_Svc_Handler> *, ACE_SYNCH_RW_MUTEX>; template class ACE_NOOP_Concurrency_Strategy<Client_Svc_Handler>; template class ACE_Recycling_Strategy<Client_Svc_Handler>; template class ACE_Strategy_Connector<Client_Svc_Handler, ACE_SOCK_CONNECTOR>; -template class ACE_Svc_Tuple<Client_Svc_Handler>; +template class ACE_NonBlocking_Connect_Handler<Client_Svc_Handler>; template class ACE_Pair<Client_Svc_Handler *, ATTRIBUTES>; @@ -349,15 +344,10 @@ template class ACE_Guard<ACE_Reverse_Lock<ACE_SYNCH_NULL_MUTEX> >; #pragma instantiate ACE_Hash_Map_Entry<ACE_ADDR, Client_Svc_Handler *> #pragma instantiate ACE_Hash<ACE_ADDR> #pragma instantiate ACE_Equal_To<ACE_ADDR> -#pragma instantiate ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<Client_Svc_Handler> *> -#pragma instantiate ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Client_Svc_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<Client_Svc_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Client_Svc_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Client_Svc_Handler> *, ACE_SYNCH_RW_MUTEX> #pragma instantiate ACE_NOOP_Concurrency_Strategy<Client_Svc_Handler> #pragma instantiate ACE_Recycling_Strategy<Client_Svc_Handler> #pragma instantiate ACE_Strategy_Connector<Client_Svc_Handler, ACE_SOCK_CONNECTOR> -#pragma instantiate ACE_Svc_Tuple<Client_Svc_Handler> +#pragma instantiate ACE_NonBlocking_Connect_Handler<Client_Svc_Handler> #pragma instantiate ACE_Pair<Client_Svc_Handler *, ATTRIBUTES> #pragma instantiate ACE_Reference_Pair<ACE_ADDR, Client_Svc_Handler *> @@ -423,7 +413,7 @@ template class ACE_Guard<ACE_Reverse_Lock<ACE_SYNCH_NULL_MUTEX> >; URL_Validation_Visitor::URL_Validation_Visitor (void) { - ACE_NEW (this->caching_connect_strategy_, + ACE_NEW (this->caching_connect_strategy_, CACHED_CONNECT_STRATEGY (this->caching_strategy_)); ACE_NEW (this->strat_connector_, STRATEGY_CONNECTOR(0, @@ -435,14 +425,14 @@ URL_Validation_Visitor::URL_Validation_Visitor (void) "%p %s\n" "strategy connector creation failed")); - + } URL_Validation_Visitor::~URL_Validation_Visitor (void) { this->strat_connector_ = 0; if (this->caching_connect_strategy_ != 0) - delete this->caching_connect_strategy_; + delete this->caching_connect_strategy_; } URL_Validation_Visitor::URL_CACHE & @@ -462,7 +452,7 @@ URL_Validation_Visitor::in_cache (const ACE_URL_Addr &url_addr) "status %d for URL %s (cached)\n", reply_status.status (), url_addr.addr_to_string (0))); - + // Invalid status. if (reply_status.status () != 200) return -1; @@ -475,11 +465,11 @@ URL_Validation_Visitor::in_cache (const ACE_URL_Addr &url_addr) URL_Visitation_Strategy_Factory * URL_Validation_Visitor::make_visitation_strategy_factory (URL &url) -{ +{ // Since this is HTTP 1.1 we'll need to establish a connection // only once. Trying for relative paths. - if (url.stream ().open (this->strat_connector_, + if (url.stream ().open (this->strat_connector_, url.url_addr ()) == -1) return 0; @@ -529,13 +519,13 @@ URL_Validation_Visitor::visit (HTTP_URL &http_url) if (result == 0) { Auto_Destroyer <URL_Visitation_Strategy_Factory> vs (this->make_visitation_strategy_factory (http_url)); - + if (*vs == 0) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "make_visitation_strategy_factory"), -1); - + Auto_Destroyer <URL_Iterator> ihs (vs->make_header_iterator ()); if (*ihs == 0) ACE_ERROR_RETURN ((LM_ERROR, @@ -552,12 +542,12 @@ URL_Validation_Visitor::visit (HTTP_URL &http_url) if (phs_result == -1) ACE_DEBUG ((LM_DEBUG, "Invalid ")); - + ACE_DEBUG ((LM_DEBUG, "URL with status %d %s\n", http_url.reply_status ().status (), http_url.url_addr().addr_to_string (0))); - + // Store the http url in the cache. if (this->url_cache ().bind (http_url.url_addr (), http_url.reply_status ()) != 0) @@ -568,25 +558,25 @@ URL_Validation_Visitor::visit (HTTP_URL &http_url) // Since it is invalid dont go further. if (phs_result == -1) return 0; - + // Get back if the recurse option isnt set. if (OPTIONS::instance ()->recurse () != 1) return 0; - + Auto_Destroyer <URL_Iterator> is (vs->make_body_iterator ()); if (*is == 0) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "make_body_iterator"), -1); - + Auto_Destroyer <URL_Processing_Strategy> ps (vs->make_body_strategy (**is)); if (*ps == 0) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "make_body_strategy"), -1); - + if (ps->execute () == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", @@ -678,7 +668,7 @@ URL_Download_Visitor::make_visitation_strategy_factory (URL &url) URL_Download_Visitation_Strategy_Factory (&url), 0); return vs; - + } int @@ -721,5 +711,3 @@ URL_Download_Visitor::visit (HTTP_URL &http_url) -1); return 0; } - - diff --git a/netsvcs/lib/TS_Clerk_Handler.cpp b/netsvcs/lib/TS_Clerk_Handler.cpp index 094676c99e2..f3b4ac020c6 100644 --- a/netsvcs/lib/TS_Clerk_Handler.cpp +++ b/netsvcs/lib/TS_Clerk_Handler.cpp @@ -8,7 +8,7 @@ ACE_RCSID(lib, TS_Clerk_Handler, "$Id$") ACE_TS_Clerk_Handler::ACE_TS_Clerk_Handler (ACE_TS_Clerk_Processor *processor, - ACE_INET_Addr &addr) + ACE_INET_Addr &addr) : state_ (ACE_TS_Clerk_Handler::IDLE), timeout_ (ACE_DEFAULT_TIMEOUT), max_timeout_ (ACE_TS_Clerk_Handler::MAX_RETRY_TIMEOUT), @@ -101,14 +101,14 @@ ACE_TS_Clerk_Handler::open (void *) #if !defined (ACE_WIN32) if (ACE_Reactor::instance ()->register_handler (SIGPIPE, this) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%n: %p\n", - "register_handler (SIGPIPE)"), -1); + "register_handler (SIGPIPE)"), -1); #endif /* ACE_WIN32 */ // Register ourselves with the reactor to receive input if (ACE_Reactor::instance ()->register_handler (this->get_handle (), - this, - ACE_Event_Handler::READ_MASK | - ACE_Event_Handler::EXCEPT_MASK) == -1) + this, + ACE_Event_Handler::READ_MASK | + ACE_Event_Handler::EXCEPT_MASK) == -1) ACE_ERROR ((LM_ERROR, "%n: %p\n", "register_handler (this)")); // Figure out what remote port we're really bound to. @@ -116,9 +116,9 @@ ACE_TS_Clerk_Handler::open (void *) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "get_remote_addr"), -1); ACE_DEBUG ((LM_DEBUG, - "TS Clerk Daemon connected to port %d on handle %d\n", - server_addr.get_port_number (), - this->peer ().get_handle ())); + "TS Clerk Daemon connected to port %d on handle %d\n", + server_addr.get_port_number (), + this->peer ().get_handle ())); return 0; } @@ -132,7 +132,7 @@ ACE_TS_Clerk_Handler::get_handle (void) const int ACE_TS_Clerk_Handler::handle_close (ACE_HANDLE, - ACE_Reactor_Mask mask) + ACE_Reactor_Mask mask) { ACE_TRACE ("ACE_TS_Clerk_Handler::handle_close"); ACE_UNUSED_ARG (mask); @@ -157,8 +157,8 @@ ACE_TS_Clerk_Handler::reinitiate_connection (void) // Reschedule ourselves to try and connect again. if (ACE_Reactor::instance ()->schedule_timer (this, 0, - this->timeout ()) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "schedule_timer"), -1); + this->timeout ()) == -1) + ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "schedule_timer"), -1); } return 0; } @@ -195,12 +195,12 @@ ACE_TS_Clerk_Handler::handle_input (ACE_HANDLE) // Restart connection asynchronously when timeout occurs. int ACE_TS_Clerk_Handler::handle_timeout (const ACE_Time_Value &, - const void *) + const void *) { ACE_TRACE ("ACE_TS_Clerk_Handler::handle_timeout"); ACE_DEBUG ((LM_DEBUG, - "(%t) attempting to reconnect to server with timeout = %d\n", - this->timeout_)); + "(%t) attempting to reconnect to server with timeout = %d\n", + this->timeout_)); // Close down peer to reclaim descriptor if need be. Note this is // necessary to reconnect. @@ -236,19 +236,19 @@ ACE_TS_Clerk_Handler::recv_reply (ACE_Time_Request &reply) if (n != bytes_expected) { switch (n) - { - case -1: - // FALLTHROUGH - ACE_DEBUG ((LM_DEBUG, "****************** recv_reply returned -1\n")); - default: - ACE_ERROR ((LM_ERROR, "%p got %d bytes, expected %d bytes\n", - "recv failed", n, bytes_expected)); - // FALLTHROUGH - case 0: - // We've shutdown unexpectedly - return -1; - // NOTREACHED - } + { + case -1: + // FALLTHROUGH + ACE_DEBUG ((LM_DEBUG, "****************** recv_reply returned -1\n")); + default: + ACE_ERROR ((LM_ERROR, "%p got %d bytes, expected %d bytes\n", + "recv failed", n, bytes_expected)); + // FALLTHROUGH + case 0: + // We've shutdown unexpectedly + return -1; + // NOTREACHED + } } else if (reply.decode () == -1) // Decode the request into host byte order. ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "decode failed"), -1); @@ -297,10 +297,10 @@ ACE_TS_Clerk_Processor::ACE_TS_Clerk_Processor () ACE_OS::strcpy (this->poolname_, ACE_DEFAULT_BACKING_STORE); #else /* ACE_DEFAULT_BACKING_STORE */ - if (ACE::get_temp_dir (this->poolname_, + if (ACE::get_temp_dir (this->poolname_, MAXPATHLEN - 17) == -1) // -17 for ace-malloc-XXXXXX { - ACE_ERROR ((LM_ERROR, + ACE_ERROR ((LM_ERROR, "Temporary path too long, " "defaulting to current directory\n")); this->poolname_[0] = 0; @@ -341,7 +341,7 @@ ACE_TS_Clerk_Processor::alloc (void) // Query the servers for the latest time int ACE_TS_Clerk_Processor::handle_timeout (const ACE_Time_Value &, - const void *) + const void *) { ACE_TRACE ("ACE_TS_Clerk_Processor::handle_timeout"); return this->update_time (); @@ -368,20 +368,20 @@ ACE_TS_Clerk_Processor::update_time () set_iterator.advance ()) { if ((*handler)->state () == ACE_TS_Clerk_Handler::ESTABLISHED) - { - if ((*handler)->send_request (this->cur_sequence_num_, time_info) == -1) - return -1; - // Check if sequence numbers match; otherwise discard - else if (expected_sequence_num != 0 && - time_info.sequence_num_ == expected_sequence_num) - { - count++; - ACE_DEBUG ((LM_DEBUG, "[%d] Delta time: %d\n", count, time_info.delta_time_)); - - // #### Can check here if delta value falls within a threshold #### - total_delta += time_info.delta_time_; - } - } + { + if ((*handler)->send_request (this->cur_sequence_num_, time_info) == -1) + return -1; + // Check if sequence numbers match; otherwise discard + else if (expected_sequence_num != 0 && + time_info.sequence_num_ == expected_sequence_num) + { + count++; + ACE_DEBUG ((LM_DEBUG, "[%d] Delta time: %d\n", count, time_info.delta_time_)); + + // #### Can check here if delta value falls within a threshold #### + total_delta += time_info.delta_time_; + } + } } // Update system_time_ using average of times obtained from all the servers. // Note that we are keeping two things in shared memory: the delta @@ -424,8 +424,8 @@ ACE_TS_Clerk_Processor::fini (void) set_iterator.advance ()) { if ((*handler)->state () != ACE_TS_Clerk_Handler::IDLE) - // Mark state as DISCONNECTING so we don't try to reconnect... - (*handler)->state (ACE_TS_Clerk_Handler::DISCONNECTING); + // Mark state as DISCONNECTING so we don't try to reconnect... + (*handler)->state (ACE_TS_Clerk_Handler::DISCONNECTING); // Deallocate resources. (*handler)->destroy (); // Will trigger a delete @@ -477,15 +477,15 @@ ACE_TS_Clerk_Processor::init (int argc, char *argv[]) // Now set up timer to receive updates from server // set the timer to go off after timeout value this->timer_id_ = ACE_Reactor::instance ()->schedule_timer (this, - NULL, - ACE_Time_Value (this->timeout_), - ACE_Time_Value (this->timeout_)); + NULL, + ACE_Time_Value (this->timeout_), + ACE_Time_Value (this->timeout_)); return 0; } int ACE_TS_Clerk_Processor::initiate_connection (ACE_TS_Clerk_Handler *handler, - ACE_Synch_Options &synch_options) + ACE_Synch_Options &synch_options) { ACE_TRACE ("ACE_TS_Clerk_Processor::initiate_connection"); char buf[MAXHOSTNAMELEN + 1]; @@ -496,45 +496,45 @@ ACE_TS_Clerk_Processor::initiate_connection (ACE_TS_Clerk_Handler *handler, if (handler->remote_addr ().addr_to_string (buf, sizeof buf) == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", - "can't obtain peer's address"), -1); + "can't obtain peer's address"), -1); // Establish connection with the server. if (this->connect (handler, - handler->remote_addr (), - synch_options) == -1) + handler->remote_addr (), + synch_options) == -1) { if (errno != EWOULDBLOCK) - { - handler->state (ACE_TS_Clerk_Handler::FAILED); - ACE_DEBUG ((LM_DEBUG, "(%t) %p on address %s\n", "connect", buf)); - - // Reschedule ourselves to try and connect again. - if (synch_options[ACE_Synch_Options::USE_REACTOR]) - { - if (ACE_Reactor::instance ()->schedule_timer (handler, - 0, - handler->timeout ()) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "schedule_timer"), -1); - } - else - // Failures on synchronous connects are reported as errors - // so that the caller can decide how to proceed. - return -1; - } + { + handler->state (ACE_TS_Clerk_Handler::FAILED); + ACE_DEBUG ((LM_DEBUG, "(%t) %p on address %s\n", "connect", buf)); + + // Reschedule ourselves to try and connect again. + if (synch_options[ACE_Synch_Options::USE_REACTOR]) + { + if (ACE_Reactor::instance ()->schedule_timer (handler, + 0, + handler->timeout ()) == -1) + ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "schedule_timer"), -1); + } + else + // Failures on synchronous connects are reported as errors + // so that the caller can decide how to proceed. + return -1; + } else - { - handler->state (ACE_TS_Clerk_Handler::CONNECTING); - ACE_DEBUG ((LM_DEBUG, - "(%t) in the process of connecting %s to %s\n", - synch_options[ACE_Synch_Options::USE_REACTOR] - ? "asynchronously" : "synchronously", buf)); - } + { + handler->state (ACE_TS_Clerk_Handler::CONNECTING); + ACE_DEBUG ((LM_DEBUG, + "(%t) in the process of connecting %s to %s\n", + synch_options[ACE_Synch_Options::USE_REACTOR] + ? "asynchronously" : "synchronously", buf)); + } } else { handler->state (ACE_TS_Clerk_Handler::ESTABLISHED); ACE_DEBUG ((LM_DEBUG, "(%t) connected to %s on %d\n", - buf, handler->get_handle ())); + buf, handler->get_handle ())); } return 0; } @@ -549,46 +549,46 @@ ACE_TS_Clerk_Processor::parse_args (int argc, char *argv[]) // Create a default entry ACE_OS::sprintf (server_host, "%s:%d", - ACE_DEFAULT_SERVER_HOST, - ACE_DEFAULT_LOGGING_SERVER_PORT); + ACE_DEFAULT_SERVER_HOST, + ACE_DEFAULT_LOGGING_SERVER_PORT); ACE_Get_Opt get_opt (argc, argv, "h:t:p:b", 0); for (int c; (c = get_opt ()) != -1; ) { switch (c) - { - case 'h': - // Get the hostname:port and create an ADDR - server_addr.set (get_opt.opt_arg ()); - - // Create a new handler - ACE_NEW_RETURN (handler, - ACE_TS_Clerk_Handler (this, server_addr), - -1); - - // Cache the handler - this->handler_set_.insert (handler); - break; - case 't': - // Get the timeout value - this->timeout_ = ACE_OS::atoi (get_opt.opt_arg ()); - break; - case 'p': - // Get the poolname - ACE_OS::strncpy (this->poolname_, - ACE_TEXT_CHAR_TO_TCHAR (get_opt.opt_arg ()), - sizeof this->poolname_ / sizeof (ACE_TCHAR)); - break; - case 'b': - // Blocking semantics - this->blocking_semantics_ = 1; - break; - default: - ACE_ERROR_RETURN ((LM_ERROR, - "%n:\n[-h hostname:port] [-t timeout] [-p poolname]\n%a", 1), - -1); - } + { + case 'h': + // Get the hostname:port and create an ADDR + server_addr.set (get_opt.opt_arg ()); + + // Create a new handler + ACE_NEW_RETURN (handler, + ACE_TS_Clerk_Handler (this, server_addr), + -1); + + // Cache the handler + this->handler_set_.insert (handler); + break; + case 't': + // Get the timeout value + this->timeout_ = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'p': + // Get the poolname + ACE_OS::strncpy (this->poolname_, + ACE_TEXT_CHAR_TO_TCHAR (get_opt.opt_arg ()), + sizeof this->poolname_ / sizeof (ACE_TCHAR)); + break; + case 'b': + // Blocking semantics + this->blocking_semantics_ = 1; + break; + default: + ACE_ERROR_RETURN ((LM_ERROR, + "%n:\n[-h hostname:port] [-t timeout] [-p poolname]\n%a", 1), + -1); + } } return 0; } @@ -615,23 +615,13 @@ ACE_SVC_FACTORY_DEFINE (ACE_TS_Clerk_Processor) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Connector<ACE_TS_Clerk_Handler, ACE_SOCK_CONNECTOR>; template class ACE_Node<ACE_TS_Clerk_Handler *>; -template class ACE_Svc_Tuple<ACE_TS_Clerk_Handler>; +template class ACE_NonBlocking_Connect_Handler<ACE_TS_Clerk_Handler>; template class ACE_Unbounded_Set<ACE_TS_Clerk_Handler *>; template class ACE_Unbounded_Set_Iterator<ACE_TS_Clerk_Handler *>; -template class ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<ACE_TS_Clerk_Handler> *>; -template class ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<ACE_TS_Clerk_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<ACE_TS_Clerk_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<ACE_TS_Clerk_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<ACE_TS_Clerk_Handler> *, ACE_SYNCH_RW_MUTEX>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Connector<ACE_TS_Clerk_Handler, ACE_SOCK_CONNECTOR> #pragma instantiate ACE_Node<ACE_TS_Clerk_Handler *> -#pragma instantiate ACE_Svc_Tuple<ACE_TS_Clerk_Handler> +#pragma instantiate ACE_NonBlocking_Connect_Handler<ACE_TS_Clerk_Handler> #pragma instantiate ACE_Unbounded_Set<ACE_TS_Clerk_Handler *> #pragma instantiate ACE_Unbounded_Set_Iterator<ACE_TS_Clerk_Handler *> -#pragma instantiate ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<ACE_TS_Clerk_Handler> *> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<ACE_TS_Clerk_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<ACE_TS_Clerk_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<ACE_TS_Clerk_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<ACE_TS_Clerk_Handler> *, ACE_SYNCH_RW_MUTEX> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/tests/CLASSIX/CLASSIX_Con_Acc_Test.cpp b/tests/CLASSIX/CLASSIX_Con_Acc_Test.cpp index c0badafd1c0..c0340b33fb8 100644 --- a/tests/CLASSIX/CLASSIX_Con_Acc_Test.cpp +++ b/tests/CLASSIX/CLASSIX_Con_Acc_Test.cpp @@ -14,9 +14,9 @@ // However, this test is not to test the priority aspect of the // CLASSIX Reactor. In fact <ACE_CLASSIX_Select_Reactor> does not // handle priorities. -// +// // This is a test for <ACE_CLASSIX_CO_Connector> and -// <ACE_CLASSIX_CO_Acceptor> +// <ACE_CLASSIX_CO_Acceptor> // ============================================================================ #include "ace/Get_Opt.h" @@ -114,22 +114,22 @@ Read_Handler::handle_input (ACE_HANDLE h) char buf[BUFSIZ]; // ACE_DEBUG((LM_DEBUG, -// "(%P|%t|%x) read from handle %d...", this, h)); +// "(%P|%t|%x) read from handle %d...", this, h)); ssize_t result = this->peer ().recv (buf, sizeof (buf)); // // Work around the blocking problem with ipcSend() in ClassixOS 3.1 // This counter ensures that the reader reads before the writer sends too // many messages. - // + // max_msg--; if (result <= 0) { if (result < 0 && errno == EWOULDBLOCK) { - max_msg++; - return 0; + max_msg++; + return 0; } if (result != 0) @@ -150,8 +150,8 @@ Read_Handler::handle_input (ACE_HANDLE h) } // ACE_DEBUG((LM_DEBUG, -// "...(%P|%t) read %d bytes from handle %d, priority %d\n", -// result, h, priority ())); +// "...(%P|%t) read %d bytes from handle %d, priority %d\n", +// result, h, priority ())); return 0; } @@ -170,23 +170,23 @@ Write_Handler::svc (void) ACE_Time_Value pause (0, 1000); for (int i = 0; i < opt_nloops; ++i) { - // Work around the blocking problem with ipcSend() in ClassixOS 3.1 - // ipcSend() will block instead of returning K_EFULL value, - // if resources are not available. - // - // sleep for the reader to empty some messages - while (max_msg.value() >= opt_max_msgs) - ACE_OS::sleep(pause); - - - if (this->peer ().send_n (ACE_ALPHABET, - sizeof (ACE_ALPHABET) - 1) == -1) - { - ACE_DEBUG((LM_DEBUG, "%t %p\n", "send_n\n")); - ACE_OS::sleep (pause); - continue; - } - max_msg++; + // Work around the blocking problem with ipcSend() in ClassixOS 3.1 + // ipcSend() will block instead of returning K_EFULL value, + // if resources are not available. + // + // sleep for the reader to empty some messages + while (max_msg.value() >= opt_max_msgs) + ACE_OS::sleep(pause); + + + if (this->peer ().send_n (ACE_ALPHABET, + sizeof (ACE_ALPHABET) - 1) == -1) + { + ACE_DEBUG((LM_DEBUG, "%t %p\n", "send_n\n")); + ACE_OS::sleep (pause); + continue; + } + max_msg++; } this->peer().close_writer(); ACE_DEBUG ((LM_DEBUG, "(%P|%t) Write Handler exiting svc\n")); @@ -226,13 +226,13 @@ client (void *arg) } else { - // Let the new Svc_Handler to its job... - writer->svc (); + // Let the new Svc_Handler to its job... + writer->svc (); - // then close the connection and release the Svc_Handler. - writer->destroy (); - - return 0; + // then close the connection and release the Svc_Handler. + writer->destroy (); + + return 0; } } @@ -249,7 +249,7 @@ main (int argc, char *argv[]) // initialize environment, eg. reactor, etc. ACE_CLASSIX_OS os; - + ACE_Get_Opt getopt (argc, argv, "dc:l:m:t:i:", 1); for (int c; (c = getopt ()) != -1; ) @@ -290,7 +290,7 @@ main (int argc, char *argv[]) // Acceptor ACE_DEBUG((LM_DEBUG, "Create an Acceptor\n")); ACCEPTOR acceptor(ACE_Reactor::instance(), 0); - // The acceptor uses the global reactor and does not use select. + // The acceptor uses the global reactor and does not use select. acceptor.priority (ACE_Event_Handler::HI_PRIORITY); ADDR server_addr; @@ -347,12 +347,7 @@ template class auto_ptr<ACE_Reactor>; template class ACE_Auto_Basic_Ptr<ACE_Reactor>; template class auto_ptr<ACE_Select_Reactor>; template class ACE_Auto_Basic_Ptr<ACE_Select_Reactor>; -template class ACE_Map_Manager<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*,ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator_Base<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*,ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*,ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*,ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Entry<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*>; -template class ACE_Svc_Tuple<Write_Handler>; +template class ACE_NonBlocking_Connect_Handler<Write_Handler>; template class ACE_Atomic_Op<ACE_Thread_Mutex, int>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) @@ -363,11 +358,6 @@ template class ACE_Atomic_Op<ACE_Thread_Mutex, int>; #pragma instantiate ACE_Auto_Basic_Ptr<ACE_Reactor> #pragma instantiate auto_ptr<ACE_Select_Reactor> #pragma instantiate ACE_Auto_Basic_Ptr<ACE_Select_Reactor> -#pragma instantiate ACE_Map_Manager<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*,ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*,ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*,ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*,ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Entry<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*> -#pragma instantiate ACE_Svc_Tuple<Write_Handler> +#pragma instantiate ACE_NonBlocking_Connect_Handler<Write_Handler> #pragma instantiate ACE_Atomic_Op<ACE_Thread_Mutex, int> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/tests/Cached_Accept_Conn_Test.cpp b/tests/Cached_Accept_Conn_Test.cpp index 1cda15ecedb..18b9d5b2237 100644 --- a/tests/Cached_Accept_Conn_Test.cpp +++ b/tests/Cached_Accept_Conn_Test.cpp @@ -171,15 +171,10 @@ template class ACE_Creation_Strategy<Client_Svc_Handler>; template class ACE_Hash_Map_Entry<ACE_ADDR, Client_Svc_Handler *>; template class ACE_Hash<ACE_ADDR>; template class ACE_Equal_To<ACE_ADDR>; -template class ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<Client_Svc_Handler> *>; -template class ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Client_Svc_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<Client_Svc_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Client_Svc_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Client_Svc_Handler> *, ACE_SYNCH_RW_MUTEX>; template class ACE_NOOP_Concurrency_Strategy<Client_Svc_Handler>; template class ACE_Recycling_Strategy<Client_Svc_Handler>; template class ACE_Strategy_Connector<Client_Svc_Handler, ACE_SOCK_CONNECTOR>; -template class ACE_Svc_Tuple<Client_Svc_Handler>; +template class ACE_NonBlocking_Connect_Handler<Client_Svc_Handler>; template class ACE_Strategy_Acceptor<Server_Svc_Handler, ACE_SOCK_ACCEPTOR>; template class Accept_Strategy<Server_Svc_Handler, ACE_SOCK_ACCEPTOR>; @@ -265,15 +260,10 @@ template class ACE_Guard<ACE_Reverse_Lock<ACE_SYNCH_NULL_MUTEX> >; #pragma instantiate ACE_Hash_Map_Entry<ACE_ADDR, Client_Svc_Handler *> #pragma instantiate ACE_Hash<ACE_ADDR> #pragma instantiate ACE_Equal_To<ACE_ADDR> -#pragma instantiate ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<Client_Svc_Handler> *> -#pragma instantiate ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Client_Svc_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<Client_Svc_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Client_Svc_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Client_Svc_Handler> *, ACE_SYNCH_RW_MUTEX> #pragma instantiate ACE_NOOP_Concurrency_Strategy<Client_Svc_Handler> #pragma instantiate ACE_Recycling_Strategy<Client_Svc_Handler> #pragma instantiate ACE_Strategy_Connector<Client_Svc_Handler, ACE_SOCK_CONNECTOR> -#pragma instantiate ACE_Svc_Tuple<Client_Svc_Handler> +#pragma instantiate ACE_NonBlocking_Connect_Handler<Client_Svc_Handler> #pragma instantiate ACE_Strategy_Acceptor<Server_Svc_Handler, ACE_SOCK_ACCEPTOR> #pragma instantiate Accept_Strategy<Server_Svc_Handler, ACE_SOCK_ACCEPTOR> diff --git a/tests/Cached_Conn_Test.cpp b/tests/Cached_Conn_Test.cpp index 394b57ad0ce..dc38066b88c 100644 --- a/tests/Cached_Conn_Test.cpp +++ b/tests/Cached_Conn_Test.cpp @@ -145,16 +145,11 @@ template class ACE_Creation_Strategy<Svc_Handler>; template class ACE_Hash_Map_Entry<ACE_ADDR, Svc_Handler *>; template class ACE_Hash<ACE_ADDR>; template class ACE_Equal_To<ACE_ADDR>; -template class ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *>; -template class ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX>; template class ACE_NOOP_Concurrency_Strategy<Svc_Handler>; template class ACE_Recycling_Strategy<Svc_Handler>; template class ACE_Strategy_Connector<Svc_Handler, ACE_SOCK_CONNECTOR>; -template class ACE_Svc_Tuple<Svc_Handler>; template class ACE_Oneshot_Acceptor<Svc_Handler, ACE_SOCK_ACCEPTOR>; +template class ACE_NonBlocking_Connect_Handler<Svc_Handler>; template class ACE_Pair<Svc_Handler *, ATTRIBUTES>; template class ACE_Reference_Pair<ACE_ADDR, Svc_Handler *>; @@ -232,16 +227,11 @@ template class ACE_Guard<ACE_Reverse_Lock<ACE_SYNCH_NULL_MUTEX> >; #pragma instantiate ACE_Hash_Map_Entry<ACE_ADDR, Svc_Handler *> #pragma instantiate ACE_Hash<ACE_ADDR> #pragma instantiate ACE_Equal_To<ACE_ADDR> -#pragma instantiate ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *> -#pragma instantiate ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX> #pragma instantiate ACE_NOOP_Concurrency_Strategy<Svc_Handler> #pragma instantiate ACE_Recycling_Strategy<Svc_Handler> #pragma instantiate ACE_Strategy_Connector<Svc_Handler, ACE_SOCK_CONNECTOR> -#pragma instantiate ACE_Svc_Tuple<Svc_Handler> #pragma instantiate ACE_Oneshot_Acceptor<Svc_Handler, ACE_SOCK_ACCEPTOR> +#pragma instantiate ACE_NonBlocking_Connect_Handler<Svc_Handler> #pragma instantiate ACE_Pair<Svc_Handler *, ATTRIBUTES> #pragma instantiate ACE_Reference_Pair<ACE_ADDR, Svc_Handler *> diff --git a/tests/Conn_Test.cpp b/tests/Conn_Test.cpp index a666cc9d436..e233cfcdef0 100644 --- a/tests/Conn_Test.cpp +++ b/tests/Conn_Test.cpp @@ -123,16 +123,11 @@ template class ACE_Hash_Map_Reverse_Iterator<REFCOUNTED_HASH_RECYCLABLE_ADDR, Sv template class ACE_Hash_Map_Reverse_Iterator_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_SYNCH_RW_MUTEX>; template class ACE_LOCK_SOCK_Acceptor<ACCEPTOR_LOCKING>; template class ACE_Oneshot_Acceptor<Svc_Handler, LOCK_SOCK_ACCEPTOR>; -template class ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *>; -template class ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX>; template class ACE_NOOP_Concurrency_Strategy<Svc_Handler>; template class ACE_Recycling_Strategy<Svc_Handler>; template class ACE_Strategy_Connector<Svc_Handler, ACE_SOCK_CONNECTOR>; template class ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>; -template class ACE_Svc_Tuple<Svc_Handler>; +template class ACE_NonBlocking_Connect_EH<Svc_Handler, ACE_SYNCH_MUTEX>; template class ACE_Auto_Basic_Array_Ptr<pid_t>; #if defined (__BORLANDC__) @@ -179,16 +174,11 @@ template class ACE_Unbounded_Queue<ACE_Thread_Descriptor*>; #pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDR, Svc_Handler *, ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDR>, ACE_SYNCH_RW_MUTEX> #pragma instantiate ACE_LOCK_SOCK_Acceptor<ACCEPTOR_LOCKING> #pragma instantiate ACE_Oneshot_Acceptor<Svc_Handler, LOCK_SOCK_ACCEPTOR> -#pragma instantiate ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *> -#pragma instantiate ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Svc_Handler> *, ACE_SYNCH_RW_MUTEX> #pragma instantiate ACE_NOOP_Concurrency_Strategy<Svc_Handler> #pragma instantiate ACE_Recycling_Strategy<Svc_Handler> #pragma instantiate ACE_Strategy_Connector<Svc_Handler, ACE_SOCK_CONNECTOR> #pragma instantiate ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> -#pragma instantiate ACE_Svc_Tuple<Svc_Handler> +#pragma instantiate ACE_NonBlocking_Connect_EH<Svc_Handler, ACE_SYNCH_MUTEX> #pragma instantiate ACE_Auto_Basic_Array_Ptr<pid_t> #if defined (__BORLANDC__) diff --git a/tests/Dev_Poll_Reactor_Test.cpp b/tests/Dev_Poll_Reactor_Test.cpp index 6d94cb6f1b8..dc6b71bdcf9 100644 --- a/tests/Dev_Poll_Reactor_Test.cpp +++ b/tests/Dev_Poll_Reactor_Test.cpp @@ -556,38 +556,14 @@ run_main (int, ACE_TCHAR *[]) template class ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>; template class ACE_Acceptor<Server, ACE_SOCK_ACCEPTOR>; template class ACE_Connector<Client, ACE_SOCK_CONNECTOR>; - -template class ACE_Svc_Tuple<Server>; -template class ACE_Svc_Tuple<Client>; - -template class ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<Server> *>; -template class ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Server> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<Server> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Server> *, ACE_SYNCH_RW_MUTEX>; - -template class ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<Client> *>; -template class ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Client> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<Client> *, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Client> *, ACE_SYNCH_RW_MUTEX>; +template class ACE_NonBlocking_Connect_Handler<Client>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> #pragma instantiate ACE_Acceptor<Server, ACE_SOCK_ACCEPTOR> #pragma instantiate ACE_Connector<Client, ACE_SOCK_CONNECTOR> - -#pragma instantiate ACE_Svc_Tuple<Server> -#pragma instantiate ACE_Svc_Tuple<Client> - -#pragma instantiate ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<Server> *> -#pragma instantiate ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Server> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<Server> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Server> *, ACE_SYNCH_RW_MUTEX> - -#pragma instantiate ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<Client> *> -#pragma instantiate ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<Client> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE, ACE_Svc_Tuple<Client> *, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<Client> *, ACE_SYNCH_RW_MUTEX> +#pragma instantiate ACE_NonBlocking_Connect_Handler<Client> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ @@ -598,7 +574,7 @@ run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Dev_Poll_Reactor_Test")); ACE_ERROR ((LM_INFO, - ACE_TEXT ("Dev Poll and Event Poll are not supported") + ACE_TEXT ("Dev Poll and Event Poll are not supported ") ACE_TEXT ("on this platform\n"))); ACE_END_TEST; return 0; diff --git a/tests/MT_Reference_Counted_Event_Handler_Test.cpp b/tests/MT_Reference_Counted_Event_Handler_Test.cpp new file mode 100644 index 00000000000..4bcbd2a0ce0 --- /dev/null +++ b/tests/MT_Reference_Counted_Event_Handler_Test.cpp @@ -0,0 +1,1389 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// tests +// +// = FILENAME +// MT_Reference_Counted_Event_Handler_Test.cpp +// +// = DESCRIPTION +// +// This test tries to represents what happens in the ORB wrt to +// event handlers, reactors, timer queues, threads, and connection +// caches, minus the other complexities. The following three +// Reactors are tested: Select, TP, and WFMO. +// +// The test checks proper use and shutting down of client-side +// event handlers when it is used by invocation threads and/or +// event loop threads. Server-side event handlers are either +// threaded or reactive. A purger thread is introduced to check the +// connection recycling and cache purging. Nested upcalls are also +// tested. +// +// = AUTHOR +// Irfan Pyarali <irfan@oomworks.com> +// +// ============================================================================ + +#include "test_config.h" +#include "ace/Select_Reactor.h" +#include "ace/TP_Reactor.h" +#include "ace/WFMO_Reactor.h" +#include "ace/Get_Opt.h" +#include "ace/Task.h" +#include "ace/SOCK_Acceptor.h" +#include "ace/SOCK_Connector.h" + +ACE_RCSID(tests, MT_Reference_Counted_Event_Handler_Test, "$Id$") + +#if defined (ACE_HAS_THREADS) + +static const char message[] = "abcdefghijklmnopqrstuvwxyz"; +static const int message_size = 26; +static int test_select_reactor = 1; +static int test_tp_reactor = 1; +static int test_wfmo_reactor = 1; +static int debug = 0; +static int number_of_connections = 5; +static int max_nested_upcall_level = 10; +static int close_timeout = 500; +static int pipe_open_attempts = 10; +static int pipe_retry_timeout = 1; +static int make_invocations = -1; +static int run_event_loop_thread = -1; +static int run_purger_thread = -1; +static int run_receiver_thread = -1; +static int nested_upcalls = -1; + +static ACE_HANDLE server_handle = ACE_INVALID_HANDLE; +static ACE_HANDLE client_handle = ACE_INVALID_HANDLE; + +static int number_of_options = 5; +static int test_configs[][5] = + { + // + // make_invocations, run_event_loop_thread, run_purger_thread, run_receiver_thread, nested_upcalls + // + + // { 0, 0, 0, 0, 0, }, // At least one thread should be running. + // { 0, 0, 0, 1, 0, }, // If event_loop_thread is not running and invocation_thread is not making invocations, + // no thread will know that the socket is closed. + // { 0, 0, 1, 0, 0, }, // If invocation_thread is not making invocations and if receiver is not threaded, + // we cannot decide which socket to close. + // { 0, 0, 1, 1, 0, }, // If event_loop_thread is not running and invocation_thread is not making invocations, + // no thread will know that the socket is closed. + // { 0, 1, 0, 0, 0, }, // If invocation_thread is not making invocations and if receiver is not threaded, + // we cannot decide which socket to close. + { 0, 1, 0, 1, 0, }, + // { 0, 1, 0, 1, 1, }, // No need for nested upcalls without invocations. + // { 0, 1, 1, 0, 0, }, // If invocation_thread is not making invocations and if receiver is not threaded, + // we cannot decide which socket to close. + { 0, 1, 1, 1, 0, }, + // { 0, 1, 1, 1, 1, }, // No need for nested upcalls without invocations. + // { 1, 0, 0, 0, 0, }, // If both event_loop_thread and receiver are not threaded, + // no thread can receive the messages. + { 1, 0, 0, 1, 0, }, + // { 1, 0, 0, 1, 1, }, // No need for nested upcalls without event loop being used by the receiver. + // { 1, 0, 1, 0, 0, }, // If both event_loop_thread and receiver are not threaded, + // no thread can receive the messages. + { 1, 0, 1, 1, 0, }, + // { 1, 0, 1, 1, 1, }, // No need for nested upcalls without event loop being used by the receiver. + { 1, 1, 0, 0, 0, }, + { 1, 1, 0, 0, 1, }, + { 1, 1, 0, 1, 0, }, + // { 1, 1, 0, 1, 1, }, // No need for nested upcalls without event loop being used by the receiver. + { 1, 1, 1, 0, 0, }, + { 1, 1, 1, 0, 1, }, + { 1, 1, 1, 1, 0, }, + // { 1, 1, 1, 1, 1, }, // No need for nested upcalls without event loop being used by the receiver. + }; + +/* Replication of the ACE_Pipe class. Only difference is that this + class always uses two sockets to create the pipe, even on platforms + that support pipes. */ + +class Pipe +{ +public: + + Pipe (void); + + int open (void); + + ACE_HANDLE read_handle (void) const; + + ACE_HANDLE write_handle (void) const; + +private: + ACE_HANDLE handles_[2]; +}; + +int +Pipe::open (void) +{ + ACE_INET_Addr my_addr; + ACE_SOCK_Acceptor acceptor; + ACE_SOCK_Connector connector; + ACE_SOCK_Stream reader; + ACE_SOCK_Stream writer; + int result = 0; + + // Bind listener to any port and then find out what the port was. + if (acceptor.open (ACE_Addr::sap_any) == -1 + || acceptor.get_local_addr (my_addr) == -1) + result = -1; + else + { + ACE_INET_Addr sv_addr (my_addr.get_port_number (), + ACE_LOCALHOST); + + // Establish a connection within the same process. + if (connector.connect (writer, sv_addr) == -1) + result = -1; + else if (acceptor.accept (reader) == -1) + { + writer.close (); + result = -1; + } + } + + // Close down the acceptor endpoint since we don't need it anymore. + acceptor.close (); + if (result == -1) + return -1; + + this->handles_[0] = reader.get_handle (); + this->handles_[1] = writer.get_handle (); + + return 0; +} + +Pipe::Pipe (void) +{ + this->handles_[0] = ACE_INVALID_HANDLE; + this->handles_[1] = ACE_INVALID_HANDLE; +} + +ACE_HANDLE +Pipe::read_handle (void) const +{ + return this->handles_[0]; +} + +ACE_HANDLE +Pipe::write_handle (void) const +{ + return this->handles_[1]; +} + +class Connection_Cache; +class Event_Loop_Thread; + +static Event_Loop_Thread *global_event_loop_thread_variable = 0; + +class Sender : public ACE_Event_Handler +{ +public: + + Sender (ACE_HANDLE handle, + Connection_Cache &connection_cache); + + ~Sender (void); + + int handle_input (ACE_HANDLE); + + ssize_t send_message (void); + + void close (void); + + ACE_HANDLE handle_; + + Connection_Cache &connection_cache_; + +}; + +class Connection_Cache +{ +public: + + Connection_Cache (void); + + ~Connection_Cache (void); + + void add_connection (Sender *sender); + + void remove_connection (Sender *sender); + + Sender *acquire_connection (void); + + void release_connection (Sender *sender); + + int find (Sender *sender); + + ACE_SYNCH_MUTEX &lock (void); + + enum State + { + IDLE, + BUSY, + NOT_IN_CACHE + }; + + struct Entry + { + Sender *sender_; + State state_; + }; + + Entry *entries_; + + ACE_SYNCH_MUTEX lock_; +}; + +Sender::Sender (ACE_HANDLE handle, + Connection_Cache &connection_cache) + : handle_ (handle), + connection_cache_ (connection_cache) +{ + // Enable reference counting. + this->reference_counting_policy ().value + (ACE_Event_Handler::Reference_Counting_Policy::ENABLED); + + if (debug) + ACE_DEBUG ((LM_DEBUG, + "Reference count in Sender::Sender() is %d\n", + this->reference_count_.value ())); +} + +Sender::~Sender (void) +{ + if (debug) + ACE_DEBUG ((LM_DEBUG, + "Reference count in ~Sender::Sender() is %d\n", + this->reference_count_.value ())); + + // Close the socket that we are responsible for. + ACE_OS::closesocket (this->handle_); +} + +int +Sender::handle_input (ACE_HANDLE) +{ + if (debug) + ACE_DEBUG ((LM_DEBUG, + "Reference count in Sender::handle_input() is %d\n", + this->reference_count_.value ())); + + // + // In this test, this method is only called when the connection has + // been closed. Remove self from Reactor. + // + + ACE_DEBUG ((LM_DEBUG, + "Event loop thread calling Sender::close() for handle %d\n", + this->handle_)); + + this->close (); + + return 0; +} + +void +Sender::close (void) +{ + // Remove socket from Reactor (may fail if another thread has already + // removed the handle from the Reactor). + this->reactor ()->remove_handler (this->handle_, + ACE_Event_Handler::ALL_EVENTS_MASK); + + // Remove self from connection cache (may fail if another thread has + // already removed "this" from the cache). + this->connection_cache_.remove_connection (this); +} + +ssize_t +Sender::send_message (void) +{ + return ACE::send_n (this->handle_, + message, + message_size); +} + +class Event_Loop_Thread : public ACE_Task_Base +{ +public: + + Event_Loop_Thread (ACE_Thread_Manager &thread_manager, + ACE_Reactor &reactor); + + int svc (void); + + ACE_Reactor &reactor_; + +}; + +class Receiver : public ACE_Task_Base +{ +public: + + Receiver (ACE_Thread_Manager &thread_manager, + ACE_HANDLE handle, + int nested_upcalls); + + ~Receiver (void); + + int svc (void); + + int close (u_long flags); + + int handle_input (ACE_HANDLE); + + int resume_handler (void); + + ACE_HANDLE handle_; + + int counter_; + + int nested_upcalls_; + + int nested_upcalls_level_; + +}; + +Receiver::Receiver (ACE_Thread_Manager &thread_manager, + ACE_HANDLE handle, + int nested_upcalls) + : ACE_Task_Base (&thread_manager), + handle_ (handle), + counter_ (1), + nested_upcalls_ (nested_upcalls), + nested_upcalls_level_ (0) +{ + // Enable reference counting. + this->reference_counting_policy ().value + (ACE_Event_Handler::Reference_Counting_Policy::ENABLED); + + if (debug) + ACE_DEBUG ((LM_DEBUG, + "Reference count in Receiver::Receiver() is %d\n", + this->reference_count_.value ())); +} + +Receiver::~Receiver (void) +{ + if (debug) + ACE_DEBUG ((LM_DEBUG, + "Reference count in ~Receiver::Receiver() is %d\n", + this->reference_count_.value ())); + + // Close the socket that we are responsible for. + ACE_OS::closesocket (this->handle_); +} + +int +Receiver::svc (void) +{ + // + // Continuously receive messages from the Sender. On error, exit + // thread. + // + + int result = 0; + + while (result != -1) + { + result = + this->handle_input (this->handle_); + } + + return 0; +} + +int +Receiver::handle_input (ACE_HANDLE handle) +{ + char buf[message_size + 1]; + + // Receive message. + ssize_t result = + ACE::recv_n (handle, + buf, + sizeof buf - 1); + + if (this->reactor ()) + this->reactor ()->resume_handler (handle); + + if (result == message_size) + { + if (debug) + ACE_DEBUG ((LM_DEBUG, + "Message %d received on handle %d\n", + this->counter_++, + handle)); + + if (this->thr_count () == 0 && + this->nested_upcalls_) + { + this->nested_upcalls_level_++; + + if (debug) + ACE_DEBUG ((LM_DEBUG, + "Nesting level %d\n", + this->nested_upcalls_level_)); + + if (this->nested_upcalls_level_ != max_nested_upcall_level) + global_event_loop_thread_variable->svc (); + + this->nested_upcalls_level_--; + return 0; + } + else + return 0; + } + else + { + if (debug) + ACE_DEBUG ((LM_DEBUG, + "/*** Problem in receiving message %d on handle %d: shutting down receiving thread ***/\n", + this->counter_, + handle)); + + return -1; + } +} + +int +Receiver::resume_handler (void) +{ + /// The application takes responsibility of resuming the handler. + return ACE_APPLICATION_RESUMES_HANDLER; +} + +int +Receiver::close (u_long) +{ + // If threaded, we are responsible for deleting this instance when + // the thread completes. If not threaded, Reactor reference + // counting will handle the deletion of this instance. + delete this; + return 0; +} + +class Connector +{ +public: + + Connector (ACE_Thread_Manager &thread_manager, + ACE_Reactor &reactor, + int nested_upcalls); + + int connect (ACE_HANDLE &client_handle, + ACE_HANDLE &server_handle, + int run_receiver_thread); + + ACE_Thread_Manager &thread_manager_; + + ACE_Reactor &reactor_; + + int nested_upcalls_; + +}; + +Connector::Connector (ACE_Thread_Manager &thread_manager, + ACE_Reactor &reactor, + int nested_upcalls) + : thread_manager_ (thread_manager), + reactor_ (reactor), + nested_upcalls_ (nested_upcalls) +{ +} + +int +Connector::connect (ACE_HANDLE &client_handle, + ACE_HANDLE &server_handle, + int run_receiver_thread) +{ + // + // Create a connection and a receiver to receive messages on the + // connection. + // + + Pipe pipe; + int result = 0; + + for (int i = 0; i < pipe_open_attempts; ++i) + { + result = + pipe.open (); + + if (result == 0) + break; + + if (result == -1) + ACE_OS::sleep (pipe_retry_timeout); + } + + ACE_ASSERT (result == 0); + ACE_UNUSED_ARG (result); + + Receiver *receiver = + new Receiver (this->thread_manager_, + pipe.write_handle (), + this->nested_upcalls_); + + // Either the receiver is threaded or register it with the Reactor. + if (run_receiver_thread) + result = + receiver->activate (); + else + { + result = + this->reactor_.register_handler (pipe.write_handle (), + receiver, + ACE_Event_Handler::READ_MASK); + + // The reference count on the receiver was increased by the + // Reactor. + ACE_Event_Handler_var safe_receiver (receiver); + } + + ACE_ASSERT (result == 0); + ACE_UNUSED_ARG (result); + + client_handle = + pipe.read_handle (); + + server_handle = + pipe.write_handle (); + + if (debug) + ACE_DEBUG ((LM_DEBUG, + "New connection: client handle = %d, server handle = %d\n", + client_handle, server_handle)); + + return 0; +} + +Connection_Cache::Connection_Cache (void) +{ + // Initialize the connection cache. + this->entries_ = + new Entry[number_of_connections]; + + for (int i = 0; i < number_of_connections; ++i) + { + this->entries_[i].sender_ = 0; + this->entries_[i].state_ = NOT_IN_CACHE; + } +} + +int +Connection_Cache::find (Sender *sender) +{ + for (int i = 0; i < number_of_connections; ++i) + { + if (this->entries_[i].sender_ == sender) + return i; + } + + return -1; +} + +void +Connection_Cache::add_connection (Sender *sender) +{ + ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->lock_); + + // Make sure that the state of the connection cache is as + // expected. <sender> should not be already in the cache. + ACE_ASSERT (this->find (sender) == -1); + + int empty_index = + this->find (0); + + sender->add_reference (); + this->entries_[empty_index].sender_ = sender; + this->entries_[empty_index].state_ = BUSY; +} + +void +Connection_Cache::remove_connection (Sender *sender) +{ + ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->lock_); + + // Make sure that the state of the connection cache is as expected. + // remove_connection() may already have been called. + int index = + this->find (sender); + + if (index == -1) + return; + + // If we still have the sender, remove it. + sender->remove_reference (); + this->entries_[index].sender_ = 0; + this->entries_[index].state_ = NOT_IN_CACHE; +} + +Sender * +Connection_Cache::acquire_connection (void) +{ + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->lock_, 0); + + // Find a valid and IDLE sender. + + int index = -1; + + for (int i = 0; i < number_of_connections; ++i) + { + if (this->entries_[i].sender_ && + this->entries_[i].state_ == IDLE) + index = i; + } + + if (index == -1) + return 0; + + this->entries_[index].sender_->add_reference (); + this->entries_[index].state_ = BUSY; + + return this->entries_[index].sender_; +} + +void +Connection_Cache::release_connection (Sender *sender) +{ + ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->lock_); + + // Make sure that the state of the connection cache is as expected. + // remove_connection() may have already removed the connection from + // the cache. + int index = + this->find (sender); + + if (index == -1) + return; + + // If we still have the sender, idle it. + this->entries_[index].state_ = IDLE; +} + +ACE_SYNCH_MUTEX & +Connection_Cache::lock (void) +{ + return this->lock_; +} + +Connection_Cache::~Connection_Cache (void) +{ + for (int i = 0; i < number_of_connections; ++i) + { + if (this->entries_[i].sender_) + this->remove_connection (this->entries_[i].sender_); + } + + delete[] this->entries_; +} + +class Invocation_Thread : public ACE_Task_Base +{ +public: + + Invocation_Thread (ACE_Thread_Manager &thread_manager, + ACE_Reactor &reactor, + Connection_Cache &connection_cache, + ACE_Auto_Event &new_connection_event, + int make_invocations, + int run_receiver_thread, + int nested_upcalls); + + int svc (void); + + Sender *create_connection (void); + + Connection_Cache &connection_cache_; + + ACE_Reactor &reactor_; + + ACE_Thread_Manager &thread_manager_; + + ACE_Auto_Event &new_connection_event_; + + int make_invocations_; + + int run_receiver_thread_; + + int nested_upcalls_; + +}; + +Invocation_Thread::Invocation_Thread (ACE_Thread_Manager &thread_manager, + ACE_Reactor &reactor, + Connection_Cache &connection_cache, + ACE_Auto_Event &new_connection_event, + int make_invocations, + int run_receiver_thread, + int nested_upcalls) + : ACE_Task_Base (&thread_manager), + connection_cache_ (connection_cache), + reactor_ (reactor), + thread_manager_ (thread_manager), + new_connection_event_ (new_connection_event), + make_invocations_ (make_invocations), + run_receiver_thread_ (run_receiver_thread), + nested_upcalls_ (nested_upcalls) +{ +} + +Sender * +Invocation_Thread::create_connection (void) +{ + int result = 0; + + // Connector for creating new connections. + Connector connector (this->thread_manager_, + this->reactor_, + this->nested_upcalls_); + + // <server_handle> is a global variable. It will be used later by + // the Close_Socket_Thread. + result = + connector.connect (client_handle, + server_handle, + this->run_receiver_thread_); + ACE_ASSERT (result == 0); + ACE_UNUSED_ARG (result); + + // Create a new sender. + Sender *sender = + new Sender (client_handle, + this->connection_cache_); + + // Register it with the cache. + this->connection_cache_.add_connection (sender); + + // + // There might be a race condition here. The sender has been added + // to the cache and is potentially available to other threads + // accessing the cache. Therefore, the other thread may use this + // sender and potentially close the sender before it even gets + // registered with the Reactor. + // + // This is resolved by marking the connection as busy when it is + // first added to the cache. And only once the thread creating the + // connection is done with it, it is marked a available in the + // cache. + // + // This order of registration is important. + // + + // Register the handle with the Reactor. + result = + this->reactor_.register_handler (client_handle, + sender, + ACE_Event_Handler::READ_MASK); + ACE_ASSERT (result == 0); + ACE_UNUSED_ARG (result); + + return sender; +} + +int +Invocation_Thread::svc (void) +{ + int connection_counter = 0; + for (int message_counter = 1;; ++message_counter) + { + // Get a connection from the cache. + Sender *sender = + this->connection_cache_.acquire_connection (); + + // If no connection is available in the cache, create a new one. + if (sender == 0) + { + if (connection_counter < number_of_connections) + { + sender = this->create_connection (); + + // This lets the Close_Socket_Thread know that the new + // connection has been created. + int result = + this->new_connection_event_.signal (); + ACE_ASSERT (result == 0); + ACE_UNUSED_ARG (result); + + ++connection_counter; + message_counter = 1; + } + else + // Stop the thread, if the maximum number of connections + // for the test has been reached. + break; + } + + // The reference count on the sender was increased by the cache + // before it was returned to us. + ACE_Event_Handler_var safe_sender (sender); + + // If the test does not require making invocations, immediately + // release the connection. + if (!this->make_invocations_) + { + this->connection_cache_.release_connection (sender); + + // Sleep for a short while + ACE_OS::sleep (ACE_Time_Value (0, 10 * 1000)); + } + else + { + // Make invocation. + ssize_t result = + sender->send_message (); + + // If successful, release connection. + if (result == message_size) + { + if (debug) + ACE_DEBUG ((LM_DEBUG, + "Message %d:%d delivered on handle %d\n", + connection_counter, + message_counter, + sender->handle_)); + + this->connection_cache_.release_connection (sender); + } + else + { + // If failure in making invocation, close the sender. + if (debug) + ACE_DEBUG ((LM_DEBUG, + "/*** Problem in delivering message %d:%d on handle %d: shutting down invocation thread ***/\n", + connection_counter, + message_counter, + sender->handle_)); + + ACE_DEBUG ((LM_DEBUG, + "Invocation thread calling Sender::close() for handle %d\n", + sender->handle_)); + + sender->close (); + } + } + } + + // Close the Reactor event loop. + this->reactor_.end_reactor_event_loop (); + + return 0; +} + +class Close_Socket_Thread : public ACE_Task_Base +{ +public: + + Close_Socket_Thread (ACE_Thread_Manager &thread_manager, + ACE_Reactor &reactor, + ACE_Auto_Event &new_connection_event, + int make_invocations, + int run_receiver_thread); + + int svc (void); + + ACE_Auto_Event &new_connection_event_; + + ACE_Reactor &reactor_; + + int make_invocations_; + + int run_receiver_thread_; + +}; + +Close_Socket_Thread::Close_Socket_Thread (ACE_Thread_Manager &thread_manager, + ACE_Reactor &reactor, + ACE_Auto_Event &new_connection_event, + int make_invocations, + int run_receiver_thread) + : ACE_Task_Base (&thread_manager), + new_connection_event_ (new_connection_event), + reactor_ (reactor), + make_invocations_ (make_invocations), + run_receiver_thread_ (run_receiver_thread) +{ +} + +int +Close_Socket_Thread::svc (void) +{ + ACE_OS::srand ((u_int) ACE_OS::time ()); + ACE_Time_Value timeout (0, close_timeout * 1000); + + for (; !this->reactor_.reactor_event_loop_done ();) + { + // Wait for the new connection to be established. + int result = + this->new_connection_event_.wait (&timeout, + 0); + ACE_ASSERT (result == 0 || + (result == -1 && errno == ETIME)); + + if (result == -1 && + errno == ETIME) + continue; + + // Sleep for half a second. + ACE_OS::sleep (timeout); + + int close_client = 0; + + // If the invocation thread is making invocations and if the + // receiver is threaded, either socket can be closed. + if (this->make_invocations_ && + this->run_receiver_thread_) + // Randomize which socket to close. + close_client = ACE_OS::rand () % 2; + + // If the invocation thread is making invocations, only close + // the client socket. + else if (this->make_invocations_) + close_client = 1; + else + // If the receiver is threaded, only close the server socket. + close_client = 0; + + if (close_client) + { + // Close the client socket. + if (debug) + ACE_DEBUG ((LM_DEBUG, + "Close socket thread closing client handle %d\n", + client_handle)); + + ACE_OS::closesocket (client_handle); + } + else + { + // Close the server socket. + if (debug) + ACE_DEBUG ((LM_DEBUG, + "Close socket thread closing server handle %d\n", + server_handle)); + + ACE_OS::closesocket (server_handle); + } + } + + return 0; +} + +Event_Loop_Thread::Event_Loop_Thread (ACE_Thread_Manager &thread_manager, + ACE_Reactor &reactor) + : ACE_Task_Base (&thread_manager), + reactor_ (reactor) +{ +} + +int +Event_Loop_Thread::svc (void) +{ + // Simply run the event loop. + this->reactor_.owner (ACE_Thread::self ()); + + while (!this->reactor_.reactor_event_loop_done ()) + { + this->reactor_.handle_events (); + } + + return 0; +} + +class Purger_Thread : public ACE_Task_Base +{ +public: + + Purger_Thread (ACE_Thread_Manager &thread_manager, + ACE_Reactor &reactor, + Connection_Cache &connection_cache); + + int svc (void); + + ACE_Reactor &reactor_; + + Connection_Cache &connection_cache_; + +}; + +Purger_Thread::Purger_Thread (ACE_Thread_Manager &thread_manager, + ACE_Reactor &reactor, + Connection_Cache &connection_cache) + : ACE_Task_Base (&thread_manager), + reactor_ (reactor), + connection_cache_ (connection_cache) +{ +} + +int +Purger_Thread::svc (void) +{ + for (; !this->reactor_.reactor_event_loop_done ();) + { + // Get a connection from the cache. + Sender *sender = + this->connection_cache_.acquire_connection (); + + // If no connection is available in the cache, sleep for a while. + if (sender == 0) + ACE_OS::sleep (ACE_Time_Value (0, 10 * 1000)); + else + { + // The reference count on the sender was increased by the + // cache before it was returned to us. + ACE_Event_Handler_var safe_sender (sender); + + // Actively close the connection. + ACE_DEBUG ((LM_DEBUG, + "Purger thread calling Sender::close() for handle %d\n", + sender->handle_)); + + sender->close (); + } + } + + return 0; +} + +void +testing (ACE_Reactor *reactor, + int make_invocations, + int run_event_loop_thread, + int run_purger_thread, + int run_receiver_thread, + int nested_upcalls) +{ + ACE_DEBUG ((LM_DEBUG, + "\nConfiguration: \n" + "\tInvocation thread = %d\n" + "\tEvent Loop thread = %d\n" + "\tPurger thread = %d\n" + "\tReceiver thread = %d\n" + "\tNested Upcalls = %d\n\n", + make_invocations, + run_event_loop_thread, + run_purger_thread, + run_receiver_thread, + nested_upcalls)); + + ACE_Thread_Manager thread_manager; + + int result = 0; + + // Create the connection cache. + Connection_Cache connection_cache; + ACE_Auto_Event new_connection_event; + + // Create the invocation thread. + Invocation_Thread invocation_thread (thread_manager, + *reactor, + connection_cache, + new_connection_event, + make_invocations, + run_receiver_thread, + nested_upcalls); + + result = + invocation_thread.activate (); + ACE_ASSERT (result == 0); + + // Create the thread for closing the server socket. + Close_Socket_Thread close_socket_thread (thread_manager, + *reactor, + new_connection_event, + make_invocations, + run_receiver_thread); + result = + close_socket_thread.activate (); + ACE_ASSERT (result == 0); + + global_event_loop_thread_variable = 0; + + // Create a thread to run the event loop. + Event_Loop_Thread event_loop_thread (thread_manager, + *reactor); + if (run_event_loop_thread) + { + result = + event_loop_thread.activate (); + ACE_ASSERT (result == 0); + + global_event_loop_thread_variable = + &event_loop_thread; + } + + // Create a thread to run the purger. + Purger_Thread purger_thread (thread_manager, + *reactor, + connection_cache); + if (run_purger_thread) + { + result = + purger_thread.activate (); + ACE_ASSERT (result == 0); + } + + // Wait for threads to exit. + result = thread_manager.wait (); + ACE_ASSERT (result == 0); +} + +template <class REACTOR_IMPL> +class test +{ +public: + test (int ignore_nested_upcalls, + int require_event_loop_thread); +}; + +template <class REACTOR_IMPL> +test<REACTOR_IMPL>::test (int ignore_nested_upcalls, + int require_event_loop_thread) +{ + for (int i = 0; + i < (int) (sizeof test_configs / (sizeof (int) * number_of_options)); + i++) + { + if ((make_invocations == -1 || + make_invocations == test_configs[i][0]) && + (run_event_loop_thread == -1 || + run_event_loop_thread == test_configs[i][1]) && + (run_purger_thread == -1 || + run_purger_thread == test_configs[i][2]) && + (run_receiver_thread == -1 || + run_receiver_thread == test_configs[i][3]) && + (nested_upcalls == -1 || + nested_upcalls == test_configs[i][4])) + { + +#if defined (linux) + + // @@ I am not sure why but when <make_invocations> is 0 and + // there is no purger thread, the receiver thread does not + // notice that the connection has been closed. + if (!test_configs[i][0] && !test_configs[i][2]) + continue; + + // @@ Linux also does not work correctly in the following + // case: Invocation thread starts and sends messages filling + // the socket buffer. It then blocks in write(). In the + // meantime, the close connection thread closes the socket + // used by invocation thread. However, the invocation thread + // does not notice this as it does not return from write(). + // Meanwhile, the event loop thread notices that a socket in + // it's wait set has been closed, and starts to spin in + // handle_events() since the invocation thread is not taking + // out the closed handle from the Reactor's wait set. + if (test_configs[i][0] && test_configs[i][1] && !test_configs[i][3]) + continue; + +#endif /* linux */ + + if (test_configs[i][4] && ignore_nested_upcalls) + continue; + + if (!test_configs[i][1] && require_event_loop_thread) + continue; + + ACE_Reactor reactor (new REACTOR_IMPL, + 1); + + testing (&reactor, + test_configs[i][0], + test_configs[i][1], + test_configs[i][2], + test_configs[i][3], + test_configs[i][4]); + } + } +} + +static int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("a:b:c:f:g:k:l:m:n:o:uz:")); + + int cc; + while ((cc = get_opt ()) != -1) + { + switch (cc) + { + case 'a': + test_select_reactor = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'b': + test_tp_reactor = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'c': + test_wfmo_reactor = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'f': + number_of_connections = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'g': + close_timeout = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'k': + make_invocations = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'l': + run_event_loop_thread = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'm': + run_purger_thread = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'n': + run_receiver_thread = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'o': + nested_upcalls = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'z': + debug = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'u': + default: + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("\nusage: %s \n\n") + ACE_TEXT ("\t[-a test Select Reactor] (defaults to %d)\n") + ACE_TEXT ("\t[-b test TP Reactor] (defaults to %d)\n") + ACE_TEXT ("\t[-c test WFMO Reactor] (defaults to %d)\n") + ACE_TEXT ("\t[-f number of connections] (defaults to %d)\n") + ACE_TEXT ("\t[-g close timeout] (defaults to %d)\n") + ACE_TEXT ("\t[-k make invocations] (defaults to %d)\n") + ACE_TEXT ("\t[-l run event loop thread] (defaults to %d)\n") + ACE_TEXT ("\t[-m run purger thread] (defaults to %d)\n") + ACE_TEXT ("\t[-n run receiver thread] (defaults to %d)\n") + ACE_TEXT ("\t[-o nested upcalls] (defaults to %d)\n") + ACE_TEXT ("\t[-z debug] (defaults to %d)\n") + ACE_TEXT ("\n"), + argv[0], + test_select_reactor, + test_tp_reactor, + test_wfmo_reactor, + number_of_connections, + close_timeout, + make_invocations, + run_event_loop_thread, + run_purger_thread, + run_receiver_thread, + nested_upcalls, + debug)); + return -1; + } + } + + return 0; +} + +int +run_main (int argc, ACE_TCHAR *argv[]) +{ + ACE_START_TEST (ACE_TEXT ("MT_Reference_Counted_Event_Handler_Test")); + + // Validate options. + int result = + parse_args (argc, argv); + if (result != 0) + return result; + +#if defined (SIGPIPE) && !defined (ACE_LACKS_UNIX_SIGNALS) + // There's really no way to deal with this in a portable manner, so + // we just have to suck it up and get preprocessor conditional and + // ugly. + // + // Impractical to have each call to the ORB protect against the + // implementation artifact of potential writes to dead connections, + // as it'd be way expensive. Do it here; who cares about SIGPIPE in + // these kinds of applications, anyway? + (void) ACE_OS::signal (SIGPIPE, (ACE_SignalHandler) SIG_IGN); +#endif /* SIGPIPE */ + + int ignore_nested_upcalls = 1; + int perform_nested_upcalls = 0; + + int event_loop_thread_required = 1; + int event_loop_thread_not_required = 0; + + if (test_select_reactor) + { + ACE_DEBUG ((LM_DEBUG, + "\n\nTesting Select Reactor....\n\n")); + + test<ACE_Select_Reactor> test (ignore_nested_upcalls, + event_loop_thread_not_required); + ACE_UNUSED_ARG (test); + } + + if (test_tp_reactor) + { + ACE_DEBUG ((LM_DEBUG, + "\n\nTesting TP Reactor....\n\n")); + + test<ACE_TP_Reactor> test (perform_nested_upcalls, + event_loop_thread_not_required); + ACE_UNUSED_ARG (test); + } + +#if defined (ACE_WIN32) + + if (test_wfmo_reactor) + { + ACE_DEBUG ((LM_DEBUG, + "\n\nTesting WFMO Reactor....\n\n")); + + test<ACE_WFMO_Reactor> test (ignore_nested_upcalls, + event_loop_thread_required); + ACE_UNUSED_ARG (test); + } + +#else /* ACE_WIN32 */ + + ACE_UNUSED_ARG (event_loop_thread_required); + +#endif /* ACE_WIN32 */ + + ACE_END_TEST; + + return 0; +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) +template class test<ACE_Select_Reactor>; +template class test<ACE_TP_Reactor>; +#if defined (ACE_WIN32) +template class test<ACE_WFMO_Reactor>; +#endif /* ACE_WIN32 */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate test<ACE_Select_Reactor> +#pragma instantiate test<ACE_TP_Reactor> +#if defined (ACE_WIN32) +#pragma instantiate test<ACE_WFMO_Reactor> +#endif /* ACE_WIN32 */ +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +#else /* ACE_HAS_THREADS */ + +int +run_main (int, ACE_TCHAR *[]) +{ + ACE_START_TEST (ACE_TEXT ("Timer_Cancellation_Test")); + + ACE_ERROR ((LM_INFO, + ACE_TEXT ("threads not supported on this platform\n"))); + + ACE_END_TEST; + + return 0; +} + +#endif /* ACE_HAS_THREADS */ diff --git a/tests/MT_Reference_Counted_Event_Handler_Test.dsp b/tests/MT_Reference_Counted_Event_Handler_Test.dsp new file mode 100644 index 00000000000..81bb113cc32 --- /dev/null +++ b/tests/MT_Reference_Counted_Event_Handler_Test.dsp @@ -0,0 +1,158 @@ +# Microsoft Developer Studio Project File - Name="MT_Reference_Counted_Event_Handler_Test" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=MT_Reference_Counted_Event_Handler_Test - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "MT_Reference_Counted_Event_Handler_Test.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "MT_Reference_Counted_Event_Handler_Test.mak" CFG="MT_Reference_Counted_Event_Handler_Test - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "MT_Reference_Counted_Event_Handler_Test - Win32 Static Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE "MT_Reference_Counted_Event_Handler_Test - Win32 Static Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "MT_Reference_Counted_Event_Handler_Test - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "MT_Reference_Counted_Event_Handler_Test - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "MT_Reference_Counted_Event_Handler_Test - Win32 Static Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Static_Debug"
+# PROP BASE Intermediate_Dir "Static_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Static_Debug"
+# PROP Intermediate_Dir "Static_Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../" /D "_DEBUG" /D ACE_AS_STATIC_LIBS /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
+# ADD LINK32 acesd.lib Test_Outputsd.lib advapi32.lib user32.lib /nologo /subsystem:console /debug /machine:I386 /libpath:"..\ace"
+
+!ELSEIF "$(CFG)" == "MT_Reference_Counted_Event_Handler_Test - Win32 Static Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Static_Release"
+# PROP BASE Intermediate_Dir "Static_Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Static_Release"
+# PROP Intermediate_Dir "Static_Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../" /D "NDEBUG" /D ACE_AS_STATIC_LIBS /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 aces.lib Test_Outputs.lib advapi32.lib user32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\ace"
+
+!ELSEIF "$(CFG)" == "MT_Reference_Counted_Event_Handler_Test - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib Test_Output.lib /nologo /subsystem:console /machine:I386 /libpath:"..\ace"
+
+!ELSEIF "$(CFG)" == "MT_Reference_Counted_Event_Handler_Test - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib Test_Outputd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\ace"
+
+!ENDIF
+
+# Begin Target
+
+# Name "MT_Reference_Counted_Event_Handler_Test - Win32 Static Debug"
+# Name "MT_Reference_Counted_Event_Handler_Test - Win32 Static Release"
+# Name "MT_Reference_Counted_Event_Handler_Test - Win32 Release"
+# Name "MT_Reference_Counted_Event_Handler_Test - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter ".cpp"
+# Begin Source File
+
+SOURCE=.\MT_Reference_Counted_Event_Handler_Test.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter ".h"
+# Begin Source File
+
+SOURCE=.\test_config.h
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/tests/MT_Reference_Counted_Notify_Test.cpp b/tests/MT_Reference_Counted_Notify_Test.cpp new file mode 100644 index 00000000000..e860a56a9f1 --- /dev/null +++ b/tests/MT_Reference_Counted_Notify_Test.cpp @@ -0,0 +1,459 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// tests +// +// = FILENAME +// MT_Reference_Counted_Notify_Test.cpp +// +// = DESCRIPTION +// This test is used to check reference counting of the event +// handlers when it interacts with the reactor notification +// mechanism. +// +// = AUTHOR +// Irfan Pyarali <irfan@oomworks.com> +// +// ============================================================================ + +#include "test_config.h" +#include "ace/Select_Reactor.h" +#include "ace/TP_Reactor.h" +#include "ace/WFMO_Reactor.h" +#include "ace/Task.h" +#include "ace/Get_Opt.h" + +ACE_RCSID(tests, MT_Reference_Counted_Notify_Test, "$Id$") + +#if defined (ACE_HAS_THREADS) + +static int test_select_reactor = 1; +static int test_tp_reactor = 1; +static int test_wfmo_reactor = 1; +static int test_empty_notify = 1; +static int test_simple_notify = 1; +static int test_reference_counted_notify = 1; +static int iterations = 5; +static int debug = 1; + +class Reference_Counted_Event_Handler : public ACE_Event_Handler +{ +public: + + Reference_Counted_Event_Handler (void); + + ~Reference_Counted_Event_Handler (void); + + int handle_input (ACE_HANDLE); + + ACE_Event_Handler::Reference_Count add_reference (void); + + ACE_Event_Handler::Reference_Count remove_reference (void); + +}; + +Reference_Counted_Event_Handler::Reference_Counted_Event_Handler (void) +{ + this->reference_counting_policy ().value + (ACE_Event_Handler::Reference_Counting_Policy::ENABLED); + + if (debug) + ACE_DEBUG ((LM_DEBUG, + "Reference count in Reference_Counted_Event_Handler() is %d\n", + this->reference_count_.value ())); +} + +Reference_Counted_Event_Handler::~Reference_Counted_Event_Handler (void) +{ + if (debug) + ACE_DEBUG ((LM_DEBUG, + "Reference count in ~Reference_Counted_Event_Handler() is %d\n", + this->reference_count_.value ())); +} + +int +Reference_Counted_Event_Handler::handle_input (ACE_HANDLE) +{ + if (debug) + ACE_DEBUG ((LM_DEBUG, + "Reference count in Reference_Counted_Event_Handler::handle_input() is %d\n", + this->reference_count_.value ())); + + return 0; +} + +ACE_Event_Handler::Reference_Count +Reference_Counted_Event_Handler::add_reference (void) +{ + ACE_Event_Handler::Reference_Count reference_count = + this->ACE_Event_Handler::add_reference (); + + if (debug) + ACE_DEBUG ((LM_DEBUG, + "Reference count after add_reference() is %d\n", + this->reference_count_.value ())); + + return reference_count; +} + +ACE_Event_Handler::Reference_Count +Reference_Counted_Event_Handler::remove_reference (void) +{ + ACE_Event_Handler::Reference_Count reference_count = + this->ACE_Event_Handler::remove_reference (); + + if (debug) + ACE_DEBUG ((LM_DEBUG, + "Reference count after remove_reference() is %d\n", + reference_count)); + + return reference_count; +} + +class Simple_Event_Handler : public ACE_Event_Handler +{ +public: + + Simple_Event_Handler (int notifies); + + ~Simple_Event_Handler (void); + + int handle_input (ACE_HANDLE); + + ACE_Event_Handler::Reference_Count add_reference (void); + + ACE_Event_Handler::Reference_Count remove_reference (void); + + int notifies_; +}; + +Simple_Event_Handler::Simple_Event_Handler (int notifies) + : notifies_ (notifies) +{ + if (debug) + ACE_DEBUG ((LM_DEBUG, + "Simple_Event_Handler()\n")); +} + +Simple_Event_Handler::~Simple_Event_Handler (void) +{ + if (debug) + ACE_DEBUG ((LM_DEBUG, + "~Simple_Event_Handler()\n")); +} + +int +Simple_Event_Handler::handle_input (ACE_HANDLE) +{ + if (debug) + ACE_DEBUG ((LM_DEBUG, + "Simple_Event_Handler::handle_input()\n")); + + this->notifies_--; + + if (this->notifies_ == 0) + delete this; + + return 0; +} + +ACE_Event_Handler::Reference_Count +Simple_Event_Handler::add_reference (void) +{ + // This should not get called. + ACE_ASSERT (0); + return 0; +} + +ACE_Event_Handler::Reference_Count +Simple_Event_Handler::remove_reference (void) +{ + // This should not get called. + ACE_ASSERT (0); + return 0; +} + +class Event_Loop_Thread : public ACE_Task_Base +{ +public: + + Event_Loop_Thread (ACE_Thread_Manager &thread_manager, + ACE_Reactor &reactor, + int extra_iterations_needed); + + int svc (void); + + ACE_Reactor &reactor_; + + int extra_iterations_needed_; +}; + +Event_Loop_Thread::Event_Loop_Thread (ACE_Thread_Manager &thread_manager, + ACE_Reactor &reactor, + int extra_iterations_needed) + : ACE_Task_Base (&thread_manager), + reactor_ (reactor), + extra_iterations_needed_ (extra_iterations_needed) +{ +} + +int +Event_Loop_Thread::svc (void) +{ + int counter = 0; + + // Simply run the event loop. + this->reactor_.owner (ACE_Thread::self ()); + + while (1) + { + counter++; + + if (debug) + ACE_DEBUG ((LM_DEBUG, + "Event Loop iteration %d....\n", + counter)); + + this->reactor_.handle_events (); + + if (counter == + iterations + this->extra_iterations_needed_) + break; + } + + return 0; +} + +void +notify (ACE_Reactor &reactor, + ACE_Event_Handler *event_handler, + int extra_iterations_needed) +{ + ACE_Thread_Manager thread_manager; + + // Create a thread to run the event loop. + Event_Loop_Thread event_loop_thread (thread_manager, + reactor, + extra_iterations_needed); + + int result = + event_loop_thread.activate (); + ACE_ASSERT (result == 0); + + for (int i = 0; + i < iterations; + ++i) + { + ACE_OS::sleep (ACE_Time_Value (0, 500 * 1000)); + + result = reactor.notify (event_handler, + ACE_Event_Handler::READ_MASK); + + ACE_ASSERT (result == 0); + } + + thread_manager.wait (); +} + +template <class REACTOR_IMPLEMENTATION> +class test +{ +public: + test (int extra_iterations_needed); +}; + +template <class REACTOR_IMPLEMENTATION> +test<REACTOR_IMPLEMENTATION>::test (int extra_iterations_needed) +{ + if (test_empty_notify) + { + ACE_DEBUG ((LM_DEBUG, + "\n\nTesting empty notifies....\n\n")); + + REACTOR_IMPLEMENTATION impl; + ACE_Reactor reactor (&impl, 0); + + notify (reactor, + 0, + extra_iterations_needed); + } + + + if (test_simple_notify) + { + ACE_DEBUG ((LM_DEBUG, + "\n\nTesting simple notifies....\n\n")); + + REACTOR_IMPLEMENTATION impl; + ACE_Reactor reactor (&impl, 0); + + Simple_Event_Handler *simple_event_handler = + new Simple_Event_Handler (iterations); + + notify (reactor, + simple_event_handler, + extra_iterations_needed); + } + + if (test_reference_counted_notify) + { + ACE_DEBUG ((LM_DEBUG, + "\n\nTesting reference counted notifies....\n\n")); + + REACTOR_IMPLEMENTATION impl; + ACE_Reactor reactor (&impl, 0); + + Reference_Counted_Event_Handler *reference_counted_event_handler = + new Reference_Counted_Event_Handler; + + ACE_Event_Handler_var safe_event_handler (reference_counted_event_handler); + + notify (reactor, + reference_counted_event_handler, + extra_iterations_needed); + } +} + +static int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("a:b:c:e:f:g:z:")); + + int cc; + while ((cc = get_opt ()) != -1) + { + switch (cc) + { + case 'a': + test_select_reactor = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'b': + test_tp_reactor = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'c': + test_wfmo_reactor = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'e': + test_empty_notify = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'f': + test_simple_notify = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'g': + test_reference_counted_notify = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'z': + debug = ACE_OS::atoi (get_opt.opt_arg ()); + break; + default: + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("\nusage: %s \n\n") + ACE_TEXT ("\t[-a test Select Reactor] (defaults to %d)\n") + ACE_TEXT ("\t[-b test TP Reactor] (defaults to %d)\n") + ACE_TEXT ("\t[-c test WFMO Reactor] (defaults to %d)\n") + ACE_TEXT ("\t[-e test empty notify] (defaults to %d)\n") + ACE_TEXT ("\t[-f test simple notify] (defaults to %d)\n") + ACE_TEXT ("\t[-g test reference counted notify] (defaults to %d)\n") + ACE_TEXT ("\t[-z debug] (defaults to %d)\n") + ACE_TEXT ("\n"), + argv[0], + test_select_reactor, + test_tp_reactor, + test_wfmo_reactor, + test_empty_notify, + test_simple_notify, + test_reference_counted_notify, + debug)); + return -1; + } + } + + return 0; +} + +int +run_main (int argc, ACE_TCHAR *argv[]) +{ + ACE_START_TEST (ACE_TEXT ("MT_Reference_Counted_Notify_Test")); + + // Validate options. + int result = + parse_args (argc, argv); + if (result != 0) + return result; + + int extra_iterations_needed = 1; + int extra_iterations_not_needed = 0; + + if (test_select_reactor) + { + ACE_DEBUG ((LM_DEBUG, + "\n\nTesting Select Reactor....\n\n")); + + test<ACE_Select_Reactor> test (extra_iterations_not_needed); + ACE_UNUSED_ARG (test); + } + + if (test_tp_reactor) + { + ACE_DEBUG ((LM_DEBUG, + "\n\nTesting TP Reactor....\n\n")); + + test<ACE_TP_Reactor> test (extra_iterations_not_needed); + ACE_UNUSED_ARG (test); + } + +#if defined (ACE_WIN32) + + if (test_wfmo_reactor) + { + ACE_DEBUG ((LM_DEBUG, + "\n\nTesting WFMO Reactor....\n\n")); + + test<ACE_WFMO_Reactor> test (extra_iterations_needed); + ACE_UNUSED_ARG (test); + } + +#else /* ACE_WIN32 */ + + ACE_UNUSED_ARG (extra_iterations_needed); + +#endif /* ACE_WIN32 */ + + ACE_END_TEST; + + return 0; +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) +template class test<ACE_Select_Reactor>; +template class test<ACE_TP_Reactor>; +#if defined (ACE_WIN32) +template class test<ACE_WFMO_Reactor>; +#endif /* ACE_WIN32 */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate test<ACE_Select_Reactor> +#pragma instantiate test<ACE_TP_Reactor> +#if defined (ACE_WIN32) +#pragma instantiate test<ACE_WFMO_Reactor> +#endif /* ACE_WIN32 */ +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +#else /* ACE_HAS_THREADS */ + +int +run_main (int, ACE_TCHAR *[]) +{ + ACE_START_TEST (ACE_TEXT ("MT_Reference_Counted_Notify_Test")); + + ACE_ERROR ((LM_INFO, + ACE_TEXT ("threads not supported on this platform\n"))); + + ACE_END_TEST; + + return 0; +} + +#endif /* ACE_HAS_THREADS */ diff --git a/tests/MT_Reference_Counted_Notify_Test.dsp b/tests/MT_Reference_Counted_Notify_Test.dsp new file mode 100644 index 00000000000..fa655e51baf --- /dev/null +++ b/tests/MT_Reference_Counted_Notify_Test.dsp @@ -0,0 +1,158 @@ +# Microsoft Developer Studio Project File - Name="MT_Reference_Counted_Notify_Test" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=MT_Reference_Counted_Notify_Test - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "MT_Reference_Counted_Notify_Test.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "MT_Reference_Counted_Notify_Test.mak" CFG="MT_Reference_Counted_Notify_Test - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "MT_Reference_Counted_Notify_Test - Win32 Static Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE "MT_Reference_Counted_Notify_Test - Win32 Static Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "MT_Reference_Counted_Notify_Test - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "MT_Reference_Counted_Notify_Test - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "MT_Reference_Counted_Notify_Test - Win32 Static Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Static_Debug"
+# PROP BASE Intermediate_Dir "Static_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Static_Debug"
+# PROP Intermediate_Dir "Static_Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../" /D "_DEBUG" /D ACE_AS_STATIC_LIBS /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
+# ADD LINK32 acesd.lib Test_Outputsd.lib advapi32.lib user32.lib /nologo /subsystem:console /debug /machine:I386 /libpath:"..\ace"
+
+!ELSEIF "$(CFG)" == "MT_Reference_Counted_Notify_Test - Win32 Static Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Static_Release"
+# PROP BASE Intermediate_Dir "Static_Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Static_Release"
+# PROP Intermediate_Dir "Static_Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../" /D "NDEBUG" /D ACE_AS_STATIC_LIBS /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 aces.lib Test_Outputs.lib advapi32.lib user32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\ace"
+
+!ELSEIF "$(CFG)" == "MT_Reference_Counted_Notify_Test - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib Test_Output.lib /nologo /subsystem:console /machine:I386 /libpath:"..\ace"
+
+!ELSEIF "$(CFG)" == "MT_Reference_Counted_Notify_Test - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib Test_Outputd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\ace"
+
+!ENDIF
+
+# Begin Target
+
+# Name "MT_Reference_Counted_Notify_Test - Win32 Static Debug"
+# Name "MT_Reference_Counted_Notify_Test - Win32 Static Release"
+# Name "MT_Reference_Counted_Notify_Test - Win32 Release"
+# Name "MT_Reference_Counted_Notify_Test - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter ".cpp"
+# Begin Source File
+
+SOURCE=.\MT_Reference_Counted_Notify_Test.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter ".h"
+# Begin Source File
+
+SOURCE=.\test_config.h
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/tests/Makefile.am b/tests/Makefile.am index 2060e28f099..98764bd46cf 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -96,58 +96,61 @@ noinst_PROGRAMS = \ Basic_Types_Test \ Bound_Ptr_Test \ Buffer_Stream_Test \ - CDR_File_Test \ - CDR_Test \ Cache_Map_Manager_Test \ Cached_Accept_Conn_Test \ Cached_Allocator_Test \ Cached_Conn_Test \ Capabilities_Test \ + CDR_File_Test \ + CDR_Test \ Collection_Test \ Config_Test \ Conn_Test \ - DLL_Test\ - DLList_Test \ Date_Time_Test \ Dev_Poll_Reactor_Test \ Dirent_Test \ + DLL_Test\ + DLList_Test \ Dynamic_Priority_Test \ Enum_Interfaces_Test \ Env_Value_Test \ FIFO_Test \ - Future_Test \ Future_Set_Test \ + Future_Test \ Get_Opt_Test \ Handle_Set_Test \ - Hash_Map_Manager_Test \ Hash_Map_Bucket_Iterator_Test \ + Hash_Map_Manager_Test \ High_Res_Timer_Test \ INET_Addr_Test \ IOStream_Test \ Lazy_Map_Manager_Test \ Log_Msg_Test \ Logging_Strategy_Test \ - MEM_Stream_Test \ - MM_Shared_Memory_Test \ - MT_Reactor_Timer_Test \ - MT_Reactor_Upcall_Test \ - MT_SOCK_Test \ Malloc_Test \ Map_Manager_Test \ Map_Test \ Max_Default_Port_Test \ Mem_Map_Test \ + MEM_Stream_Test \ Message_Block_Test \ Message_Queue_Notifications_Test \ Message_Queue_Test \ Message_Queue_Test_Ex \ + MM_Shared_Memory_Test \ + MT_Reactor_Timer_Test \ + MT_Reactor_Upcall_Test \ + MT_Reference_Counted_Event_Handler_Test \ + MT_Reference_Counted_Notify_Test \ + MT_SOCK_Test \ Multicast_Test \ Multihomed_INET_Addr_Test \ + NonBlocking_Conn_Test \ Notify_Performance_Test \ - OS_Test \ Object_Manager_Test \ Obstack_Test \ OrdMultiSet_Test \ + OS_Test \ Pipe_Test \ Priority_Buffer_Test \ Priority_Reactor_Test \ @@ -155,35 +158,35 @@ noinst_PROGRAMS = \ Proactor_Scatter_Gather_Test \ Proactor_Test \ Proactor_Timer_Test \ + Process_Manager_Test \ Process_Mutex_Test \ Process_Strategy_Test \ - Process_Manager_Test \ RB_Tree_Test \ Reactor_Dispatch_Order_Test \ Reactor_Exceptions_Test \ Reactor_Notify_Test \ Reactor_Performance_Test \ + Reactor_Registration_Test \ Reactor_Timer_Test \ Reactors_Test \ Reader_Writer_Test \ Recursive_Condition_Test \ Recursive_Mutex_Test \ Refcounted_Auto_Ptr_Test \ + Reference_Counted_Event_Handler_Test \ Reverse_Lock_Test \ + Semaphore_Test \ + Service_Config_Test \ + Signal_Test \ + Sigset_Ops_Test \ + Simple_Message_Block_Test \ SOCK_Connector_Test \ SOCK_Send_Recv_Test \ SOCK_Test \ SPIPE_Test \ SString_Test \ SV_Shared_Memory_Test \ - Semaphore_Test \ - Service_Config_Test \ - Signal_Test \ - Sigset_Ops_Test \ - Simple_Message_Block_Test \ Svc_Handler_Test \ - TP_Reactor_Test \ - TSS_Test \ Task_Test \ Thread_Manager_Test \ Thread_Mutex_Test \ @@ -191,12 +194,17 @@ noinst_PROGRAMS = \ Time_Service_Test \ Time_Value_Test \ Timeprobe_Test \ + Timer_Cancellation_Test \ + Timer_Queue_Reference_Counting_Test \ Timer_Queue_Test \ Token_Strategy_Test \ - UPIPE_SAP_Test \ + TP_Reactor_Test \ + TSS_Test \ Unbounded_Set_Test_Ex \ Upgradable_RW_Test \ + UPIPE_SAP_Test \ Vector_Test \ + WFMO_Reactor_Test \ \ Naming_Test \ \ diff --git a/tests/Makefile.tests b/tests/Makefile.tests index 22b8272c81f..00bfc8bf20c 100644 --- a/tests/Makefile.tests +++ b/tests/Makefile.tests @@ -12,117 +12,126 @@ MAKEFILE = Makefile.tests #---------------------------------------------------------------------------- DIRS_PARALLEL = 1 -BIN = ACE_Test \ +BIN = \ + Bound_Ptr_Test \ + Config_Test \ + Dev_Poll_Reactor_Test \ + Dirent_Test \ + Get_Opt_Test \ + Logging_Strategy_Test \ + MEM_Stream_Test \ + Proactor_Scatter_Gather_Test \ + Proactor_Test \ + Proactor_Timer_Test \ + Refcounted_Auto_Ptr_Test \ + Token_Strategy_Test \ + Vector_Test \ + ACE_Test \ + ARGV_Test \ Aio_Platform_Test \ Arg_Shifter_Test \ - ARGV_Test \ Atomic_Op_Test \ Auto_IncDec_Test \ Barrier_Test \ Basic_Types_Test \ - Bound_Ptr_Test \ Buffer_Stream_Test \ + CDR_File_Test \ + CDR_Test \ Cache_Map_Manager_Test \ Cached_Accept_Conn_Test \ Cached_Allocator_Test \ Cached_Conn_Test \ Capabilities_Test \ - CDR_File_Test \ - CDR_Test \ Collection_Test \ - Config_Test \ Conn_Test \ - Date_Time_Test \ - Dev_Poll_Reactor_Test \ - Dirent_Test \ - DLList_Test \ DLL_Test\ + DLList_Test \ + Date_Time_Test \ + Dynamic_Priority_Test \ Enum_Interfaces_Test \ Env_Value_Test \ FIFO_Test \ - Future_Test \ Future_Set_Test \ - Get_Opt_Test \ + Future_Test \ Handle_Set_Test \ - High_Res_Timer_Test \ - Hash_Map_Manager_Test \ Hash_Map_Bucket_Iterator_Test \ + Hash_Map_Manager_Test \ + High_Res_Timer_Test \ INET_Addr_Test \ IOStream_Test \ Lazy_Map_Manager_Test \ Log_Msg_Test \ - Logging_Strategy_Test \ - Malloc_Test \ - Map_Test \ - Map_Manager_Test \ - Max_Default_Port_Test \ - MEM_Stream_Test \ - Mem_Map_Test \ MM_Shared_Memory_Test \ MT_Reactor_Timer_Test \ MT_Reactor_Upcall_Test \ + MT_Reference_Counted_Event_Handler_Test \ + MT_Reference_Counted_Notify_Test \ MT_SOCK_Test \ + Malloc_Test \ + Map_Manager_Test \ + Map_Test \ + Max_Default_Port_Test \ + Mem_Map_Test \ Message_Block_Test \ + Message_Queue_Notifications_Test \ Message_Queue_Test \ Message_Queue_Test_Ex \ - Message_Queue_Notifications_Test \ Multicast_Test \ Multihomed_INET_Addr_Test \ + NonBlocking_Conn_Test \ Notify_Performance_Test \ + OS_Test \ Object_Manager_Test \ Obstack_Test \ OrdMultiSet_Test \ - OS_Test \ - Proactor_Scatter_Gather_Test \ - Proactor_Test \ - Proactor_Timer_Test \ - Process_Mutex_Test \ - Process_Strategy_Test \ + Pipe_Test \ Priority_Buffer_Test \ - Dynamic_Priority_Test \ - Priority_Task_Test \ Priority_Reactor_Test \ + Priority_Task_Test \ Process_Manager_Test \ - Pipe_Test \ + Process_Mutex_Test \ + Process_Strategy_Test \ RB_Tree_Test \ - Reactors_Test \ + Reactor_Dispatch_Order_Test \ Reactor_Exceptions_Test \ Reactor_Notify_Test \ - Reactor_Dispatch_Order_Test \ Reactor_Performance_Test \ + Reactor_Registration_Test \ Reactor_Timer_Test \ + Reactors_Test \ Reader_Writer_Test \ - Recursive_Condition_Test \ Recursive_Condition_Bug_Test \ + Recursive_Condition_Test \ Recursive_Mutex_Test \ - Refcounted_Auto_Ptr_Test \ + Reference_Counted_Event_Handler_Test \ Reverse_Lock_Test \ - Semaphore_Test \ - Signal_Test \ - Sigset_Ops_Test \ - Simple_Message_Block_Test \ - SOCK_Test \ SOCK_Connector_Test \ SOCK_Send_Recv_Test \ + SOCK_Test \ SPIPE_Test \ SString_Test \ SV_Shared_Memory_Test \ + Semaphore_Test \ + Signal_Test \ + Sigset_Ops_Test \ + Simple_Message_Block_Test \ Svc_Handler_Test \ + TP_Reactor_Test \ + TSS_Test \ Task_Test \ Thread_Manager_Test \ Thread_Mutex_Test \ Thread_Pool_Test \ - Timeprobe_Test \ Time_Service_Test \ Time_Value_Test \ + Timeprobe_Test \ + Timer_Cancellation_Test \ + Timer_Queue_Reference_Counting_Test \ Timer_Queue_Test \ - Token_Strategy_Test \ - TP_Reactor_Test \ - TSS_Test \ - Vector_Test \ UPIPE_SAP_Test \ Unbounded_Set_Test_Ex \ - Upgradable_RW_Test + Upgradable_RW_Test \ + WFMO_Reactor_Test BIN2 = Naming_Test \ Thread_Pool_Reactor_Test \ diff --git a/tests/NonBlocking_Conn_Test.cpp b/tests/NonBlocking_Conn_Test.cpp new file mode 100644 index 00000000000..51fae93b03c --- /dev/null +++ b/tests/NonBlocking_Conn_Test.cpp @@ -0,0 +1,349 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// tests +// +// = FILENAME +// NonBlocking_Conn_Test.cpp +// +// = DESCRIPTION +// This test checks for the proper working of the following: +// - blocking connections +// - blocking connections with timeouts +// - non-blocking connections +// - non-blocking connections without waiting for completions +// - non-blocking connections with timeouts +// +// = AUTHOR +// Irfan Pyarali <irfan@oomworks.com> +// +// ============================================================================ + +#include "test_config.h" +#include "ace/Connector.h" +#include "ace/Svc_Handler.h" +#include "ace/SOCK_Stream.h" +#include "ace/SOCK_Connector.h" +#include "ace/Select_Reactor.h" +#include "ace/TP_Reactor.h" +#include "ace/WFMO_Reactor.h" +#include "ace/Get_Opt.h" + +static int test_select_reactor = 1; +static int test_tp_reactor = 1; +static int test_wfmo_reactor = 1; + +class Svc_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> +{ +public: + + enum Connection_Status + { + SUCCEEDED, + FAILED + }; + + Svc_Handler (void); + + void connection_status (Connection_Status &status, + int &completion_counter); + + int open (void *); + + int handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask mask); + + Connection_Status *status_; + int *completion_counter_; +}; + +Svc_Handler::Svc_Handler (void) + : status_ (0), + completion_counter_ (0) +{ +} + +void +Svc_Handler::connection_status (Connection_Status &status, + int &completion_counter) +{ + this->status_ = &status; + this->completion_counter_ = &completion_counter; +} + +int +Svc_Handler::open (void *) +{ + *this->status_ = SUCCEEDED; + (*this->completion_counter_)++; + + return 0; +} + +int +Svc_Handler::handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask mask) +{ + *this->status_ = FAILED; + (*this->completion_counter_)++; + + return ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>::handle_close (handle, + mask); +} + +typedef ACE_Connector<Svc_Handler, + ACE_SOCK_CONNECTOR> + CONNECTOR; + +static const char* hosts[] = { + "www.russiantvguide.com:80", + "www.pakarmy.gov.pk:80", + "www.cnn.com:80", + "www.waca.com.au:80", + "www.uganda.co.ug:80", + "www.cs.wustl.edu:80", + "www.affa-az.com:80", + "www.dhm.gov.np:80", + "www.msn.com:80", + "www.presidencymaldives.gov.mv:80" }; + +static int number_of_connections = 0; + +void +test_connect (ACE_Reactor &reactor, + ACE_INET_Addr *addresses, + ACE_Synch_Options &synch_options, + int complete_nonblocking_connections) +{ + CONNECTOR connector (&reactor); + + int i = 0; + + int completion_counter = 0; + Svc_Handler::Connection_Status *connection_status = + new Svc_Handler::Connection_Status[number_of_connections]; + + Svc_Handler **svc_handlers = + new Svc_Handler *[number_of_connections]; + + for (i = 0; i < number_of_connections; ++i) + { + svc_handlers[i] = + new Svc_Handler; + + svc_handlers[i]->connection_status (connection_status[i], + completion_counter); + } + + connector.connect_n (number_of_connections, + svc_handlers, + addresses, + 0, + synch_options); + + if (!synch_options[ACE_Synch_Options::USE_REACTOR]) + ACE_ASSERT (completion_counter == number_of_connections); + + if (complete_nonblocking_connections) + { + while (completion_counter != number_of_connections) + { + connector.reactor ()->handle_events (); + } + } + + connector.close (); + + for (i = 0; i < number_of_connections; ++i) + { + ACE_TCHAR buffer[1024]; + addresses[i].addr_to_string (buffer, + sizeof buffer, + 1); + + ACE_DEBUG ((LM_DEBUG, + "Connection to %s %s\n", + buffer, + connection_status[i] == Svc_Handler::SUCCEEDED ? + "succeeded" : "failed")); + + if (connection_status[i] == Svc_Handler::SUCCEEDED) + { + svc_handlers[i]->close (); + } + } + + delete[] svc_handlers; + delete[] connection_status; +} + +void +test (ACE_Reactor_Impl *impl) +{ + number_of_connections = sizeof hosts / sizeof (char *); + + ACE_INET_Addr *addresses = + new ACE_INET_Addr[number_of_connections]; + + for (int i = 0; i < number_of_connections; ++i) + { + addresses[i] = ACE_INET_Addr (hosts[i]); + } + + ACE_Reactor reactor (impl, + 1); + + int complete_nonblocking_connections = 1; + int dont_wait_for_nonblocking_connections = 0; + int ignored = 99; + + ACE_Synch_Options blocking_connect = + ACE_Synch_Options::defaults; + + ACE_DEBUG ((LM_DEBUG, + "\nBlocking connections...\n\n")); + + test_connect (reactor, + addresses, + blocking_connect, + ignored); + + blocking_connect.set (ACE_Synch_Options::USE_TIMEOUT, + ACE_Time_Value (0, 50 * 1000)); + + ACE_DEBUG ((LM_DEBUG, + "\nBlocking connections (with timeouts)...\n\n")); + + test_connect (reactor, + addresses, + blocking_connect, + ignored); + + ACE_Synch_Options nonblocking_connect + (ACE_Synch_Options::USE_REACTOR); + + ACE_DEBUG ((LM_DEBUG, + "\nNon-blocking connections...\n\n")); + + test_connect (reactor, + addresses, + nonblocking_connect, + complete_nonblocking_connections); + + ACE_DEBUG ((LM_DEBUG, + "\nNon-blocking connections (without waiting for completions)...\n\n")); + + test_connect (reactor, + addresses, + nonblocking_connect, + dont_wait_for_nonblocking_connections); + + nonblocking_connect.set (ACE_Synch_Options::USE_REACTOR | + ACE_Synch_Options::USE_TIMEOUT, + ACE_Time_Value (0, 500 * 1000)); + + ACE_DEBUG ((LM_DEBUG, + "\nNon-blocking connections (with timeouts)...\n\n")); + + test_connect (reactor, + addresses, + nonblocking_connect, + complete_nonblocking_connections); + + delete[] addresses; +} + +static int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("a:b:c:")); + + int cc; + while ((cc = get_opt ()) != -1) + { + switch (cc) + { + case 'a': + test_select_reactor = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'b': + test_tp_reactor = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'c': + test_wfmo_reactor = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case '?': + case 'u': + default: + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("\nusage: %s \n\n") + ACE_TEXT ("\t[-a test Select Reactor] (defaults to %d)\n") + ACE_TEXT ("\t[-b test TP Reactor] (defaults to %d)\n") + ACE_TEXT ("\t[-c test WFMO Reactor] (defaults to %d)\n") + ACE_TEXT ("\n"), + argv[0], + test_select_reactor, + test_tp_reactor, + test_wfmo_reactor)); + return -1; + } + } + + return 0; +} + +int +run_main (int argc, ACE_TCHAR *argv[]) +{ + ACE_START_TEST (ACE_TEXT ("NonBlocking_Conn_Test")); + + // Validate options. + int result = + parse_args (argc, argv); + if (result != 0) + return result; + + if (test_select_reactor) + { + ACE_DEBUG ((LM_DEBUG, + "\n\nTesting Select Reactor....\n\n")); + + test (new ACE_Select_Reactor); + } + + if (test_tp_reactor) + { + ACE_DEBUG ((LM_DEBUG, + "\n\nTesting TP Reactor....\n\n")); + + test (new ACE_TP_Reactor); + } + +#if defined (ACE_WIN32) + + if (test_wfmo_reactor) + { + ACE_DEBUG ((LM_DEBUG, + "\n\nTesting WFMO Reactor....\n\n")); + + test (new ACE_WFMO_Reactor); + } + +#endif /* ACE_WIN32 */ + + ACE_END_TEST; + + return 0; +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) +template class ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>; +template class ACE_Connector<Svc_Handler, ACE_SOCK_CONNECTOR>; +template class ACE_NonBlocking_Connect_Handler<Svc_Handler>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> +#pragma instantiate ACE_Connector<Svc_Handler, ACE_SOCK_CONNECTOR> +#pragma instantiate ACE_NonBlocking_Connect_Handler<Svc_Handler> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/tests/NonBlocking_Conn_Test.dsp b/tests/NonBlocking_Conn_Test.dsp new file mode 100644 index 00000000000..474a0487911 --- /dev/null +++ b/tests/NonBlocking_Conn_Test.dsp @@ -0,0 +1,162 @@ +# Microsoft Developer Studio Project File - Name="NonBlocking_Conn_Test" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=NonBlocking_Conn_Test - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "NonBlocking_Conn_Test.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "NonBlocking_Conn_Test.mak" CFG="NonBlocking_Conn_Test - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "NonBlocking_Conn_Test - Win32 Static Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE "NonBlocking_Conn_Test - Win32 Static Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "NonBlocking_Conn_Test - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "NonBlocking_Conn_Test - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "NonBlocking_Conn_Test - Win32 Static Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Static_Debug"
+# PROP BASE Intermediate_Dir "Static_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Static_Debug"
+# PROP Intermediate_Dir "Static_Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../" /D "_DEBUG" /D ACE_AS_STATIC_LIBS /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
+# ADD LINK32 acesd.lib Test_Outputsd.lib advapi32.lib user32.lib /nologo /subsystem:console /debug /machine:I386 /libpath:"..\ace"
+
+!ELSEIF "$(CFG)" == "NonBlocking_Conn_Test - Win32 Static Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Static_Release"
+# PROP BASE Intermediate_Dir "Static_Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Static_Release"
+# PROP Intermediate_Dir "Static_Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../" /D "NDEBUG" /D ACE_AS_STATIC_LIBS /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 aces.lib Test_Outputs.lib advapi32.lib user32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\ace"
+
+!ELSEIF "$(CFG)" == "NonBlocking_Conn_Test - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib Test_Output.lib /nologo /subsystem:console /machine:I386 /libpath:"..\ace"
+
+!ELSEIF "$(CFG)" == "NonBlocking_Conn_Test - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib Test_Outputd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\ace"
+
+!ENDIF
+
+# Begin Target
+
+# Name "NonBlocking_Conn_Test - Win32 Static Debug"
+# Name "NonBlocking_Conn_Test - Win32 Static Release"
+# Name "NonBlocking_Conn_Test - Win32 Release"
+# Name "NonBlocking_Conn_Test - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
+# Begin Source File
+
+SOURCE=.\NonBlocking_Conn_Test.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
+# Begin Source File
+
+SOURCE=.\test_config.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/tests/Priority_Reactor_Test.cpp b/tests/Priority_Reactor_Test.cpp index 2def50b07b1..a9c2a31b8c9 100644 --- a/tests/Priority_Reactor_Test.cpp +++ b/tests/Priority_Reactor_Test.cpp @@ -402,12 +402,7 @@ template class auto_ptr<ACE_Reactor>; template class ACE_Auto_Basic_Ptr<ACE_Reactor>; template class auto_ptr<ACE_Select_Reactor>; template class ACE_Auto_Basic_Ptr<ACE_Select_Reactor>; -template class ACE_Map_Manager<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*,ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator_Base<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*,ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*,ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*,ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Entry<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*>; -template class ACE_Svc_Tuple<Write_Handler>; +template class ACE_NonBlocking_Connect_Handler<Write_Handler>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Connector<Write_Handler, ACE_SOCK_CONNECTOR> #pragma instantiate ACE_Acceptor<Read_Handler, ACE_SOCK_ACCEPTOR> @@ -416,10 +411,5 @@ template class ACE_Svc_Tuple<Write_Handler>; #pragma instantiate ACE_Auto_Basic_Ptr<ACE_Reactor> #pragma instantiate auto_ptr<ACE_Select_Reactor> #pragma instantiate ACE_Auto_Basic_Ptr<ACE_Select_Reactor> -#pragma instantiate ACE_Map_Manager<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*,ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*,ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*,ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*,ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Entry<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*> -#pragma instantiate ACE_Svc_Tuple<Write_Handler> +#pragma instantiate ACE_NonBlocking_Connect_Handler<Write_Handler> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/tests/Reactor_Performance_Test.cpp b/tests/Reactor_Performance_Test.cpp index 42ac32da698..bd81efc9dea 100644 --- a/tests/Reactor_Performance_Test.cpp +++ b/tests/Reactor_Performance_Test.cpp @@ -411,12 +411,7 @@ template class auto_ptr<ACE_Reactor>; template class ACE_Auto_Basic_Ptr<ACE_Reactor>; template class auto_ptr<ACE_Reactor_Impl>; template class ACE_Auto_Basic_Ptr<ACE_Reactor_Impl>; -template class ACE_Map_Manager<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*,ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator_Base<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*,ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Iterator<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*,ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Reverse_Iterator<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*,ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Entry<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*>; -template class ACE_Svc_Tuple<Write_Handler>; +template class ACE_NonBlocking_Connect_Handler<Write_Handler>; template class ACE_Auto_Basic_Array_Ptr <Write_Handler *>; template class ACE_Auto_Basic_Array_Ptr <ACE_INET_Addr>; template class ACE_Auto_Array_Ptr <ACE_INET_Addr>; @@ -428,12 +423,7 @@ template class ACE_Auto_Array_Ptr <ACE_INET_Addr>; #pragma instantiate ACE_Auto_Basic_Ptr<ACE_Reactor> #pragma instantiate auto_ptr<ACE_Reactor_Impl> #pragma instantiate ACE_Auto_Basic_Ptr<ACE_Reactor_Impl> -#pragma instantiate ACE_Map_Manager<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*,ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*,ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*,ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*,ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Entry<ACE_HANDLE,ACE_Svc_Tuple<Write_Handler>*> -#pragma instantiate ACE_Svc_Tuple<Write_Handler> +#pragma instantiate ACE_NonBlocking_Connect_Handler<Write_Handler> #pragma instantiate ACE_Auto_Basic_Array_Ptr <Write_Handler *> #pragma instantiate ACE_Auto_Basic_Array_Ptr <ACE_INET_Addr> #pragma instantiate ACE_Auto_Array_Ptr <ACE_INET_Addr> diff --git a/tests/Reactor_Registration_Test.cpp b/tests/Reactor_Registration_Test.cpp new file mode 100644 index 00000000000..4cf25a5e593 --- /dev/null +++ b/tests/Reactor_Registration_Test.cpp @@ -0,0 +1,180 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// tests +// +// = FILENAME +// Reactor_Registration_Test.cpp +// +// = DESCRIPTION +// This is a test of registering handlers with the Reactor. +// +// = AUTHOR +// Irfan Pyarali <irfan@oomworks.com> +// +// ============================================================================ + +#include "tests/test_config.h" +#include "ace/Pipe.h" +#include "ace/Select_Reactor.h" +#include "ace/TP_Reactor.h" +#include "ace/WFMO_Reactor.h" + +ACE_RCSID(tests, Reactor_Registration_Test, "$Id$") + +static const char message[] = "abcdefghijklmnopqrstuvwxyz"; +static const int message_size = 26; +static int iteration = 1; + +class Event_Handler : public ACE_Event_Handler +{ +public: + + Event_Handler (ACE_Reactor &reactor, + ACE_HANDLE read, + ACE_HANDLE write); + + ~Event_Handler (void); + + int handle_input (ACE_HANDLE fd = ACE_INVALID_HANDLE); + + int handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask close_mask); + + ACE_Pipe pipe_; +}; + +Event_Handler::Event_Handler (ACE_Reactor &reactor, + ACE_HANDLE read, + ACE_HANDLE write) + : ACE_Event_Handler (&reactor), + pipe_ (read, write) +{ + int result = 0; + + if (read == ACE_INVALID_HANDLE) + { + result = + this->pipe_.open (); + ACE_ASSERT (result == 0); + ACE_UNUSED_ARG (result); + } + + result = + this->reactor ()->register_handler (this->pipe_.read_handle (), + this, + ACE_Event_Handler::READ_MASK); + ACE_ASSERT (result == 0); + ACE_UNUSED_ARG (result); + + result = + ACE::send_n (this->pipe_.write_handle (), + message, + message_size); + ACE_ASSERT (result == message_size); + ACE_UNUSED_ARG (result); + + ACE_DEBUG ((LM_DEBUG, + "Event_Handler::Event_Handler for %x\n", + this)); +} + +Event_Handler::~Event_Handler (void) +{ + ACE_DEBUG ((LM_DEBUG, + "Event_Handler::~Event_Handler for %x\n", + this)); +} + +int +Event_Handler::handle_input (ACE_HANDLE handle) +{ + char buf[message_size + 1]; + + int result = + ACE::recv_n (handle, + buf, + sizeof buf - 1); + ACE_ASSERT (result == message_size); + ACE_UNUSED_ARG (result); + + buf[message_size] = '\0'; + + ACE_DEBUG ((LM_DEBUG, + "Message %s received for %x\n", + buf, + this)); + + return -1; +} + +int +Event_Handler::handle_close (ACE_HANDLE, + ACE_Reactor_Mask) +{ + switch (iteration) + { + case 1: + new Event_Handler (*this->reactor (), + ACE_INVALID_HANDLE, + ACE_INVALID_HANDLE); + break; + case 2: + new Event_Handler (*this->reactor (), + this->pipe_.read_handle (), + this->pipe_.write_handle ()); + break; + case 3: + this->reactor ()->end_reactor_event_loop (); + break; + } + + iteration++; + delete this; + + return 0; +} + +void +test (ACE_Reactor_Impl &reactor_impl, + const char *reactor_type) +{ + ACE_DEBUG ((LM_DEBUG, + "\nTesting with %s\n\n", + reactor_type)); + + ACE_Reactor reactor (&reactor_impl, + 0); + + new Event_Handler (reactor, + ACE_INVALID_HANDLE, + ACE_INVALID_HANDLE); + + reactor.run_reactor_event_loop (); +} + +int +run_main (int, ACE_TCHAR *[]) +{ + ACE_START_TEST (ACE_TEXT ("Reactor_Registration_Test")); + + iteration = 1; + ACE_Select_Reactor select_reactor; + test (select_reactor, "ACE_Select_Reactor"); + + iteration = 1; + ACE_TP_Reactor tp_reactor; + test (tp_reactor, "ACE_TP_Reactor"); + +#if defined (ACE_WIN32) + iteration = 1; + ACE_WFMO_Reactor wfmo_reactor; + test (wfmo_reactor, "ACE_WFMO_Reactor"); +#endif /* ACE_WIN32 */ + + ACE_END_TEST; + + return 0; +} diff --git a/tests/Reactor_Registration_Test.dsp b/tests/Reactor_Registration_Test.dsp new file mode 100644 index 00000000000..98ebd6058bc --- /dev/null +++ b/tests/Reactor_Registration_Test.dsp @@ -0,0 +1,158 @@ +# Microsoft Developer Studio Project File - Name="Reactor_Registration_Test" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Reactor_Registration_Test - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "Reactor_Registration_Test.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "Reactor_Registration_Test.mak" CFG="Reactor_Registration_Test - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Reactor_Registration_Test - Win32 Static Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE "Reactor_Registration_Test - Win32 Static Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Reactor_Registration_Test - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Reactor_Registration_Test - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Reactor_Registration_Test - Win32 Static Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Static_Debug"
+# PROP BASE Intermediate_Dir "Static_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Static_Debug"
+# PROP Intermediate_Dir "Static_Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../" /D "_DEBUG" /D ACE_AS_STATIC_LIBS /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
+# ADD LINK32 acesd.lib Test_Outputsd.lib advapi32.lib user32.lib /nologo /subsystem:console /debug /machine:I386 /libpath:"..\ace"
+
+!ELSEIF "$(CFG)" == "Reactor_Registration_Test - Win32 Static Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Static_Release"
+# PROP BASE Intermediate_Dir "Static_Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Static_Release"
+# PROP Intermediate_Dir "Static_Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../" /D "NDEBUG" /D ACE_AS_STATIC_LIBS /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 aces.lib Test_Outputs.lib advapi32.lib user32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\ace"
+
+!ELSEIF "$(CFG)" == "Reactor_Registration_Test - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib Test_Output.lib /nologo /subsystem:console /machine:I386 /libpath:"..\ace"
+
+!ELSEIF "$(CFG)" == "Reactor_Registration_Test - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib Test_Outputd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\ace"
+
+!ENDIF
+
+# Begin Target
+
+# Name "Reactor_Registration_Test - Win32 Static Debug"
+# Name "Reactor_Registration_Test - Win32 Static Release"
+# Name "Reactor_Registration_Test - Win32 Release"
+# Name "Reactor_Registration_Test - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter ".cpp"
+# Begin Source File
+
+SOURCE=.\Reactor_Registration_Test.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter ".h"
+# Begin Source File
+
+SOURCE=.\test_config.h
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/tests/Reference_Counted_Event_Handler_Test.cpp b/tests/Reference_Counted_Event_Handler_Test.cpp new file mode 100644 index 00000000000..2b6dbb38955 --- /dev/null +++ b/tests/Reference_Counted_Event_Handler_Test.cpp @@ -0,0 +1,932 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// tests +// +// = FILENAME +// Reference_Counted_Event_Handler_Test.cpp +// +// = DESCRIPTION +// This test is used to check reference counting of the Event +// Handler when it interacts with the Reactor. +// +// = AUTHOR +// Irfan Pyarali <irfan@oomworks.com> +// +// ============================================================================ + +#include "test_config.h" +#include "ace/Select_Reactor.h" +#include "ace/TP_Reactor.h" +#include "ace/WFMO_Reactor.h" +#include "ace/Get_Opt.h" + +ACE_RCSID(tests, Reference_Counted_Event_Handler_Test, "$Id$") + +static const char message[] = "abcdefghijklmnopqrstuvwxyz"; +static const int message_size = 26; +static int test_select_reactor = 1; +static int test_tp_reactor = 1; +static int test_wfmo_reactor = 1; +static int test_io = 1; +static int test_timers = 1; +static int test_simple_event_handler = 1; +static int test_reference_counted_event_handler_1 = 1; +static int test_reference_counted_event_handler_2 = 1; +static int test_closed_in_upcall_event_handler = 1; +static int debug = 1; +static const char *one_second_timeout = "one second timeout"; +static const char *two_second_timeout = "two second timeout"; + +class Reference_Counted_Event_Handler : public ACE_Event_Handler +{ +public: + + Reference_Counted_Event_Handler (int &events); + + ~Reference_Counted_Event_Handler (void); + + int handle_input (ACE_HANDLE); + + int handle_output (ACE_HANDLE); + + int handle_timeout (const ACE_Time_Value &, + const void *); + + int handle_signal (int, siginfo_t *, ucontext_t *); + + int handle_close (ACE_HANDLE, + ACE_Reactor_Mask); + + ACE_Event_Handler::Reference_Count add_reference (void); + + ACE_Event_Handler::Reference_Count remove_reference (void); + + ACE_Pipe pipe_; + + int &events_; + +}; + +Reference_Counted_Event_Handler::Reference_Counted_Event_Handler (int &events) + : events_ (events) +{ + int result = + this->pipe_.open (); + + ACE_ASSERT (result == 0); + ACE_UNUSED_ARG (result); + + this->reference_counting_policy ().value + (ACE_Event_Handler::Reference_Counting_Policy::ENABLED); + + ACE_DEBUG ((LM_DEBUG, + "Reference count in Reference_Counted_Event_Handler() is %d\n", + this->reference_count_.value ())); +} + +Reference_Counted_Event_Handler::~Reference_Counted_Event_Handler (void) +{ + ACE_DEBUG ((LM_DEBUG, + "Reference count in ~Reference_Counted_Event_Handler() is %d\n", + this->reference_count_.value ())); +} + +int +Reference_Counted_Event_Handler::handle_input (ACE_HANDLE) +{ + ACE_DEBUG ((LM_DEBUG, + "Reference count in Reference_Counted_Event_Handler::handle_input() is %d\n", + this->reference_count_.value ())); + + --this->events_; + + char buf[message_size + 1]; + + ssize_t result = + ACE::recv_n (this->pipe_.read_handle (), + buf, + sizeof buf - 1); + + ACE_ASSERT (result == message_size); + + buf[message_size] = '\0'; + + ACE_DEBUG ((LM_DEBUG, + "Message received: %s\n", + buf)); + + return 0; +} + +int +Reference_Counted_Event_Handler::handle_output (ACE_HANDLE) +{ + ACE_DEBUG ((LM_DEBUG, + "Reference count in Reference_Counted_Event_Handler::handle_output() is %d\n", + this->reference_count_.value ())); + + --this->events_; + + ssize_t result = + ACE::send_n (this->pipe_.write_handle (), + message, + message_size); + + ACE_ASSERT (result == message_size); + + // No longer interested in output. + return -1; +} + +int +Reference_Counted_Event_Handler::handle_timeout (const ACE_Time_Value &, + const void *arg) +{ + ACE_DEBUG ((LM_DEBUG, + "Reference count in Reference_Counted_Event_Handler::handle_timeout() for arg = %s is %d\n", + (const char *) arg, + this->reference_count_.value ())); + + --this->events_; + + return 0; +} + +int +Reference_Counted_Event_Handler::handle_signal (int, + siginfo_t *, + ucontext_t *) +{ + return 0; +} + +int +Reference_Counted_Event_Handler::handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask masks) +{ + ACE_DEBUG ((LM_DEBUG, + "Reference_Counted_Event_Handler::handle_close() called with handle = %d and masks = %d. " + "Reference count is %d\n", + handle, + masks, + this->reference_count_.value ())); + + return 0; +} + +ACE_Event_Handler::Reference_Count +Reference_Counted_Event_Handler::add_reference (void) +{ + ACE_Event_Handler::Reference_Count reference_count = + this->ACE_Event_Handler::add_reference (); + + ACE_DEBUG ((LM_DEBUG, + "Reference count after add_reference() is %d\n", + this->reference_count_.value ())); + + return reference_count; +} + +ACE_Event_Handler::Reference_Count +Reference_Counted_Event_Handler::remove_reference (void) +{ + ACE_Event_Handler::Reference_Count reference_count = + this->ACE_Event_Handler::remove_reference (); + + ACE_DEBUG ((LM_DEBUG, + "Reference count after remove_reference() is %d\n", + reference_count)); + + return reference_count; +} + +void +reference_counted_event_handler_test_1 (ACE_Reactor *reactor) +{ + int events = 0; + int result = 0; + + Reference_Counted_Event_Handler *handler = + new Reference_Counted_Event_Handler (events); + + ACE_Event_Handler_var safe_handler (handler); + + if (test_io) + { + result = + reactor->register_handler (handler->pipe_.read_handle (), + handler, + ACE_Event_Handler::READ_MASK); + ACE_ASSERT (result == 0); + + result = + reactor->register_handler (handler->pipe_.write_handle (), + handler, + ACE_Event_Handler::WRITE_MASK); + ACE_ASSERT (result == 0); + + events += 2; + } + + if (test_timers) + { + long timer_id = + reactor->schedule_timer (handler, + one_second_timeout, + 1, + 1); + ACE_ASSERT (timer_id != -1); + + result = + reactor->cancel_timer (timer_id, + 0, + 0); + ACE_ASSERT (result == 1); + + timer_id = + reactor->schedule_timer (handler, + one_second_timeout, + 1, + 1); + ACE_ASSERT (timer_id != -1); + + timer_id = + reactor->schedule_timer (handler, + two_second_timeout, + 2); + ACE_ASSERT (result != -1); + + events += 3; + } + + while (events > 0) + { + result = + reactor->handle_events (); + } +} + +void +reference_counted_event_handler_test_2 (ACE_Reactor *reactor) +{ + int events = 0; + int result = 0; + + if (test_io) + { + Reference_Counted_Event_Handler *handler = + new Reference_Counted_Event_Handler (events); + + ACE_Event_Handler_var safe_handler (handler); + + result = + reactor->register_handler (handler->pipe_.read_handle (), + handler, + ACE_Event_Handler::READ_MASK); + ACE_ASSERT (result == 0); + + result = + reactor->register_handler (handler->pipe_.write_handle (), + handler, + ACE_Event_Handler::WRITE_MASK); + ACE_ASSERT (result == 0); + + events += 2; + } + + if (test_timers) + { + Reference_Counted_Event_Handler *handler = + new Reference_Counted_Event_Handler (events); + + ACE_Event_Handler_var safe_handler (handler); + + long timer_id = + reactor->schedule_timer (handler, + one_second_timeout, + 1, + 1); + ACE_ASSERT (timer_id != -1); + + result = + reactor->cancel_timer (timer_id, + 0, + 0); + ACE_ASSERT (result == 1); + } + + if (test_timers) + { + Reference_Counted_Event_Handler *handler = + new Reference_Counted_Event_Handler (events); + + ACE_Event_Handler_var safe_handler (handler); + + long timer_id = + reactor->schedule_timer (handler, + one_second_timeout, + 1, + 1); + ACE_ASSERT (timer_id != -1); + + timer_id = + reactor->schedule_timer (handler, + two_second_timeout, + 2); + ACE_ASSERT (result != -1); + + events += 3; + } + + while (events > 0) + { + result = + reactor->handle_events (); + } +} + +void +reference_count_1 (ACE_Reactor_Impl *impl) +{ + ACE_Reactor reactor (impl, 1); + + ACE_DEBUG ((LM_DEBUG, + "\nTesting Reference Counted Event Handler Test 1....\n\n")); + + reference_counted_event_handler_test_1 (&reactor); +} + +void +reference_count_2 (ACE_Reactor_Impl *impl) +{ + ACE_Reactor reactor (impl, 1); + + ACE_DEBUG ((LM_DEBUG, + "\nTesting Reference Counted Event Handler Test 2....\n\n")); + + reference_counted_event_handler_test_2 (&reactor); +} + +class Simple_Event_Handler : public ACE_Event_Handler +{ +public: + + Simple_Event_Handler (int &events, + int close_count); + + ~Simple_Event_Handler (void); + + int handle_input (ACE_HANDLE); + + int handle_output (ACE_HANDLE); + + int handle_timeout (const ACE_Time_Value &, + const void *); + + int handle_signal (int, siginfo_t *, ucontext_t *); + + int handle_close (ACE_HANDLE, + ACE_Reactor_Mask); + + ACE_Event_Handler::Reference_Count add_reference (void); + + ACE_Event_Handler::Reference_Count remove_reference (void); + + ACE_Pipe pipe_; + + int &events_; + + int close_count_; + +}; + +Simple_Event_Handler::Simple_Event_Handler (int &events, + int close_count) + : events_ (events), + close_count_ (close_count) +{ + int result = + this->pipe_.open (); + + ACE_ASSERT (result == 0); + ACE_UNUSED_ARG (result); + + ACE_DEBUG ((LM_DEBUG, + "Simple_Event_Handler()\n")); +} + +Simple_Event_Handler::~Simple_Event_Handler (void) +{ + ACE_DEBUG ((LM_DEBUG, + "~Simple_Event_Handler()\n")); +} + +int +Simple_Event_Handler::handle_input (ACE_HANDLE) +{ + ACE_DEBUG ((LM_DEBUG, + "Simple_Event_Handler::handle_input()\n")); + + --this->events_; + + char buf[message_size + 1]; + + ssize_t result = + ACE::recv_n (this->pipe_.read_handle (), + buf, + sizeof buf - 1); + + ACE_ASSERT (result == message_size); + + buf[message_size] = '\0'; + + ACE_DEBUG ((LM_DEBUG, + "Message received: %s\n", + buf)); + + return 0; +} + +int +Simple_Event_Handler::handle_output (ACE_HANDLE) +{ + ACE_DEBUG ((LM_DEBUG, + "Simple_Event_Handler::handle_output()\n")); + + --this->events_; + + ssize_t result = + ACE::send_n (this->pipe_.write_handle (), + message, + message_size); + + ACE_ASSERT (result == message_size); + + // No longer interested in output. + return -1; +} + +int +Simple_Event_Handler::handle_timeout (const ACE_Time_Value &, + const void *arg) +{ + ACE_DEBUG ((LM_DEBUG, + "Simple_Event_Handler::handle_timeout() for arg = %s\n", + (const char *) arg)); + + --this->events_; + + return 0; +} + +int +Simple_Event_Handler::handle_signal (int, + siginfo_t *, + ucontext_t *) +{ + return 0; +} + +int +Simple_Event_Handler::handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask masks) +{ + ACE_DEBUG ((LM_DEBUG, + "Simple_Event_Handler::handle_close() called with handle = %d and masks = %d with close count = %d.\n", + handle, + masks, + --this->close_count_)); + + if (this->close_count_ == 0) + delete this; + + return 0; +} + +ACE_Event_Handler::Reference_Count +Simple_Event_Handler::add_reference (void) +{ + // This should not get called. + ACE_ASSERT (0); + return 0; +} + +ACE_Event_Handler::Reference_Count +Simple_Event_Handler::remove_reference (void) +{ + // This should not get called. + ACE_ASSERT (0); + return 0; +} + +void +simple_event_handler (ACE_Reactor *reactor) +{ + int events = 0; + int result = 0; + + if (test_io) + { + Simple_Event_Handler *handler = + new Simple_Event_Handler (events, + 2); + + result = + reactor->register_handler (handler->pipe_.read_handle (), + handler, + ACE_Event_Handler::READ_MASK); + ACE_ASSERT (result == 0); + + result = + reactor->register_handler (handler->pipe_.write_handle (), + handler, + ACE_Event_Handler::WRITE_MASK); + ACE_ASSERT (result == 0); + + events += 2; + } + + if (test_timers) + { + Simple_Event_Handler *handler = + new Simple_Event_Handler (events, + 1); + + long timer_id = + reactor->schedule_timer (handler, + one_second_timeout, + 1, + 1); + ACE_ASSERT (timer_id != -1); + + result = + reactor->cancel_timer (timer_id, + 0, + 0); + ACE_ASSERT (result == 1); + } + + if (test_timers) + { + Simple_Event_Handler *handler = + new Simple_Event_Handler (events, + 1); + + long timer_id = + reactor->schedule_timer (handler, + one_second_timeout, + 1, + 1); + ACE_ASSERT (timer_id != -1); + + timer_id = + reactor->schedule_timer (handler, + two_second_timeout, + 2); + ACE_ASSERT (result != -1); + + events += 3; + } + + while (events > 0) + { + result = + reactor->handle_events (); + } +} + +void +simple (ACE_Reactor_Impl *impl) +{ + ACE_Reactor reactor (impl, 1); + + ACE_DEBUG ((LM_DEBUG, + "\nTesting Simple Event Handler....\n\n")); + + simple_event_handler (&reactor); +} + +class Closed_In_Upcall_Event_Handler : public ACE_Event_Handler +{ +public: + + Closed_In_Upcall_Event_Handler (int &events); + + ~Closed_In_Upcall_Event_Handler (void); + + int handle_input (ACE_HANDLE); + + int handle_close (ACE_HANDLE, + ACE_Reactor_Mask); + + ACE_Event_Handler::Reference_Count add_reference (void); + + ACE_Event_Handler::Reference_Count remove_reference (void); + + ACE_Pipe pipe_; + + int &events_; + +}; + +Closed_In_Upcall_Event_Handler::Closed_In_Upcall_Event_Handler (int &events) + : events_ (events) +{ + int result = + this->pipe_.open (); + + ACE_ASSERT (result == 0); + ACE_UNUSED_ARG (result); + + this->reference_counting_policy ().value + (ACE_Event_Handler::Reference_Counting_Policy::ENABLED); + + ACE_DEBUG ((LM_DEBUG, + "Closed_In_Upcall_Event_Handler()\n")); +} + +Closed_In_Upcall_Event_Handler::~Closed_In_Upcall_Event_Handler (void) +{ + ACE_DEBUG ((LM_DEBUG, + "~Closed_In_Upcall_Event_Handler()\n")); +} + +int +Closed_In_Upcall_Event_Handler::handle_input (ACE_HANDLE) +{ + ACE_DEBUG ((LM_DEBUG, + "Closed_In_Upcall_Event_Handler::handle_input()\n")); + + this->events_--; + + int result = + this->reactor ()->remove_handler (this->pipe_.read_handle (), + ACE_Event_Handler::ALL_EVENTS_MASK); + ACE_ASSERT (result == 0); + ACE_UNUSED_ARG (result); + + char buf[message_size + 1]; + + ssize_t recv_result = + ACE::recv_n (this->pipe_.read_handle (), + buf, + sizeof buf - 1); + + ACE_ASSERT (recv_result == message_size); + + buf[message_size] = '\0'; + + ACE_DEBUG ((LM_DEBUG, + "Message received: %s\n", + buf)); + + return 0; +} + +int +Closed_In_Upcall_Event_Handler::handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask masks) +{ + ACE_DEBUG ((LM_DEBUG, + "Closed_In_Upcall_Event_Handler::handle_close() called with handle = %d and masks = %d. " + "Reference count is %d\n", + handle, + masks, + this->reference_count_.value ())); + + return 0; +} + +ACE_Event_Handler::Reference_Count +Closed_In_Upcall_Event_Handler::add_reference (void) +{ + ACE_Event_Handler::Reference_Count reference_count = + this->ACE_Event_Handler::add_reference (); + + ACE_DEBUG ((LM_DEBUG, + "Reference count after add_reference() is %d\n", + this->reference_count_.value ())); + + return reference_count; +} + +ACE_Event_Handler::Reference_Count +Closed_In_Upcall_Event_Handler::remove_reference (void) +{ + ACE_Event_Handler::Reference_Count reference_count = + this->ACE_Event_Handler::remove_reference (); + + ACE_DEBUG ((LM_DEBUG, + "Reference count after remove_reference() is %d\n", + reference_count)); + + return reference_count; +} + +void +closed_in_upcall_event_handler (ACE_Reactor *reactor) +{ + int events = 0; + int result = 0; + + if (test_io) + { + Closed_In_Upcall_Event_Handler *handler = + new Closed_In_Upcall_Event_Handler (events); + + ACE_Event_Handler_var safe_handler (handler); + + ssize_t result = + ACE::send_n (handler->pipe_.write_handle (), + message, + message_size); + + ACE_ASSERT (result == message_size); + + result = + reactor->register_handler (handler->pipe_.read_handle (), + handler, + ACE_Event_Handler::READ_MASK); + ACE_ASSERT (result == 0); + + events += 1; + } + + while (events > 0) + { + result = + reactor->handle_events (); + } +} + +void +closed_in_upcall (ACE_Reactor_Impl *impl) +{ + ACE_Reactor reactor (impl, 1); + + ACE_DEBUG ((LM_DEBUG, + "\nTesting Closed in Upcall Event Handler....\n\n")); + + closed_in_upcall_event_handler (&reactor); +} + +template <class REACTOR_IMPLEMENTATION> +class test +{ +public: + test (void); +}; + +template <class REACTOR_IMPLEMENTATION> +test<REACTOR_IMPLEMENTATION>::test (void) +{ + if (test_simple_event_handler) + simple (new REACTOR_IMPLEMENTATION); + + if (test_reference_counted_event_handler_1) + reference_count_1 (new REACTOR_IMPLEMENTATION); + + if (test_reference_counted_event_handler_2) + reference_count_2 (new REACTOR_IMPLEMENTATION); + + if (test_closed_in_upcall_event_handler) + closed_in_upcall (new REACTOR_IMPLEMENTATION); +} + +static int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("a:b:c:f:g:h:i:k:l:z:")); + + int cc; + while ((cc = get_opt ()) != -1) + { + switch (cc) + { + case 'a': + test_select_reactor = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'b': + test_tp_reactor = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'c': + test_wfmo_reactor = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'f': + test_simple_event_handler = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'g': + test_reference_counted_event_handler_1 = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'h': + test_reference_counted_event_handler_2 = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'i': + test_closed_in_upcall_event_handler = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'k': + test_io = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'l': + test_timers = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'z': + debug = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case '?': + case 'u': + default: + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("\nusage: %s \n\n") + ACE_TEXT ("\t[-a test Select Reactor] (defaults to %d)\n") + ACE_TEXT ("\t[-b test TP Reactor] (defaults to %d)\n") + ACE_TEXT ("\t[-c test WFMO Reactor] (defaults to %d)\n") + ACE_TEXT ("\t[-f test simple event handler] (defaults to %d)\n") + ACE_TEXT ("\t[-g test reference counted event handler (first test)] (defaults to %d)\n") + ACE_TEXT ("\t[-h test reference counted event handler (second test)] (defaults to %d)\n") + ACE_TEXT ("\t[-i test closed in upcall event handler] (defaults to %d)\n") + ACE_TEXT ("\t[-k test io] (defaults to %d)\n") + ACE_TEXT ("\t[-l test timers] (defaults to %d)\n") + ACE_TEXT ("\t[-z debug] (defaults to %d)\n") + ACE_TEXT ("\n"), + argv[0], + test_select_reactor, + test_tp_reactor, + test_wfmo_reactor, + test_simple_event_handler, + test_reference_counted_event_handler_1, + test_reference_counted_event_handler_2, + test_closed_in_upcall_event_handler, + test_io, + test_timers, + debug)); + return -1; + } + } + + return 0; +} + +int +run_main (int argc, ACE_TCHAR *argv[]) +{ + ACE_START_TEST (ACE_TEXT ("Reference_Counted_Event_Handler_Test")); + + // Validate options. + int result = + parse_args (argc, argv); + if (result != 0) + return result; + + if (test_select_reactor) + { + ACE_DEBUG ((LM_DEBUG, + "\n\nTesting Select Reactor....\n\n")); + + test<ACE_Select_Reactor> test; + ACE_UNUSED_ARG (test); + } + + if (test_tp_reactor) + { + ACE_DEBUG ((LM_DEBUG, + "\n\nTesting TP Reactor....\n\n")); + + test<ACE_TP_Reactor> test; + ACE_UNUSED_ARG (test); + } + +#if defined (ACE_WIN32) + + if (test_wfmo_reactor) + { + ACE_DEBUG ((LM_DEBUG, + "\n\nTesting WFMO Reactor....\n\n")); + + test<ACE_WFMO_Reactor> test; + ACE_UNUSED_ARG (test); + } + +#endif /* ACE_WIN32 */ + + ACE_END_TEST; + + return 0; +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) +template class test<ACE_Select_Reactor>; +template class test<ACE_TP_Reactor>; +#if defined (ACE_WIN32) +template class test<ACE_WFMO_Reactor>; +#endif /* ACE_WIN32 */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate test<ACE_Select_Reactor> +#pragma instantiate test<ACE_TP_Reactor> +#if defined (ACE_WIN32) +#pragma instantiate test<ACE_WFMO_Reactor> +#endif /* ACE_WIN32 */ +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/tests/Reference_Counted_Event_Handler_Test.dsp b/tests/Reference_Counted_Event_Handler_Test.dsp new file mode 100644 index 00000000000..f5b3010ed2f --- /dev/null +++ b/tests/Reference_Counted_Event_Handler_Test.dsp @@ -0,0 +1,158 @@ +# Microsoft Developer Studio Project File - Name="Reference_Counted_Event_Handler_Test" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Reference_Counted_Event_Handler_Test - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "Reference_Counted_Event_Handler_Test.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "Reference_Counted_Event_Handler_Test.mak" CFG="Reference_Counted_Event_Handler_Test - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Reference_Counted_Event_Handler_Test - Win32 Static Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE "Reference_Counted_Event_Handler_Test - Win32 Static Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Reference_Counted_Event_Handler_Test - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Reference_Counted_Event_Handler_Test - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Reference_Counted_Event_Handler_Test - Win32 Static Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Static_Debug"
+# PROP BASE Intermediate_Dir "Static_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Static_Debug"
+# PROP Intermediate_Dir "Static_Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../" /D "_DEBUG" /D ACE_AS_STATIC_LIBS /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
+# ADD LINK32 acesd.lib Test_Outputsd.lib advapi32.lib user32.lib /nologo /subsystem:console /debug /machine:I386 /libpath:"..\ace"
+
+!ELSEIF "$(CFG)" == "Reference_Counted_Event_Handler_Test - Win32 Static Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Static_Release"
+# PROP BASE Intermediate_Dir "Static_Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Static_Release"
+# PROP Intermediate_Dir "Static_Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../" /D "NDEBUG" /D ACE_AS_STATIC_LIBS /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 aces.lib Test_Outputs.lib advapi32.lib user32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\ace"
+
+!ELSEIF "$(CFG)" == "Reference_Counted_Event_Handler_Test - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib Test_Output.lib /nologo /subsystem:console /machine:I386 /libpath:"..\ace"
+
+!ELSEIF "$(CFG)" == "Reference_Counted_Event_Handler_Test - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib Test_Outputd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\ace"
+
+!ENDIF
+
+# Begin Target
+
+# Name "Reference_Counted_Event_Handler_Test - Win32 Static Debug"
+# Name "Reference_Counted_Event_Handler_Test - Win32 Static Release"
+# Name "Reference_Counted_Event_Handler_Test - Win32 Release"
+# Name "Reference_Counted_Event_Handler_Test - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter ".cpp"
+# Begin Source File
+
+SOURCE=.\Reference_Counted_Event_Handler_Test.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter ".h"
+# Begin Source File
+
+SOURCE=.\test_config.h
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/tests/TP_Reactor_Test.cpp b/tests/TP_Reactor_Test.cpp index f5a984329a3..1bf257190de 100644 --- a/tests/TP_Reactor_Test.cpp +++ b/tests/TP_Reactor_Test.cpp @@ -1137,24 +1137,14 @@ disable_signal (int sigmin, int sigmax) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Svc_Tuple<Sender>; -template class ACE_Map_Manager<int, ACE_Svc_Tuple<Sender> *, ACE_RW_Thread_Mutex >; -template class ACE_Map_Entry<int, ACE_Svc_Tuple<Sender> * >; -template class ACE_Map_Iterator<int, ACE_Svc_Tuple<Sender> *, ACE_RW_Thread_Mutex >; -template class ACE_Map_Reverse_Iterator<int, ACE_Svc_Tuple<Sender> *, ACE_RW_Thread_Mutex >; -template class ACE_Map_Iterator_Base<int, ACE_Svc_Tuple<Sender> *, ACE_RW_Thread_Mutex >; +template class ACE_NonBlocking_Connect_Handler<Sender>; template class ACE_Connector<Sender,ACE_SOCK_CONNECTOR>; template class ACE_Acceptor<Receiver,ACE_SOCK_ACCEPTOR>; template class ACE_Svc_Handler<ACE_SOCK_STREAM,ACE_MT_SYNCH>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Svc_Tuple<Sender> -#pragma instantiate ACE_Map_Manager<int, ACE_Svc_Tuple<Sender> *, ACE_RW_Thread_Mutex > -#pragma instantiate ACE_Map_Entry<int, ACE_Svc_Tuple<Sender> * > -#pragma instantiate ACE_Map_Iterator<int, ACE_Svc_Tuple<Sender> *, ACE_RW_Thread_Mutex > -#pragma instantiate ACE_Map_Reverse_Iterator<int, ACE_Svc_Tuple<Sender> *, ACE_RW_Thread_Mutex > -#pragma instantiate ACE_Map_Iterator_Base<int, ACE_Svc_Tuple<Sender> *, ACE_RW_Thread_Mutex > +#pragma instantiate ACE_NonBlocking_Connect_Handler<Sender> #pragma instantiate ACE_Connector<Sender,ACE_SOCK_CONNECTOR> #pragma instantiate ACE_Acceptor<Receiver,ACE_SOCK_ACCEPTOR> #pragma instantiate ACE_Svc_Handler<ACE_SOCK_STREAM,ACE_MT_SYNCH> diff --git a/tests/Tests.bor b/tests/Tests.bor index 48dcca6e302..5ea476caecc 100644 --- a/tests/Tests.bor +++ b/tests/Tests.bor @@ -5,126 +5,135 @@ NAMES = \ ACE_Test \ - Aio_Platform_Test \ + ARGV_Test \ + Aio_Platform_Test \ Arg_Shifter_Test \ - ARGV_Test \ - Atomic_Op_Test \ - Auto_IncDec_Test \ - Barrier_Test \ - Basic_Types_Test \ + Atomic_Op_Test \ + Auto_IncDec_Test \ + Barrier_Test \ + Basic_Types_Test \ Bound_Ptr_Test \ - Buffer_Stream_Test \ - Cache_Map_Manager_Test \ - Cached_Accept_Conn_Test \ + Buffer_Stream_Test \ + CDR_Array_Test \ + CDR_File_Test \ + CDR_Test \ + Cache_Map_Manager_Test \ + Cached_Accept_Conn_Test \ Cached_Allocator_Test \ - Cached_Conn_Test \ - Capabilities_Test \ - CDR_Array_Test \ - CDR_File_Test \ - CDR_Test \ - Codecs_Test \ - Collection_Test \ - Conn_Test \ - Config_Test \ + Cached_Conn_Test \ + Capabilities_Test \ + Codecs_Test \ + Collection_Test \ + Config_Test \ + Conn_Test \ + DLL_Test \ + DLList_Test \ Date_Time_Test \ - Dirent_Test \ - DLL_Test \ - DLList_Test \ - Dynamic_Priority_Test \ - Enum_Interfaces_Test \ - Env_Value_Test \ - FlReactor_Test \ + Dirent_Test \ + Dynamic_Priority_Test \ + Enum_Interfaces_Test \ + Env_Value_Test \ + FlReactor_Test \ Framework_Component_Test \ - Future_Set_Test \ - Future_Test \ - Get_Opt_Test \ - Handle_Set_Test \ - Hash_Map_Bucket_Iterator_Test \ - Hash_Map_Manager_Test \ - High_Res_Timer_Test \ - INET_Addr_Test \ - IOStream_Test \ - Lazy_Map_Manager_Test \ - Log_Msg_Test \ - Logging_Strategy_Test \ - Malloc_Test \ - Map_Manager_Test \ - Map_Test \ - Max_Default_Port_Test \ - MEM_Stream_Test \ - Mem_Map_Test \ - Message_Block_Test \ - Message_Queue_Notifications_Test \ - Message_Queue_Test \ - Message_Queue_Test_Ex \ - MM_Shared_Memory_Test \ - MT_Reactor_Timer_Test \ - MT_Reactor_Upcall_Test \ - MT_SOCK_Test \ - Multicast_Test \ - Multihomed_INET_Addr_Test \ - Naming_Test \ - New_Fail_Test \ - Notify_Performance_Test \ - Object_Manager_Test \ - Obstack_Test \ - OrdMultiSet_Test \ - OS_Test \ - Pipe_Test \ - Proactor_Scatter_Gather_Test \ - Proactor_Test \ - Proactor_Timer_Test \ - Priority_Buffer_Test \ - Priority_Reactor_Test \ - Priority_Task_Test \ - Process_Manager_Test \ - Process_Mutex_Test \ - Process_Strategy_Test \ - RB_Tree_Test \ - Reactor_Exceptions_Test \ - Reactor_Notify_Test \ - Reactor_Dispatch_Order_Test \ - Reactor_Performance_Test \ - Reactor_Timer_Test \ - Reactors_Test \ - Reader_Writer_Test \ - Recursive_Condition_Test \ - Recursive_Condition_Bug_Test \ - Recursive_Mutex_Test \ - Refcounted_Auto_Ptr_Test \ - Reverse_Lock_Test \ - Semaphore_Test \ - Service_Config_Test \ - Signal_Test \ - Sigset_Ops_Test \ - Simple_Message_Block_Test \ - SOCK_Connector_Test \ - SOCK_Send_Recv_Test \ - SOCK_Test \ - SPIPE_Test \ - SString_Test \ - SV_Shared_Memory_Test \ - Svc_Handler_Test \ - Task_Test \ - Thread_Manager_Test \ - Thread_Mutex_Test \ - Thread_Pool_Reactor_Test \ - Thread_Pool_Reactor_Resume_Test \ - Thread_Pool_Test \ - Time_Service_Test \ - Time_Value_Test \ - Timeprobe_Test \ - Timer_Queue_Test \ - TkReactor_Test \ - Tokens_Test \ - Token_Strategy_Test \ - TP_Reactor_Test \ - TSS_Test \ - Vector_Test \ - Unbounded_Set_Test_Ex \ - Upgradable_RW_Test \ - UPIPE_SAP_Test \ - XtReactor_Test + Future_Set_Test \ + Future_Test \ + Get_Opt_Test \ + Handle_Set_Test \ + Hash_Map_Bucket_Iterator_Test \ + Hash_Map_Manager_Test \ + High_Res_Timer_Test \ + INET_Addr_Test \ + IOStream_Test \ + Lazy_Map_Manager_Test \ + Log_Msg_Test \ + Logging_Strategy_Test \ + MEM_Stream_Test \ + MM_Shared_Memory_Test \ + MT_Reactor_Timer_Test \ + MT_Reactor_Upcall_Test \ + MT_Reference_Counted_Event_Handler_Test \ + MT_Reference_Counted_Notify_Test \ + MT_SOCK_Test \ + Malloc_Test \ + Map_Manager_Test \ + Map_Test \ + Max_Default_Port_Test \ + Mem_Map_Test \ + Message_Block_Test \ + Message_Queue_Notifications_Test \ + Message_Queue_Test \ + Message_Queue_Test_Ex \ + Multicast_Test \ + Multihomed_INET_Addr_Test \ + Naming_Test \ + New_Fail_Test \ + NonBlocking_Conn_Test \ + Notify_Performance_Test \ + OS_Test \ + Object_Manager_Test \ + Obstack_Test \ + OrdMultiSet_Test \ + Pipe_Test \ + Priority_Buffer_Test \ + Priority_Reactor_Test \ + Priority_Task_Test \ + Proactor_Scatter_Gather_Test \ + Proactor_Test \ + Proactor_Timer_Test \ + Process_Manager_Test \ + Process_Mutex_Test \ + Process_Strategy_Test \ + RB_Tree_Test \ + Reactor_Dispatch_Order_Test \ + Reactor_Exceptions_Test \ + Reactor_Notify_Test \ + Reactor_Performance_Test \ + Reactor_Registration_Test \ + Reactor_Timer_Test \ + Reactors_Test \ + Reader_Writer_Test \ + Recursive_Condition_Bug_Test \ + Recursive_Condition_Test \ + Recursive_Mutex_Test \ + Refcounted_Auto_Ptr_Test \ + Reference_Counted_Event_Handler_Test \ + Reverse_Lock_Test \ + SOCK_Connector_Test \ + SOCK_Send_Recv_Test \ + SOCK_Test \ + SPIPE_Test \ + SString_Test \ + SV_Shared_Memory_Test \ + Semaphore_Test \ + Service_Config_Test \ + Signal_Test \ + Sigset_Ops_Test \ + Simple_Message_Block_Test \ + Svc_Handler_Test \ + TP_Reactor_Test \ + TSS_Test \ + Task_Test \ + Thread_Manager_Test \ + Thread_Mutex_Test \ + Thread_Pool_Reactor_Resume_Test \ + Thread_Pool_Reactor_Test \ + Thread_Pool_Test \ + Time_Service_Test \ + Time_Value_Test \ + Timeprobe_Test \ + Timer_Cancellation_Test \ + Timer_Queue_Reference_Counting_Test \ + Timer_Queue_Test \ + TkReactor_Test \ + Token_Strategy_Test \ + Tokens_Test \ + UPIPE_SAP_Test \ + Unbounded_Set_Test_Ex \ + Upgradable_RW_Test \ + Vector_Test \ + WFMO_Reactor_Test \ + XtReactor_Test + !ifdef SSL_ROOT DIRS = RMCast \ diff --git a/tests/Timer_Cancellation_Test.cpp b/tests/Timer_Cancellation_Test.cpp new file mode 100644 index 00000000000..e750a44a13c --- /dev/null +++ b/tests/Timer_Cancellation_Test.cpp @@ -0,0 +1,160 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// tests +// +// = FILENAME +// Timer_Cancellation_Test.cpp +// +// = DESCRIPTION +// A test to ensure the timer cancellation works correctly. +// +// = AUTHOR +// Irfan Pyarali <irfan@oomworks.com> +// +// ============================================================================ + +#include "tests/test_config.h" +#include "ace/TP_Reactor.h" +#include "ace/Task.h" + +ACE_RCSID(tests, Timer_Cancellation_Test, "$Id$") + +#if defined (ACE_HAS_THREADS) + +class Deadlock : public ACE_Task_Base +{ +public: + + int svc (void); + + int handle_timeout (const ACE_Time_Value ¤t_time, + const void *act); +}; + +int +Deadlock::svc (void) +{ + ACE_DEBUG ((LM_DEBUG, + "Deadlock starts accessing Reactor and Timer Queue....\n")); + + this->reactor ()->schedule_timer (this, + 0, + ACE_Time_Value (1)); + + ACE_DEBUG ((LM_DEBUG, + "Deadlock completes accessing Reactor and Timer Queue....\n")); + + return 0; +} + +int +Deadlock::handle_timeout (const ACE_Time_Value &, + const void *) +{ + ACE_DEBUG ((LM_DEBUG, + "Deadlock timeout\n")); + + return 0; +} + +class Event_Handler : public ACE_Event_Handler +{ +public: + + Event_Handler (Deadlock &deadlock); + + int handle_timeout (const ACE_Time_Value ¤t_time, + const void *act); + + int handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask close_mask); + + Deadlock &deadlock_; +}; + +Event_Handler::Event_Handler (Deadlock &deadlock) + : deadlock_ (deadlock) +{ +} + +int +Event_Handler::handle_timeout (const ACE_Time_Value &, + const void *) +{ + ACE_DEBUG ((LM_DEBUG, + "Event_Handler timeout\n")); + + return -1; +} + +int +Event_Handler::handle_close (ACE_HANDLE, + ACE_Reactor_Mask) +{ + ACE_DEBUG ((LM_DEBUG, + "Event_Handler closed\n")); + + // Activate Deadlock. + this->deadlock_.activate (); + + // Give Deadlock a chance to deadlock... ;-) + ACE_OS::sleep (1); + + ACE_DEBUG ((LM_DEBUG, + "Event Handler starts accessing Reactor....\n")); + + // This is a superfluous call to the Reactor to acquire its lock. + this->reactor ()->max_notify_iterations (); + + ACE_DEBUG ((LM_DEBUG, + "Event Handler completes accessing Reactor....\n")); + + return 0; +} + +int +run_main (int, ACE_TCHAR *[]) +{ + ACE_START_TEST (ACE_TEXT ("Timer_Cancellation_Test")); + + ACE_Reactor reactor (new ACE_TP_Reactor, + 1); + + Deadlock deadlock; + deadlock.reactor (&reactor); + + Event_Handler handler (deadlock); + + // Scheduler a timer to kick things off. + reactor.schedule_timer (&handler, + 0, + ACE_Time_Value (1)); + + // Run the event loop for a while. + ACE_Time_Value timeout (4); + reactor.run_reactor_event_loop (timeout); + + ACE_END_TEST; + + return 0; +} + +#else /* ACE_HAS_THREADS */ + +int +run_main (int, ACE_TCHAR *[]) +{ + ACE_START_TEST (ACE_TEXT ("Timer_Cancellation_Test")); + + ACE_ERROR ((LM_INFO, + ACE_TEXT ("threads not supported on this platform\n"))); + + ACE_END_TEST; + + return 0; +} + +#endif /* ACE_HAS_THREADS */ diff --git a/tests/Timer_Cancellation_Test.dsp b/tests/Timer_Cancellation_Test.dsp new file mode 100644 index 00000000000..68e4efb8023 --- /dev/null +++ b/tests/Timer_Cancellation_Test.dsp @@ -0,0 +1,158 @@ +# Microsoft Developer Studio Project File - Name="Timer_Cancellation_Test" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Timer_Cancellation_Test - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "Timer_Cancellation_Test.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "Timer_Cancellation_Test.mak" CFG="Timer_Cancellation_Test - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Timer_Cancellation_Test - Win32 Static Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE "Timer_Cancellation_Test - Win32 Static Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Timer_Cancellation_Test - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Timer_Cancellation_Test - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Timer_Cancellation_Test - Win32 Static Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Static_Debug"
+# PROP BASE Intermediate_Dir "Static_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Static_Debug"
+# PROP Intermediate_Dir "Static_Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../" /D "_DEBUG" /D ACE_AS_STATIC_LIBS /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
+# ADD LINK32 acesd.lib Test_Outputsd.lib advapi32.lib user32.lib /nologo /subsystem:console /debug /machine:I386 /libpath:"..\ace"
+
+!ELSEIF "$(CFG)" == "Timer_Cancellation_Test - Win32 Static Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Static_Release"
+# PROP BASE Intermediate_Dir "Static_Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Static_Release"
+# PROP Intermediate_Dir "Static_Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../" /D "NDEBUG" /D ACE_AS_STATIC_LIBS /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 aces.lib Test_Outputs.lib advapi32.lib user32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\ace"
+
+!ELSEIF "$(CFG)" == "Timer_Cancellation_Test - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib Test_Output.lib /nologo /subsystem:console /machine:I386 /libpath:"..\ace"
+
+!ELSEIF "$(CFG)" == "Timer_Cancellation_Test - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib Test_Outputd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\ace"
+
+!ENDIF
+
+# Begin Target
+
+# Name "Timer_Cancellation_Test - Win32 Static Debug"
+# Name "Timer_Cancellation_Test - Win32 Static Release"
+# Name "Timer_Cancellation_Test - Win32 Release"
+# Name "Timer_Cancellation_Test - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter ".cpp"
+# Begin Source File
+
+SOURCE=.\Timer_Cancellation_Test.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter ".h"
+# Begin Source File
+
+SOURCE=.\test_config.h
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/tests/Timer_Queue_Reference_Counting_Test.cpp b/tests/Timer_Queue_Reference_Counting_Test.cpp new file mode 100644 index 00000000000..bafaef95d0a --- /dev/null +++ b/tests/Timer_Queue_Reference_Counting_Test.cpp @@ -0,0 +1,729 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// tests +// +// = FILENAME +// Timer_Queue_Reference_Counting_Test.cpp +// +// = DESCRIPTION +// This test is used to check reference counting of the Event +// Handler when it interacts with Timer Queues. +// +// = AUTHOR +// Irfan Pyarali <irfan@oomworks.com> +// +// ============================================================================ + +#include "test_config.h" +#include "ace/Get_Opt.h" +#include "ace/Timer_Queue.h" +#include "ace/Timer_Heap.h" +#include "ace/Timer_List.h" +#include "ace/Timer_Hash.h" +#include "ace/Timer_Wheel.h" +#include "ace/Reactor.h" + +ACE_RCSID(tests, Timer_Queue_Reference_Counting_Test, "$Id$") + +static int debug = 0; +static const char *one_second_timeout = "one second timeout"; +static const char *two_second_timeout = "two second timeout"; + +class Reference_Counted_Event_Handler : public ACE_Event_Handler +{ +public: + + Reference_Counted_Event_Handler (int expected_number_of_handle_close_calls); + + ~Reference_Counted_Event_Handler (void); + + int handle_timeout (const ACE_Time_Value &, + const void *); + + int handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask masks); + + int expected_number_of_handle_close_calls_; + int number_of_handle_close_calls_; +}; + +Reference_Counted_Event_Handler::Reference_Counted_Event_Handler (int expected_number_of_handle_close_calls) + : expected_number_of_handle_close_calls_ (expected_number_of_handle_close_calls), + number_of_handle_close_calls_ (0) +{ + this->reference_counting_policy ().value + (ACE_Event_Handler::Reference_Counting_Policy::ENABLED); + + if (debug) + ACE_DEBUG ((LM_DEBUG, + "Reference count in Reference_Counted_Event_Handler() is %d\n", + this->reference_count_.value ())); +} + +Reference_Counted_Event_Handler::~Reference_Counted_Event_Handler (void) +{ + if (debug) + ACE_DEBUG ((LM_DEBUG, + "Reference count in ~Reference_Counted_Event_Handler() is %d\n", + this->reference_count_.value ())); + + if (this->expected_number_of_handle_close_calls_ != -1) + ACE_ASSERT (this->number_of_handle_close_calls_ == + this->expected_number_of_handle_close_calls_); +} + +int +Reference_Counted_Event_Handler::handle_timeout (const ACE_Time_Value &, + const void *arg) +{ + if (debug) + ACE_DEBUG ((LM_DEBUG, + "Reference count in Reference_Counted_Event_Handler::handle_timeout() for arg = %s is %d\n", + (const char *) arg, + this->reference_count_.value ())); + + return 0; +} + +int +Reference_Counted_Event_Handler::handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask masks) +{ + if (debug) + ACE_DEBUG ((LM_DEBUG, + "Reference_Counted_Event_Handler::handle_close() called with handle = %d and masks = %d. " + "Reference count is %d\n", + handle, + masks, + this->reference_count_.value ())); + + ++this->number_of_handle_close_calls_; + + return 0; +} + +void +cancellation (ACE_Timer_Queue &timer_queue, + int repeat_timer, + int cancel_timers, + int cancel_handler, + int second_timer, + int dont_call_handle_close) +{ + int result = 0; + + int expected_number_of_handle_close_calls = -1; + + if (cancel_timers) + { + if (!dont_call_handle_close) + { + if (cancel_handler) + expected_number_of_handle_close_calls = 1; + else if (second_timer) + expected_number_of_handle_close_calls = 2; + else + expected_number_of_handle_close_calls = 1; + } + } + else + { + if (second_timer) + expected_number_of_handle_close_calls = 2; + else + expected_number_of_handle_close_calls = 1; + } + + Reference_Counted_Event_Handler *handler = + new Reference_Counted_Event_Handler (expected_number_of_handle_close_calls); + + ACE_Event_Handler_var safe_handler (handler); + + long first_timer_id = -1; + long second_timer_id = -1; + + if (repeat_timer) + { + first_timer_id = + timer_queue.schedule (handler, + one_second_timeout, + ACE_Time_Value (1) + timer_queue.gettimeofday (), + ACE_Time_Value (1)); + ACE_ASSERT (first_timer_id != -1); + } + else + { + first_timer_id = + timer_queue.schedule (handler, + one_second_timeout, + ACE_Time_Value (1) + timer_queue.gettimeofday ()); + ACE_ASSERT (first_timer_id != -1); + } + + if (second_timer) + { + second_timer_id = + timer_queue.schedule (handler, + two_second_timeout, + ACE_Time_Value (2) + timer_queue.gettimeofday (), + ACE_Time_Value (2)); + ACE_ASSERT (second_timer_id != -1); + } + + if (!cancel_timers) + return; + + if (cancel_handler) + { + result = + timer_queue.cancel (handler, + dont_call_handle_close); + + if (second_timer) + ACE_ASSERT (result == 2); + else + ACE_ASSERT (result == 1); + } + else + { + result = + timer_queue.cancel (first_timer_id, + 0, + dont_call_handle_close); + ACE_ASSERT (result == 1); + + if (second_timer) + { + result = + timer_queue.cancel (second_timer_id, + 0, + dont_call_handle_close); + ACE_ASSERT (result == 1); + } + } +} + +template <class TIMER_QUEUE> +class cancellation_test +{ +public: + cancellation_test (const char *); +}; + +template <class TIMER_QUEUE> +cancellation_test<TIMER_QUEUE>::cancellation_test (const char *timer_queue_type) +{ + ACE_DEBUG ((LM_DEBUG, + "\nCancellation test for %s\n\n", + timer_queue_type)); + + int configs[][5] = { + { 0, 0, 0, 0, 0, }, + { 0, 0, 0, 0, 1, }, + { 0, 0, 0, 1, 0, }, + { 0, 0, 0, 1, 1, }, + { 0, 0, 1, 0, 0, }, + { 0, 0, 1, 0, 1, }, + { 0, 0, 1, 1, 0, }, + { 0, 0, 1, 1, 1, }, + { 0, 1, 0, 0, 0, }, + { 0, 1, 0, 0, 1, }, + { 0, 1, 0, 1, 0, }, + { 0, 1, 0, 1, 1, }, + { 0, 1, 1, 0, 0, }, + { 0, 1, 1, 0, 1, }, + { 0, 1, 1, 1, 0, }, + { 0, 1, 1, 1, 1, }, + { 1, 0, 0, 0, 0, }, + { 1, 0, 0, 0, 1, }, + { 1, 0, 0, 1, 0, }, + { 1, 0, 0, 1, 1, }, + { 1, 0, 1, 0, 0, }, + { 1, 0, 1, 0, 1, }, + { 1, 0, 1, 1, 0, }, + { 1, 0, 1, 1, 1, }, + { 1, 1, 0, 0, 0, }, + { 1, 1, 0, 0, 1, }, + { 1, 1, 0, 1, 0, }, + { 1, 1, 0, 1, 1, }, + { 1, 1, 1, 0, 0, }, + { 1, 1, 1, 0, 1, }, + { 1, 1, 1, 1, 0, }, + { 1, 1, 1, 1, 1, }, + }; + + for (int i = 0; + i < (int) (sizeof configs / (sizeof (int) * 5)); + i++) + { + TIMER_QUEUE timer_queue; + + cancellation (timer_queue, + configs[i][0], + configs[i][1], + configs[i][2], + configs[i][3], + configs[i][4]); + } +} + +typedef int (*Expire_Function) (ACE_Timer_Queue &timer_queue); + +int +invoke_expire (ACE_Timer_Queue &timer_queue) +{ + return timer_queue.expire (); +} + +int +invoke_one_upcall (ACE_Timer_Queue &timer_queue) +{ + // Get the current time + ACE_Time_Value current_time (timer_queue.gettimeofday () + + timer_queue.timer_skew ()); + + // Look for a node in the timer queue whose timer <= the present + // time. + ACE_Timer_Node_Dispatch_Info dispatch_info; + + if (timer_queue.dispatch_info (current_time, + dispatch_info)) + { + const void *upcall_act = 0; + + // Preinvoke. + timer_queue.preinvoke (dispatch_info, + current_time, + upcall_act); + + // Call the functor + timer_queue.upcall (dispatch_info, + current_time); + + // Postinvoke + timer_queue.postinvoke (dispatch_info, + current_time, + upcall_act); + + // We have dispatched a timer + return 1; + } + + return 0; +} + +void +expire (ACE_Timer_Queue &timer_queue, + Expire_Function expire_function) +{ + int events = 0; + int result = 0; + + Reference_Counted_Event_Handler *handler = + new Reference_Counted_Event_Handler (1); + + ACE_Event_Handler_var safe_handler (handler); + + long timer_id = + timer_queue.schedule (handler, + one_second_timeout, + ACE_Time_Value (1) + timer_queue.gettimeofday (), + ACE_Time_Value (1)); + ACE_ASSERT (timer_id != -1); + + timer_id = + timer_queue.schedule (handler, + two_second_timeout, + ACE_Time_Value (2) + timer_queue.gettimeofday ()); + ACE_ASSERT (result != -1); + + events += 4; + + for (int i = 0; i < events;) + { + ACE_Time_Value sleep_time; + + ACE_Time_Value earliest_time = + timer_queue.earliest_time (); + + ACE_Time_Value time_of_day = + timer_queue.gettimeofday (); + + if (earliest_time > time_of_day) + sleep_time = + earliest_time - time_of_day; + else + sleep_time = ACE_Time_Value::zero; + + ACE_OS::sleep (sleep_time); + + result = + expire_function (timer_queue); + + ACE_ASSERT (result >= 0); + + i += result; + } +} + +template<class TIMER_QUEUE> +class expire_test +{ +public: + expire_test (const char *); +}; + +template <class TIMER_QUEUE> +expire_test<TIMER_QUEUE>::expire_test (const char *timer_queue_type) +{ + ACE_DEBUG ((LM_DEBUG, + "\nExpire test for %s\n\n", + timer_queue_type)); + + TIMER_QUEUE timer_queue; + + expire (timer_queue, + invoke_expire); +} + +template<class TIMER_QUEUE> +class upcall_test +{ +public: + upcall_test (const char *); +}; + +template <class TIMER_QUEUE> +upcall_test<TIMER_QUEUE>::upcall_test (const char *timer_queue_type) +{ + ACE_DEBUG ((LM_DEBUG, + "\nOne upcall test for %s\n\n", + timer_queue_type)); + + TIMER_QUEUE timer_queue; + + expire (timer_queue, + invoke_one_upcall); +} + +class Simple_Event_Handler : public ACE_Event_Handler +{ +public: + + Simple_Event_Handler (void); + + ~Simple_Event_Handler (void); + + int handle_timeout (const ACE_Time_Value &, + const void *); + + int handle_close (ACE_HANDLE, + ACE_Reactor_Mask); + + ACE_Event_Handler::Reference_Count add_reference (void); + + ACE_Event_Handler::Reference_Count remove_reference (void); + +}; + +Simple_Event_Handler::Simple_Event_Handler (void) +{ + if (debug) + ACE_DEBUG ((LM_DEBUG, + "Simple_Event_Handler()\n")); +} + +Simple_Event_Handler::~Simple_Event_Handler (void) +{ + if (debug) + ACE_DEBUG ((LM_DEBUG, + "~Simple_Event_Handler()\n")); +} + +int +Simple_Event_Handler::handle_timeout (const ACE_Time_Value &, + const void *arg) +{ + if (debug) + ACE_DEBUG ((LM_DEBUG, + "Simple_Event_Handler::handle_timeout() for arg = %s\n", + (const char *) arg)); + return 0; +} + +int +Simple_Event_Handler::handle_close (ACE_HANDLE handle, + ACE_Reactor_Mask masks) +{ + if (debug) + ACE_DEBUG ((LM_DEBUG, + "Simple_Event_Handler::handle_close() called with handle = %d and masks = %d.\n", + handle, + masks)); + + delete this; + + return 0; +} + +ACE_Event_Handler::Reference_Count +Simple_Event_Handler::add_reference (void) +{ + // This should not get called. + ACE_ASSERT (0); + return 0; +} + +ACE_Event_Handler::Reference_Count +Simple_Event_Handler::remove_reference (void) +{ + // This should not get called. + ACE_ASSERT (0); + return 0; +} + +void +simple (ACE_Timer_Queue &timer_queue) +{ + int events = 0; + int result = 0; + + { + Simple_Event_Handler *handler = + new Simple_Event_Handler; + + long timer_id = + timer_queue.schedule (handler, + one_second_timeout, + ACE_Time_Value (1) + timer_queue.gettimeofday (), + ACE_Time_Value (1)); + ACE_ASSERT (timer_id != -1); + + result = + timer_queue.cancel (timer_id, + 0, + 0); + ACE_ASSERT (result == 1); + } + + { + Simple_Event_Handler *handler = + new Simple_Event_Handler; + + long timer_id = + timer_queue.schedule (handler, + one_second_timeout, + ACE_Time_Value (1) + timer_queue.gettimeofday (), + ACE_Time_Value (1)); + ACE_ASSERT (timer_id != -1); + + events += 3; + } + + for (int i = 0; i < events;) + { + ACE_OS::sleep (timer_queue.earliest_time () - + timer_queue.gettimeofday ()); + + result = + timer_queue.expire (); + + ACE_ASSERT (result >= 0); + + i += result; + } +} + +template <class TIMER_QUEUE> +class simple_test +{ +public: + simple_test (const char *); +}; + +template <class TIMER_QUEUE> +simple_test<TIMER_QUEUE>::simple_test (const char *timer_queue_type) +{ + ACE_DEBUG ((LM_DEBUG, + "\nSimple test for %s\n\n", + timer_queue_type)); + + TIMER_QUEUE timer_queue; + + simple (timer_queue); +} + +static int heap = 1; +static int list = 1; +static int hash = 1; +static int wheel = 1; +static int test_cancellation = 1; +static int test_expire = 1; +static int test_one_upcall = 1; +static int test_simple = 1; + +static int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("a:b:c:d:l:m:n:o:z:")); + + int cc; + while ((cc = get_opt ()) != -1) + { + switch (cc) + { + case 'a': + heap = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'b': + list = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'c': + hash = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'd': + wheel = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'l': + test_cancellation = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'm': + test_expire = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'n': + test_one_upcall = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'o': + test_simple = ACE_OS::atoi (get_opt.opt_arg ()); + break; + case 'z': + debug = ACE_OS::atoi (get_opt.opt_arg ()); + break; + default: + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("\nusage: %s \n\n") + ACE_TEXT ("\t[-a heap] (defaults to %d)\n") + ACE_TEXT ("\t[-b list] (defaults to %d)\n") + ACE_TEXT ("\t[-c hash] (defaults to %d)\n") + ACE_TEXT ("\t[-d wheel] (defaults to %d)\n") + ACE_TEXT ("\t[-l test_cancellation] (defaults to %d)\n") + ACE_TEXT ("\t[-m test_expire] (defaults to %d)\n") + ACE_TEXT ("\t[-n test_one_upcall] (defaults to %d)\n") + ACE_TEXT ("\t[-o test_simple] (defaults to %d)\n") + ACE_TEXT ("\t[-z debug] (defaults to %d)\n") + ACE_TEXT ("\n"), + argv[0], + heap, + list, + hash, + wheel, + test_cancellation, + test_expire, + test_one_upcall, + test_simple, + debug)); + return -1; + } + } + + return 0; +} + +int +run_main (int argc, ACE_TCHAR *argv[]) +{ + ACE_START_TEST (ACE_TEXT ("Timer_Queue_Reference_Counting_Test")); + + // Validate options. + int result = + parse_args (argc, argv); + if (result != 0) + return result; + + if (test_cancellation) + { + ACE_DEBUG ((LM_DEBUG, + "\nCancellation test...\n\n")); + + if (heap) { cancellation_test<ACE_Timer_Heap> test ("ACE_Timer_Heap"); ACE_UNUSED_ARG (test); } + if (list) { cancellation_test<ACE_Timer_List> test ("ACE_Timer_List"); ACE_UNUSED_ARG (test); } + if (hash) { cancellation_test<ACE_Timer_Hash> test ("ACE_Timer_Hash"); ACE_UNUSED_ARG (test); } + if (wheel) { cancellation_test<ACE_Timer_Wheel> test ("ACE_Timer_Wheel"); ACE_UNUSED_ARG (test); } + } + + if (test_expire) + { + ACE_DEBUG ((LM_DEBUG, + "\nExpire test...\n\n")); + + if (heap) { expire_test<ACE_Timer_Heap> test ("ACE_Timer_Heap"); ACE_UNUSED_ARG (test); } + if (list) { expire_test<ACE_Timer_List> test ("ACE_Timer_List"); ACE_UNUSED_ARG (test); } + if (hash) { expire_test<ACE_Timer_Hash> test ("ACE_Timer_Hash"); ACE_UNUSED_ARG (test); } + if (wheel) { expire_test<ACE_Timer_Wheel> test ("ACE_Timer_Wheel"); ACE_UNUSED_ARG (test); } + } + + if (test_one_upcall) + { + ACE_DEBUG ((LM_DEBUG, + "\nOne upcall at a time test...\n\n")); + + if (heap) { upcall_test<ACE_Timer_Heap> test ("ACE_Timer_Heap"); ACE_UNUSED_ARG (test); } + if (list) { upcall_test<ACE_Timer_List> test ("ACE_Timer_List"); ACE_UNUSED_ARG (test); } + if (hash) { upcall_test<ACE_Timer_Hash> test ("ACE_Timer_Hash"); ACE_UNUSED_ARG (test); } + if (wheel) { upcall_test<ACE_Timer_Wheel> test ("ACE_Timer_Wheel"); ACE_UNUSED_ARG (test); } + } + + if (test_simple) + { + ACE_DEBUG ((LM_DEBUG, + "\nSimple test...\n\n")); + + if (heap) { simple_test<ACE_Timer_Heap> test ("ACE_Timer_Heap"); ACE_UNUSED_ARG (test); } + if (list) { simple_test<ACE_Timer_List> test ("ACE_Timer_List"); ACE_UNUSED_ARG (test); } + if (hash) { simple_test<ACE_Timer_Hash> test ("ACE_Timer_Hash"); ACE_UNUSED_ARG (test); } + if (wheel) { simple_test<ACE_Timer_Wheel> test ("ACE_Timer_Wheel"); ACE_UNUSED_ARG (test); } + } + + ACE_END_TEST; + + return 0; +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) +template class simple_test<ACE_Timer_Heap>; +template class simple_test<ACE_Timer_List>; +template class simple_test<ACE_Timer_Hash>; +template class simple_test<ACE_Timer_Wheel>; +template class upcall_test<ACE_Timer_Heap>; +template class upcall_test<ACE_Timer_List>; +template class upcall_test<ACE_Timer_Hash>; +template class upcall_test<ACE_Timer_Wheel>; +template class expire_test<ACE_Timer_Heap>; +template class expire_test<ACE_Timer_List>; +template class expire_test<ACE_Timer_Hash>; +template class expire_test<ACE_Timer_Wheel>; +template class cancellation_test<ACE_Timer_Heap>; +template class cancellation_test<ACE_Timer_List>; +template class cancellation_test<ACE_Timer_Hash>; +template class cancellation_test<ACE_Timer_Wheel>; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate simple_test<ACE_Timer_Heap> +#pragma instantiate simple_test<ACE_Timer_List> +#pragma instantiate simple_test<ACE_Timer_Hash> +#pragma instantiate simple_test<ACE_Timer_Wheel> +#pragma instantiate upcall_test<ACE_Timer_Heap> +#pragma instantiate upcall_test<ACE_Timer_List> +#pragma instantiate upcall_test<ACE_Timer_Hash> +#pragma instantiate upcall_test<ACE_Timer_Wheel> +#pragma instantiate expire_test<ACE_Timer_Heap> +#pragma instantiate expire_test<ACE_Timer_List> +#pragma instantiate expire_test<ACE_Timer_Hash> +#pragma instantiate expire_test<ACE_Timer_Wheel> +#pragma instantiate cancellation_test<ACE_Timer_Heap> +#pragma instantiate cancellation_test<ACE_Timer_List> +#pragma instantiate cancellation_test<ACE_Timer_Hash> +#pragma instantiate cancellation_test<ACE_Timer_Wheel> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/tests/Timer_Queue_Reference_Counting_Test.dsp b/tests/Timer_Queue_Reference_Counting_Test.dsp new file mode 100644 index 00000000000..fe1ef09e04b --- /dev/null +++ b/tests/Timer_Queue_Reference_Counting_Test.dsp @@ -0,0 +1,162 @@ +# Microsoft Developer Studio Project File - Name="Timer_Queue_Reference_Counting_Test" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Timer_Queue_Reference_Counting_Test - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "Timer_Queue_Reference_Counting_Test.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "Timer_Queue_Reference_Counting_Test.mak" CFG="Timer_Queue_Reference_Counting_Test - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Timer_Queue_Reference_Counting_Test - Win32 Static Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE "Timer_Queue_Reference_Counting_Test - Win32 Static Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Timer_Queue_Reference_Counting_Test - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Timer_Queue_Reference_Counting_Test - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Timer_Queue_Reference_Counting_Test - Win32 Static Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Static_Debug"
+# PROP BASE Intermediate_Dir "Static_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Static_Debug"
+# PROP Intermediate_Dir "Static_Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../" /D "_DEBUG" /D ACE_AS_STATIC_LIBS /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
+# ADD LINK32 acesd.lib Test_Outputsd.lib advapi32.lib user32.lib /nologo /subsystem:console /debug /machine:I386 /libpath:"..\ace"
+
+!ELSEIF "$(CFG)" == "Timer_Queue_Reference_Counting_Test - Win32 Static Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Static_Release"
+# PROP BASE Intermediate_Dir "Static_Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Static_Release"
+# PROP Intermediate_Dir "Static_Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../" /D "NDEBUG" /D ACE_AS_STATIC_LIBS /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 aces.lib Test_Outputs.lib advapi32.lib user32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\ace"
+
+!ELSEIF "$(CFG)" == "Timer_Queue_Reference_Counting_Test - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib Test_Output.lib /nologo /subsystem:console /machine:I386 /libpath:"..\ace"
+
+!ELSEIF "$(CFG)" == "Timer_Queue_Reference_Counting_Test - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib Test_Outputd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\ace"
+
+!ENDIF
+
+# Begin Target
+
+# Name "Timer_Queue_Reference_Counting_Test - Win32 Static Debug"
+# Name "Timer_Queue_Reference_Counting_Test - Win32 Static Release"
+# Name "Timer_Queue_Reference_Counting_Test - Win32 Release"
+# Name "Timer_Queue_Reference_Counting_Test - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
+# Begin Source File
+
+SOURCE=.\Timer_Queue_Reference_Counting_Test.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
+# Begin Source File
+
+SOURCE=.\test_config.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/tests/WFMO_Reactor_Test.cpp b/tests/WFMO_Reactor_Test.cpp new file mode 100644 index 00000000000..2caf3a0e766 --- /dev/null +++ b/tests/WFMO_Reactor_Test.cpp @@ -0,0 +1,157 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// tests +// +// = FILENAME +// WFMO_Reactor_Test.cpp +// +// = DESCRIPTION +// This is a simple test of the WFMO_Reactor. It makes sure that +// removals and suspensions work correctly. +// +// = AUTHOR +// Irfan Pyarali <irfan@oomworks.com> +// +// ============================================================================ + +#include "tests/test_config.h" +#include "ace/Reactor.h" +#include "ace/WFMO_Reactor.h" +#include "ace/Pipe.h" + +ACE_RCSID(tests, WFMO_Reactor_Test, "$Id$") + +#if defined (ACE_WIN32) + +static int number_of_handlers = 6; +static int number_of_closes = 0; + +class Event_Handler : public ACE_Event_Handler +{ +public: + + Event_Handler (ACE_Reactor &reactor); + + ~Event_Handler (void); + + ACE_Pipe pipe_; + +}; + +Event_Handler::Event_Handler (ACE_Reactor &reactor) +{ + this->reference_counting_policy ().value + (ACE_Event_Handler::Reference_Counting_Policy::ENABLED); + + ACE_DEBUG ((LM_DEBUG, + "Reference count in Event_Handler() is %d\n", + this->reference_count_.value ())); + + this->reactor (&reactor); + + int result = + this->pipe_.open (); + + ACE_ASSERT (result == 0); + ACE_UNUSED_ARG (result); + + this->reactor ()->register_handler (this->pipe_.read_handle (), + this, + ACE_Event_Handler::READ_MASK); + ACE_ASSERT (result == 0); + + this->reactor ()->register_handler (this->pipe_.write_handle (), + this, + ACE_Event_Handler::READ_MASK); + ACE_ASSERT (result == 0); +} + +Event_Handler::~Event_Handler (void) +{ + ACE_DEBUG ((LM_DEBUG, + "Reference count in ~Event_Handler() is %d\n", + this->reference_count_.value ())); + + ++number_of_closes; +} + +void +test (void) +{ + int result = 0; + int i = 0; + + ACE_Reactor reactor (new ACE_WFMO_Reactor, 1); + + ACE_Event_Handler_var *safe_event_handlers = + new ACE_Event_Handler_var[number_of_handlers]; + + Event_Handler **event_handlers = + new Event_Handler*[number_of_handlers]; + + for (i = 0; i < number_of_handlers; ++i) + { + event_handlers[i] = + new Event_Handler (reactor); + + safe_event_handlers[i] = + event_handlers[i]; + } + + ACE_Time_Value timeout (0, 500 * 1000); + + result = reactor.run_reactor_event_loop (timeout); + ACE_ASSERT (result != -1); + + for (i = 0; i < number_of_handlers; ++i) + { + if (i % 2 == 0) + continue; + + result = reactor.suspend_handler (event_handlers[i]->pipe_.read_handle ()); + ACE_ASSERT (result == 0); + + result = reactor.suspend_handler (event_handlers[i]->pipe_.write_handle ()); + ACE_ASSERT (result == 0); + } + + result = reactor.run_reactor_event_loop (timeout); + ACE_ASSERT (result != -1); + + delete[] safe_event_handlers; + delete[] event_handlers; +} + +int +run_main (int, ACE_TCHAR *[]) +{ + ACE_START_TEST (ACE_TEXT ("WFMO_Reactor_Test")); + + test (); + + ACE_ASSERT (number_of_closes == number_of_handlers); + + ACE_END_TEST; + + return 0; +} + +#else /* ACE_WIN32 */ + +int +run_main (int, ACE_TCHAR *[]) +{ + ACE_START_TEST (ACE_TEXT ("WFMO_Reactor_Test")); + + ACE_ERROR ((LM_INFO, + ACE_TEXT ("WFMO_Reactor not supported on this platform\n"))); + + ACE_END_TEST; + + return 0; +} + +#endif /* ACE_WIN32 */ diff --git a/tests/WFMO_Reactor_Test.dsp b/tests/WFMO_Reactor_Test.dsp new file mode 100644 index 00000000000..bbee7156083 --- /dev/null +++ b/tests/WFMO_Reactor_Test.dsp @@ -0,0 +1,158 @@ +# Microsoft Developer Studio Project File - Name="WFMO_Reactor_Test" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=WFMO_Reactor_Test - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "WFMO_Reactor_Test.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "WFMO_Reactor_Test.mak" CFG="WFMO_Reactor_Test - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "WFMO_Reactor_Test - Win32 Static Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE "WFMO_Reactor_Test - Win32 Static Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "WFMO_Reactor_Test - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "WFMO_Reactor_Test - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "WFMO_Reactor_Test - Win32 Static Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Static_Debug"
+# PROP BASE Intermediate_Dir "Static_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Static_Debug"
+# PROP Intermediate_Dir "Static_Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../" /D "_DEBUG" /D ACE_AS_STATIC_LIBS /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
+# ADD LINK32 acesd.lib Test_Outputsd.lib advapi32.lib user32.lib /nologo /subsystem:console /debug /machine:I386 /libpath:"..\ace"
+
+!ELSEIF "$(CFG)" == "WFMO_Reactor_Test - Win32 Static Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Static_Release"
+# PROP BASE Intermediate_Dir "Static_Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Static_Release"
+# PROP Intermediate_Dir "Static_Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../" /D "NDEBUG" /D ACE_AS_STATIC_LIBS /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 aces.lib Test_Outputs.lib advapi32.lib user32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\ace"
+
+!ELSEIF "$(CFG)" == "WFMO_Reactor_Test - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib Test_Output.lib /nologo /subsystem:console /machine:I386 /libpath:"..\ace"
+
+!ELSEIF "$(CFG)" == "WFMO_Reactor_Test - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib Test_Outputd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\ace"
+
+!ENDIF
+
+# Begin Target
+
+# Name "WFMO_Reactor_Test - Win32 Static Debug"
+# Name "WFMO_Reactor_Test - Win32 Static Release"
+# Name "WFMO_Reactor_Test - Win32 Release"
+# Name "WFMO_Reactor_Test - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter ".cpp"
+# Begin Source File
+
+SOURCE=.\WFMO_Reactor_Test.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter ".h"
+# Begin Source File
+
+SOURCE=.\test_config.h
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/tests/icc.bat b/tests/icc.bat deleted file mode 100644 index 131c04b17a9..00000000000 --- a/tests/icc.bat +++ /dev/null @@ -1,81 +0,0 @@ -vacbld -SEV=E Aio_Platform_Test.icc -vacbld -SEV=E Atomic_Op_Test.icc -vacbld -SEV=E Barrier_Test.icc -vacbld -SEV=E Basic_Types_Test.icc -vacbld -SEV=E Buffer_Stream_Test.icc -vacbld -SEV=E CDR_Test.icc -vacbld -SEV=E CLASSIX_Addr_Test.icc -vacbld -SEV=E CLASSIX_CLD_Connector_Test.icc -vacbld -SEV=E CLASSIX_Con_Acc_Test.icc -vacbld -SEV=E CLASSIX_Group_Test.icc -vacbld -SEV=E CLASSIX_Notify_Test.icc -vacbld -SEV=E CLASSIX_OS_Test.icc -vacbld -SEV=E CLASSIX_Reactor_Test.icc -vacbld -SEV=E CLASSIX_Select_Reactor_Test.icc -vacbld -SEV=E CLASSIX_Stream_Test.icc -vacbld -SEV=E Collection_Test.icc -vacbld -SEV=E Conn_Test.icc -vacbld -SEV=E DLL_Test.icc -vacbld -SEV=E DLList_Test.icc -vacbld -SEV=E Dynamic_Priority_Test.icc -vacbld -SEV=E Enum_Interfaces_Test.icc -vacbld -SEV=E Env_Value_Test.icc -vacbld -SEV=E Future_Set_Test.icc -vacbld -SEV=E Future_Test.icc -vacbld -SEV=E Handle_Set_Test.icc -vacbld -SEV=E Hash_Map_Manager_Test.icc -vacbld -SEV=E High_Res_Timer_Test.icc -vacbld -SEV=E IOStream_Test.icc -vacbld -SEV=E MM_Shared_Memory_Test.icc -vacbld -SEV=E MT_Reactor_Timer_Test.icc -vacbld -SEV=E MT_Reactor_Upcall_Test.icc -vacbld -SEV=E MT_SOCK_Test.icc -vacbld -SEV=E Map_Manager_Test.icc -vacbld -SEV=E Map_Test.icc -vacbld -SEV=E Mem_Map_Test.icc -vacbld -SEV=E Message_Block_Test.icc -vacbld -SEV=E Message_Queue_Notifications_Test.icc -vacbld -SEV=E Message_Queue_Test.icc -vacbld -SEV=E Multihomed_INET_Addr_Test.icc -vacbld -SEV=E Naming_Test.icc -vacbld -SEV=E Notify_Performance_Test.icc -vacbld -SEV=E Object_Manager_Test.icc -vacbld -SEV=E OrdMultiSet_Test.icc -vacbld -SEV=E Pipe_Test.icc -vacbld -SEV=E Priority_Buffer_Test.icc -vacbld -SEV=E Priority_Reactor_Test.icc -vacbld -SEV=E Priority_Task_Test.icc -vacbld -SEV=E Process_Mutex_Test.icc -vacbld -SEV=E Process_Strategy_Test.icc -vacbld -SEV=E RB_Tree_Test.icc -vacbld -SEV=E Reactor_Dispatch_Order_Test.icc -vacbld -SEV=E Reactor_Exceptions_Test.icc -vacbld -SEV=E Reactor_Notify_Test.icc -vacbld -SEV=E Reactor_Performance_Test.icc -vacbld -SEV=E Reactor_Timer_Test.icc -vacbld -SEV=E Reactors_Test.icc -vacbld -SEV=E Reader_Writer_Test.icc -vacbld -SEV=E Recursive_Mutex_Test.icc -vacbld -SEV=E SOCK_Connector_Test.icc -vacbld -SEV=E SOCK_Test.icc -vacbld -SEV=E SPIPE_Test.icc -vacbld -SEV=E SString_Test.icc -vacbld -SEV=E SV_Shared_Memory_Test.icc -vacbld -SEV=E Semaphore_Test.icc -vacbld -SEV=E Service_Config_Test.icc -vacbld -SEV=E Sigset_Ops_Test.icc -vacbld -SEV=E Simple_Message_Block_Test.icc -vacbld -SEV=E TSS_Test.icc -vacbld -SEV=E Task_Test.icc -vacbld -SEV=E Thread_Manager_Test.icc -vacbld -SEV=E Thread_Mutex_Test.icc -vacbld -SEV=E Thread_Pool_Reactor_Test.icc -vacbld -SEV=E Thread_Pool_Test.icc -vacbld -SEV=E Time_Service_Test.icc -vacbld -SEV=E Time_Value_Test.icc -vacbld -SEV=E Timeprobe_Test.icc -vacbld -SEV=E Timer_Queue_Test.icc -vacbld -SEV=E Tokens_Test.icc -vacbld -SEV=E UPIPE_SAP_Test.icc -vacbld -SEV=E Upgradable_RW_Test.icc -vacbld -SEV=E XtReactor_Test.icc diff --git a/tests/run_test.lst b/tests/run_test.lst index e682e02e2ac..cd089bc1608 100644 --- a/tests/run_test.lst +++ b/tests/run_test.lst @@ -24,62 +24,65 @@ Barrier_Test Basic_Types_Test Bound_Ptr_Test Buffer_Stream_Test +CDR_Array_Test +CDR_File_Test +CDR_Test Cache_Map_Manager_Test -Cached_Conn_Test: !LynxOS !VxWorks +Cached_Accept_Conn_Test: !VxWorks Cached_Allocator_Test +Cached_Conn_Test: !LynxOS !VxWorks Capabilities_Test -CDR_Test -CDR_File_Test -CDR_Array_Test -Cached_Accept_Conn_Test: !VxWorks Codecs_Test Collection_Test Config_Test Conn_Test: !chorus -Date_Time_Test -Dirent_Test DLL_Test: !Unicos !STATIC !KCC_Linux DLList_Test +Date_Time_Test +Dirent_Test Dynamic_Priority_Test Enum_Interfaces_Test Env_Value_Test: !chorus !WinCE FIFO_Test: !Win32 Framework_Component_Test: !STATIC -Future_Test Future_Set_Test +Future_Test Get_Opt_Test Handle_Set_Test -Hash_Map_Manager_Test Hash_Map_Bucket_Iterator_Test +Hash_Map_Manager_Test High_Res_Timer_Test INET_Addr_Test IOStream_Test Lazy_Map_Manager_Test Log_Msg_Test Logging_Strategy_Test: !STATIC !ST +MEM_Stream_Test: !VxWorks +MM_Shared_Memory_Test: !chorus !Unicos !VxWorks +MT_Reactor_Timer_Test: !VxWorks +MT_Reactor_Upcall_Test: !VxWorks +MT_Reference_Counted_Event_Handler_Test +MT_Reference_Counted_Notify_Test +MT_SOCK_Test: !chorus +Malloc_Test: !VxWorks Map_Manager_Test Map_Test Max_Default_Port_Test: !ST -MEM_Stream_Test: !VxWorks Mem_Map_Test: !chorus !Unicos !VxWorks Message_Block_Test: !chorus Message_Queue_Notifications_Test Message_Queue_Test: !chorus Message_Queue_Test_Ex: !chorus -MM_Shared_Memory_Test: !chorus !Unicos !VxWorks -MT_Reactor_Timer_Test: !VxWorks -MT_Reactor_Upcall_Test: !VxWorks -MT_SOCK_Test: !chorus -Malloc_Test: !VxWorks Multicast_Test: !ST Multihomed_INET_Addr_Test Naming_Test: OTHER !chorus !LynxOS !Unicos !VxWorks New_Fail_Test: ALL !DISABLED +NonBlocking_Conn_Test Notify_Performance_Test +OS_Test Object_Manager_Test Obstack_Test OrdMultiSet_Test -OS_Test Pipe_Test: !chorus !VxWorks Priority_Buffer_Test Priority_Reactor_Test: !chorus @@ -91,44 +94,49 @@ Process_Manager_Test: !chorus !VxWorks Process_Mutex_Test: !chorus !VxWorks Process_Strategy_Test: !chorus !LynxOS !VxWorks RB_Tree_Test -Reactors_Test +Reactor_Dispatch_Order_Test Reactor_Exceptions_Test Reactor_Notify_Test: !ST -Reactor_Dispatch_Order_Test Reactor_Performance_Test: !chorus +Reactor_Registration_Test Reactor_Timer_Test +Reactors_Test Reader_Writer_Test -Recursive_Condition_Test: !ST Recursive_Condition_Bug_Test: !ST +Recursive_Condition_Test: !ST Recursive_Mutex_Test: !ST Refcounted_Auto_Ptr_Test: !VxWorks +Reference_Counted_Event_Handler_Test Reverse_Lock_Test -Semaphore_Test -Service_Config_Test: !STATIC -Sigset_Ops_Test -Simple_Message_Block_Test: !chorus -Svc_Handler_Test -SOCK_Test: !chorus SOCK_Connector_Test SOCK_Send_Recv_Test: !LynxOS +SOCK_Test: !chorus SPIPE_Test: !VxWorks SString_Test SV_Shared_Memory_Test: !MSVC !Unicos !VxWorks !RH_7.1 +Semaphore_Test +Service_Config_Test: !STATIC +Sigset_Ops_Test +Simple_Message_Block_Test: !chorus +Svc_Handler_Test +TP_Reactor_Test: ALL +TSS_Test Task_Test Thread_Manager_Test: !Unicos Thread_Mutex_Test: !chorus -Thread_Pool_Reactor_Test: OTHER Thread_Pool_Reactor_Resume_Test: OTHER !ST +Thread_Pool_Reactor_Test: OTHER Thread_Pool_Test: !LynxOS !VxWorks -Timer_Queue_Test -Timeprobe_Test Time_Service_Test: ALL !STATIC !DISABLED !missing_netsvcs TOKEN !chorus !Unicos Time_Value_Test +Timeprobe_Test +Timer_Cancellation_Test +Timer_Queue_Reference_Counting_Test +Timer_Queue_Test Token_Strategy_Test: !ST Tokens_Test: ALL MSVC !DISABLED TOKEN !chorus !Unicos -TP_Reactor_Test: ALL -TSS_Test -Vector_Test -Unbounded_Set_Test_Ex UPIPE_SAP_Test: !VxWorks +Unbounded_Set_Test_Ex Upgradable_RW_Test: !chorus +Vector_Test +WFMO_Reactor_Test diff --git a/tests/run_tests.bat b/tests/run_tests.bat deleted file mode 100644 index cf51b2f4389..00000000000 --- a/tests/run_tests.bat +++ /dev/null @@ -1,223 +0,0 @@ -@echo off -rem run_tests.bat,v 4.71 1999/11/08 05:39:06 nanbor Exp - -rem -rem Note this batch file will not work on Win9X, so we suggest that -rem you install/use perl on Win9x and run the run_test.pl file. -rem - -rem To run this script, the first argument must be either bor -rem or msc. This will determine if the borland tests are run, or -rem msvc tests are run. -rem You can provide an optional second parameter, the name of -rem the test to be run. -rem An optional first argument of "purify" can be provided as well. -rem If you specify that the borland tests are to run you must also -rem specify the build configuration to be tested. There are three -rem options that may be set: DEBUG, STATIC, and PASCAL. Each is Off -rem by default. These options may be switched on by using environment -rem variables, for example: set DEBUG=1 and turned off again: -rem set DEBUG=. -rem * DEBUG - if defined means run tests built with debug info -rem * STATIC - if defined means run statically linked tests -rem * PASCAL - if defined means run the VCL-compatible runtime -rem library tests - -setlocal - -set arg= -set deco= -set exedir= -set dopure= - -set run_cmd=%0 - -if "%1" == "help" goto usage -if "%1" == "?" goto usage -if "%1" == "/?" goto usage -if "%1" == "purify" goto setuppurify -if "%1" == "bor" goto setupbor_arg -if "%1" == "msc" goto setupmsc_arg -goto setupmsc - -:setuppurify -shift -set dopure=purify -if "%1" == "bor" goto setupbor_arg -if "%1" == "msc" goto setupmsc_arg -goto setupmsc - -:setupbor_arg -shift -:setupbor -set arg=%1 - -set STATIC_DIR=Dynamic -if not "%STATIC%" == "" set STATIC_DIR=Static -set DEBUG_DIR=Release -if not "%DEBUG%" == "" set DEBUG_DIR=Debug -set PASCAL_DIR=. -if not "%PASCAL%" == "" set PASCAL_DIR=Pascal -if "%STATIC_DIR%" == "Static" goto continue_setupbor -set corebindir=%ACE_ROOT%\bin\%STATIC_DIR%\%DEBUG_DIR%\%PASCAL_DIR% -set PATH=%PATH%;%corebindir% - -:continue_setupbor -set exedir=.\%STATIC_DIR%\%DEBUG_DIR%\%PASCAL_DIR%\ - -set PATH=%PATH%;%exedir% -rem Set deco to whatever decoration you have for the executables -set deco= -set platform=bor -goto endsetup - -:setupmsc_arg -shift -:setupmsc -set arg=%1 -set exedir= -set deco= -set platform= -goto endsetup - -:usage -echo "usage: run_tests [purify] bor|msc [program-name]" -goto done - -:endsetup - -if not "%arg%" == "" goto runtest - -:runall - -if not "%platform%" == "bor" call %run_cmd% %dopure% %platform% ACE_Init_Test -call %run_cmd% %dopure% %platform% Atomic_Op_Test -call %run_cmd% %dopure% %platform% Auto_IncDec_Test -call %run_cmd% %dopure% %platform% Barrier_Test -call %run_cmd% %dopure% %platform% Basic_Types_Test -call %run_cmd% %dopure% %platform% Buffer_Stream_Test -call %run_cmd% %dopure% %platform% Cache_Map_Manager_Test -call %run_cmd% %dopure% %platform% Cached_Conn_Test -call %run_cmd% %dopure% %platform% Cached_Accept_Conn_Test -call %run_cmd% %dopure% %platform% Capabilities_Test -call %run_cmd% %dopure% %platform% CDR_Test -call %run_cmd% %dopure% %platform% CDR_File_Test -call %run_cmd% %dopure% %platform% CDR_Array_Test -call %run_cmd% %dopure% %platform% Collection_Test -call %run_cmd% %dopure% %platform% Conn_Test -call %run_cmd% %dopure% %platform% Dirent_Test -call %run_cmd% %dopure% %platform% DLL_Test -call %run_cmd% %dopure% %platform% DLList_Test -call %run_cmd% %dopure% %platform% Dynamic_Priority_Test -call %run_cmd% %dopure% %platform% Enum_Interfaces_Test -call %run_cmd% %dopure% %platform% Env_Value_Test -call %run_cmd% %dopure% %platform% Future_Test -call %run_cmd% %dopure% %platform% Future_Set_Test -call %run_cmd% %dopure% %platform% Handle_Set_Test -call %run_cmd% %dopure% %platform% Hash_Map_Manager_Test -call %run_cmd% %dopure% %platform% Hash_Map_Bucket_Iterator_Test -call %run_cmd% %dopure% %platform% High_Res_Timer_Test -call %run_cmd% %dopure% %platform% IOStream_Test -call %run_cmd% %dopure% %platform% Lazy_Map_Manager_Test -call %run_cmd% %dopure% %platform% Map_Manager_Test -call %run_cmd% %dopure% %platform% Map_Test -call %run_cmd% %dopure% %platform% Max_Default_Port_Test -call %run_cmd% %dopure% %platform% Mem_Map_Test -call %run_cmd% %dopure% %platform% MEM_Stream_Test -call %run_cmd% %dopure% %platform% Message_Block_Test -call %run_cmd% %dopure% %platform% Message_Queue_Notifications_Test -call %run_cmd% %dopure% %platform% Message_Queue_Test -call %run_cmd% %dopure% %platform% MM_Shared_Memory_Test -call %run_cmd% %dopure% %platform% MT_Reactor_Timer_Test -call %run_cmd% %dopure% %platform% MT_Reactor_Upcall_Test -call %run_cmd% %dopure% %platform% MT_SOCK_Test -call %run_cmd% %dopure% %platform% Malloc_Test -call %run_cmd% %dopure% %platform% Multihomed_INET_Addr_Test -call %run_cmd% %dopure% %platform% Naming_Test -rem call %run_cmd% %dopure% %platform% New_Fail_Test -call %run_cmd% %dopure% %platform% Notify_Performance_Test -call %run_cmd% %dopure% %platform% Object_Manager_Test -call %run_cmd% %dopure% %platform% OrdMultiSet_Test -call %run_cmd% %dopure% %platform% Pipe_Test -call %run_cmd% %dopure% %platform% Priority_Buffer_Test -call %run_cmd% %dopure% %platform% Priority_Reactor_Test -call %run_cmd% %dopure% %platform% Priority_Task_Test -call %run_cmd% %dopure% %platform% Process_Manager_Test -call %run_cmd% %dopure% %platform% Process_Mutex_Test -call %run_cmd% %dopure% %platform% Process_Strategy_Test -call %run_cmd% %dopure% %platform% RB_Tree_Test -call %run_cmd% %dopure% %platform% Reactors_Test -call %run_cmd% %dopure% %platform% Reactor_Exceptions_Test -call %run_cmd% %dopure% %platform% Reactor_Notify_Test -call %run_cmd% %dopure% %platform% Reactor_Dispatch_Order_Test -call %run_cmd% %dopure% %platform% Reactor_Performance_Test -call %run_cmd% %dopure% %platform% Reactor_Timer_Test -call %run_cmd% %dopure% %platform% Reader_Writer_Test -call %run_cmd% %dopure% %platform% Recursive_Mutex_Test -call %run_cmd% %dopure% %platform% Reverse_Lock_Test -call %run_cmd% %dopure% %platform% Semaphore_Test -call %run_cmd% %dopure% %platform% Service_Config_Test -call %run_cmd% %dopure% %platform% Sigset_Ops_Test -call %run_cmd% %dopure% %platform% Simple_Message_Block_Test -call %run_cmd% %dopure% %platform% Svc_Handler_Test -call %run_cmd% %dopure% %platform% SOCK_Test -call %run_cmd% %dopure% %platform% SOCK_Connector_Test -call %run_cmd% %dopure% %platform% SOCK_Send_Recv_Test -call %run_cmd% %dopure% %platform% SPIPE_Test -call %run_cmd% %dopure% %platform% SString_Test -call %run_cmd% %dopure% %platform% SV_Shared_Memory_Test -call %run_cmd% %dopure% %platform% Task_Test -call %run_cmd% %dopure% %platform% Thread_Manager_Test -call %run_cmd% %dopure% %platform% Thread_Mutex_Test -call %run_cmd% %dopure% %platform% Thread_Pool_Reactor_Test -call %run_cmd% %dopure% %platform% Thread_Pool_Test -call %run_cmd% %dopure% %platform% Timer_Queue_Test -call %run_cmd% %dopure% %platform% Timeprobe_Test -if exist ..\netsvcs\servers\main.exe call %run_cmd% %dopure% %platform% Time_Service_Test -call %run_cmd% %dopure% %platform% Time_Value_Test -call %run_cmd% %dopure% %platform% Tokens_Test -call %run_cmd% %dopure% %platform% TSS_Test -call %run_cmd% %dopure% %platform% UPIPE_SAP_Test -call %run_cmd% %dopure% %platform% Upgradable_RW_Test - -goto done - -:runtest - -if not "%dopure%"=="purify" goto justrun - -if not exist purify_results mkdir purify_results - -echo Purifying %arg% -purify /run /save-data=purify_results\%arg%.pfy /save-text-data=purify_results\%arg%.txt /AllocCallStackLength=20 /ErrorCallStackLength=20 /HandlesInUseAtExit /InUseAtExit /LeaksAtExit %arg%.exe - -goto done - -:justrun - -set exefile=%exedir%%arg%%deco% -echo Running %exefile% -if not exist %exefile%.exe goto nofile - -%exefile%.exe -if errorlevel 0 goto fine -echo. -echo %exefile% has FAILED!!! -echo. -type log\%arg%.log | find /I "LM_ERROR" -echo. - -goto done - -:nofile -echo %exefile%.exe not found -goto done - -:fine - -rem We should check the log files here to make sure the test ended correctly -rem type log\%arg%.log | find "Ending" - -:done - -endlocal diff --git a/tests/run_tests.psosim b/tests/run_tests.psosim deleted file mode 100755 index 33a7ce59fce..00000000000 --- a/tests/run_tests.psosim +++ /dev/null @@ -1,200 +0,0 @@ -#!/bin/sh -f -# $Id$ -# -# This is the UNIX version of the one-button ACE tests. -# Contributed by Michael Rueger <m_rueger@SYSCOMP.DE> - -IFS="|" -tmp=/tmp - -run() -{ - echo running $1 - /bin/rm -f core log/$1.log - - ./$1 - status=$? - - if [ $status -ne 0 ]; then - echo \"$1\" FAILED with exit status $status!!!! - fi - - if [ -f core ]; then - echo \"$1\" dumped core!!!! - fi - - if [ -f log/$1.log ]; then - ./run_tests.check log/$1.log - else - echo "No log file (log/$1.log) is present" - fi -} - -echo "Starting tests..." - -run Basic_Types_Test - -run DLList_Test - -#Atomic_Op_Test: threads not supported on this platform -#run Atomic_Op_Test # uses Atomic_Op - -run Object_Manager_Test - -#TSS_Test: threads are not supported on this platform -#run TSS_Test # uses Task, Mutex, Guard - -run Time_Value_Test -run High_Res_Timer_Test -run SString_Test -run Collection_Test - -# SYS V IPC not supported -#run Naming_Test # uses Naming_Context, WString - -run Handle_Set_Test # uses Handle_Set - -run OrdMultiSet_Test - -#Mem_Map_Test: mmap: Operation not applicable -#run Mem_Map_Test # uses Mem_Map - -run MEM_Stream_Test - -#SV_Shared_Memory_Test: SYSV IPC is not supported on this platform -#run SV_Shared_Memory_Test # uses SV_Shared_Memory, fork - -#MM_Shared_Memory_Test: requires either fork or threads -#run MM_Shared_Memory_Test - -run Sigset_Ops_Test # uses sigset*() functions - -run Timer_Queue_Test # uses Event_Handler, Timer_Queue - -run SOCK_Connector_Test # uses SOCK_Connector - -#Task_Test: threads not supported on this platform -#run Task_Test # uses Thread_Manager, Task - -#Thread_Manager_Test: threads not supported on this platform -#run Thread_Manager_Test # uses Thread_Manager, Task - -#Thread_Pool_Test: threads not supported on this platform -#run Thread_Pool_Test # uses Thread_Manager, Task - -#Future_Test: threads not supported on this platform -#run Future_Test # uses Thread_Manager, Task - -#Future_Set_Test: threads not supported on this platform -#run Future_Set_Test # uses Thread_Manager, Task - -#Reactors_Test: threads not supported on this platform -#run Reactors_Test # uses Task, Mutex, Reactor - -#Reactor_Exceptions_Test: not correctly implemented without threads -#run Reactor_Exceptions_Test # uses Reactor and C++ exceptions - -#Reactor_Notify_Test: threads not supported on this platform -#run Reactor_Notify_Test # uses Reactor's notify() method, Task - -run Reactor_Timer_Test # uses Event_Handler, Reactor - -run Reactor_Dispatch_Order_Test # uses Event_Handler, Reactor - -#Reactor_Performance_Test: threads not supported on this platform -#run Reactor_Performance_Test # uses Event_Handler, Reactor - -#Notify_Performance_Test: threads not supported on this platform -#run Notify_Performance_Test # uses Event_Handler, Reactor - -#Reader_Writer_Test: threads not supported on this platform -#run Reader_Writer_Test # uses Thread_Manager, Mutex - -run Priority_Reactor_Test # uses Priority_Reactor, Acceptor/Connector... -run SOCK_Test # uses Thread_Manager, SOCK_SAP -run MT_SOCK_Test # uses Thread_Manager, Acceptor/Connector - -# ifdef ACE_HAS_STREAM_PIPES -#SPIPE_Test: SPIPE is not supported on this platform -#run SPIPE_Test # uses SPIPE_Acceptor/Connector, Thread_Manager - -#UPIPE_SAP_Test: threads not supported on this platform -#run UPIPE_SAP_Test # uses UPIPE, Thread, Thread_Manager - -#Barrier_Test: threads not supported on this platform -#run Barrier_Test # uses Service_Config, Barrier - -#run CDR_Test - -#Buffer_Stream_Test: threads not supported on this platform -#run Buffer_Stream_Test # uses Service_Config, Module (Stream,Task, Message_Queue) - -#Priority_Buffer_Test: threads not supported on this platform -#run Priority_Buffer_Test # uses Service_Config, Message_Queue - -run Recursive_Mutex_Test # uses Service_Config, Recursive_Thread_Mutex - -run Reverse_Lock_Test # uses ACE_Reverse_Lock - -#Time_Service_Test: uses fork -#run Time_Service_Test # uses libnetsvcs - -#Tokens_Test: threads not supported on this platform -#run Tokens_Test - -run Map_Manager_Test # uses Map Manager and Hash Map Manager + Forward and Reverse Map Iterators. - -run Hash_Map_Manager_Test # uses Hash Map Manager + Forward and Reverse Map Iterators. - -run Lazy_Map_Manager_Test # uses Lazy Map Manager + Forward and Reverse Map Iterators. - -run Hash_Map_Bucket_Iterator_Test # uses Hash Map Bucket iterator. - -run Cache_Map_Manager_Test # uses Cache Map Manager and Hash Cache Map Manager + Forward and Reverse Map Iterators. - -run Cached_Conn_Test # uses Cached connection management (with OneShot Acceptor). - -run Cached_Accept_Conn_Test # uses Cached connection management (with regular Acceptor). - -run Map_Test # uses Map + Forward and Reverse Map Iterators. - -#Message_Queue_Notifications_Test.cpp: threads not supported on this platform -#run Message_Queue_Notifications_Test.cpp # uses Message_Queue + Reactor. - -run Message_Queue_Test # uses Message_Queue + Forward and Reverse Message Queue Iterators. -run Simple_Message_Block_Test # uses Message_Block - -#Message_Block_Test: threads not supported on this platform -#run Message_Block_Test # uses Message_Block and Message_Queue - -#Pipe_Test: uses fork -#run Pipe_Test # uses Pipe - -#Process_Mutex_Test: uses fork -#run Process_Mutex_Test # uses Process_Mutex - -#Thread_Mutex_Test: threads not supported on this platform -#run Thread_Mutex_Test # uses Thread_Process_Mutex - -run Process_Strategy_Test # uses ACE_Strategy_Acceptor -run Service_Config_Test # uses Service_Config - -#Priority_Task_Test: threads not supported on this platform -#run Priority_Task_Test # uses Task with priorities - -run IOStream_Test # uses ACE_IOStream and ACE_SOCK_Stream -run Enum_Interfaces_Test # uses ACE::get_ip_interfaces() - -run Conn_Test # uses Thread_Manager, Acceptor/Connector, SOCK_SAP - -run Upgradable_RW_Test # uses RW locks - -run Svc_Handler_Test - -echo "Tests complete..." - -/bin/rm -f ace_pipe_name pattern $tmp/ace_temp_file $tmp/ace_temp_file2 $tmp/ace_test_file $tmp/Naming_Test* -echo; echo -ipcs - -# EOF diff --git a/tests/tests.dsw b/tests/tests.dsw index 3cad845fc11..46a0eac3845 100644 --- a/tests/tests.dsw +++ b/tests/tests.dsw @@ -1,1826 +1 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "ACE_Init_Test"=.\ACE_Init_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "ACE_Test"=.\ACE_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "ARGV_Test"=.\ARGV_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Arg_Shifter_Test"=.\Arg_Shifter_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Atomic_Op_Test"=.\Atomic_Op_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Auto_IncDec_Test"=.\Auto_IncDec_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Barrier_Test"=.\Barrier_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Basic_Types_Test"=.\Basic_Types_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Bound_Ptr_Test"=.\Bound_Ptr_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Buffer_Stream_Test"=.\Buffer_Stream_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "CDR_Array_Test"=.\CDR_Array_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "CDR_File_Test"=.\CDR_File_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "CDR_Test"=.\CDR_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Cache_Map_Manager_Test"=.\Cache_Map_Manager_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Cached_Accept_Conn_Test"=.\Cached_Accept_Conn_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Cached_Allocator_Test"=.\Cached_Allocator_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Cached_Conn_Test"=.\Cached_Conn_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Capabilities_Test"=.\Capabilities_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Codecs_Test"=.\Codecs_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Collection_Test"=.\Collection_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Config_Test"=.\Config_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Conn_Test"=.\Conn_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "DLL_Test"=.\DLL_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name DLL_Test DLL
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "DLL_Test DLL"=.\DLL_Test_Impl.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "DLList_Test"=.\DLList_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Date_Time_Test"=.\Date_Time_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Dirent_Test"=.\Dirent_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Dynamic_Priority_Test"=.\Dynamic_Priority_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Enum_Interfaces_Test"=.\Enum_Interfaces_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Env_Value_Test"=.\Env_Value_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Framework_Component_Test"=.\Framework_Component_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Framework_Component_Test DLL
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Framework_Component_Test DLL"=.\Framework_Component_DLL.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Future_Set_Test"=.\Future_Set_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Future_Test"=.\Future_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Get_Opt_Test"=.\Get_Opt_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Handle_Set_Test"=.\Handle_Set_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Hash_Map_Bucket_Iterator_Test"=.\Hash_Map_Bucket_Iterator_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Hash_Map_Manager_Test"=.\Hash_Map_Manager_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "High_Res_Timer_Test"=.\High_Res_Timer_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "INET_Addr_Test"=.\INET_Addr_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "IOStream_Test"=.\IOStream_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Lazy_Map_Manager_Test"=.\Lazy_Map_Manager_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Log_Msg_Test"=.\Log_Msg_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Logging_Strategy_Test"=.\Logging_Strategy_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "MEM_Stream_Test"=.\MEM_Stream_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "MM_Shared_Memory_Test"=.\MM_Shared_Memory_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "MT_Reactor_Timer_Test"=.\MT_Reactor_Timer_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "MT_Reactor_Upcall_Test"=.\MT_Reactor_Upcall_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "MT_SOCK_Test"=.\MT_SOCK_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Malloc_Test"=.\Malloc_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Map_Manager_Test"=.\Map_Manager_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Map_Test"=.\Map_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Max_Default_Port_Test"=.\Max_Default_Port_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Mem_Map_Test"=.\Mem_Map_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Message_Block_Test"=.\Message_Block_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Message_Queue_Notifications_Test"=.\Message_Queue_Notifications_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Message_Queue_Test"=.\Message_Queue_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Message_Queue_Test_Ex"=.\Message_Queue_Test_Ex.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Multicast_Test"=.\Multicast_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Multihomed_INET_Addr_Test"=.\Multihomed_INET_Addr_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Naming_Test"=.\Naming_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "New_Fail_Test"=.\New_Fail_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Notify_Performance_Test"=.\Notify_Performance_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "OS_Test"=.\OS_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Object_Manager_Test"=.\Object_Manager_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Obstack_Test"=.\Obstack_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "OrdMultiSet_Test"=.\OrdMultiSet_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Pipe_Test"=.\Pipe_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Priority_Buffer_Test"=.\Priority_Buffer_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Priority_Reactor_Test"=.\Priority_Reactor_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Priority_Task_Test"=.\Priority_Task_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Proactor_Scatter_Gather_Test"=.\Proactor_Scatter_Gather_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Proactor_Test"=.\Proactor_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Proactor_Timer_Test"=.\Proactor_Timer_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Process_Manager_Test"=.\Process_Manager_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Process_Mutex_Test"=.\Process_Mutex_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Process_Strategy_Test"=.\Process_Strategy_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "RB_Tree_Test"=.\RB_Tree_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Reactor_Dispatch_Order_Test"=.\Reactor_Dispatch_Order_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Reactor_Exceptions_Test"=.\Reactor_Exceptions_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Reactor_Notify_Test"=.\Reactor_Notify_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Reactor_Performance_Test"=.\Reactor_Performance_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Reactor_Timer_Test"=.\Reactor_Timer_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Reactors_Test"=.\Reactors_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Reader_Writer_Test"=.\Reader_Writer_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Recursive_Condition_Bug_Test"=.\Recursive_Condition_Bug_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Recursive_Condition_Test"=.\Recursive_Condition_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Recursive_Mutex_Test"=.\Recursive_Mutex_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Refcounted_Auto_Ptr_Test"=.\Refcounted_Auto_Ptr_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Reverse_Lock_Test"=.\Reverse_Lock_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "SOCK_Connector_Test"=.\SOCK_Connector_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "SOCK_Send_Recv_Test"=.\SOCK_Send_Recv_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "SOCK_Test"=.\SOCK_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "SPIPE_Test"=.\SPIPE_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "SString_Test"=.\SString_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "SV_Shared_Memory_Test"=.\SV_Shared_Memory_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Semaphore_Test"=.\Semaphore_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Service_Config_DLL"=.\Service_Config_DLL.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Service_Config_Test"=.\Service_Config_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Service_Config_DLL
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Sigset_Ops_Test"=.\Sigset_Ops_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Simple_Message_Block_Test"=.\Simple_Message_Block_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Svc_Handler_Test"=.\Svc_Handler_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "TP_Reactor_Test"=.\TP_Reactor_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "TSS_Test"=.\TSS_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Task_Test"=.\Task_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Test_Output DLL"=.\Test_Output.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "Thread_Manager_Test"=.\Thread_Manager_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Thread_Mutex_Test"=.\Thread_Mutex_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Thread_Pool_Reactor_Resume_Test"=.\Thread_Pool_Reactor_Resume_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Thread_Pool_Reactor_Test"=.\Thread_Pool_Reactor_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Thread_Pool_Test"=.\Thread_Pool_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Time_Service_Test"=.\Time_Service_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Time_Value_Test"=.\Time_Value_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Timeprobe_Test"=.\Timeprobe_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Timer_Queue_Test"=.\Timer_Queue_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Token_Strategy_Test"=.\Token_Strategy_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Tokens_Test"=.\Tokens_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "UPIPE_SAP_Test"=.\UPIPE_SAP_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Unbounded_Set_Test_Ex"=.\Unbounded_Set_Test_Ex.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Upgradable_RW_Test"=.\Upgradable_RW_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "Vector_Test"=.\Vector_Test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name Test_Output DLL
- End Project Dependency
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
+Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "ACE_Init_Test"=.\ACE_Init_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "ACE_Test"=.\ACE_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "ARGV_Test"=.\ARGV_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Arg_Shifter_Test"=.\Arg_Shifter_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Atomic_Op_Test"=.\Atomic_Op_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Auto_IncDec_Test"=.\Auto_IncDec_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Barrier_Test"=.\Barrier_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Basic_Types_Test"=.\Basic_Types_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Bound_Ptr_Test"=.\Bound_Ptr_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Buffer_Stream_Test"=.\Buffer_Stream_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "CDR_Array_Test"=.\CDR_Array_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "CDR_File_Test"=.\CDR_File_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "CDR_Test"=.\CDR_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Cache_Map_Manager_Test"=.\Cache_Map_Manager_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Cached_Accept_Conn_Test"=.\Cached_Accept_Conn_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Cached_Allocator_Test"=.\Cached_Allocator_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Cached_Conn_Test"=.\Cached_Conn_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Capabilities_Test"=.\Capabilities_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Codecs_Test"=.\Codecs_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Collection_Test"=.\Collection_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Config_Test"=.\Config_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Conn_Test"=.\Conn_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "DLL_Test"=.\DLL_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name DLL_Test DLL
End Project Dependency
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "DLL_Test DLL"=.\DLL_Test_Impl.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "DLList_Test"=.\DLList_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Date_Time_Test"=.\Date_Time_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Dirent_Test"=.\Dirent_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Dynamic_Priority_Test"=.\Dynamic_Priority_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Enum_Interfaces_Test"=.\Enum_Interfaces_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Env_Value_Test"=.\Env_Value_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Framework_Component_Test"=.\Framework_Component_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Framework_Component_Test DLL
End Project Dependency
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Framework_Component_Test DLL"=.\Framework_Component_DLL.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "Future_Set_Test"=.\Future_Set_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Future_Test"=.\Future_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Get_Opt_Test"=.\Get_Opt_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Handle_Set_Test"=.\Handle_Set_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Hash_Map_Bucket_Iterator_Test"=.\Hash_Map_Bucket_Iterator_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Hash_Map_Manager_Test"=.\Hash_Map_Manager_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "High_Res_Timer_Test"=.\High_Res_Timer_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "INET_Addr_Test"=.\INET_Addr_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "IOStream_Test"=.\IOStream_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Lazy_Map_Manager_Test"=.\Lazy_Map_Manager_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Log_Msg_Test"=.\Log_Msg_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Logging_Strategy_Test"=.\Logging_Strategy_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "MEM_Stream_Test"=.\MEM_Stream_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "MM_Shared_Memory_Test"=.\MM_Shared_Memory_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "MT_Reactor_Timer_Test"=.\MT_Reactor_Timer_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "MT_Reactor_Upcall_Test"=.\MT_Reactor_Upcall_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "MT_Reference_Counted_Event_Handler_Test"=.\MT_Reference_Counted_Event_Handler_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "MT_Reference_Counted_Notify_Test"=.\MT_Reference_Counted_Notify_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "MT_SOCK_Test"=.\MT_SOCK_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Malloc_Test"=.\Malloc_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Map_Manager_Test"=.\Map_Manager_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Map_Test"=.\Map_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Max_Default_Port_Test"=.\Max_Default_Port_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Mem_Map_Test"=.\Mem_Map_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Message_Block_Test"=.\Message_Block_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Message_Queue_Notifications_Test"=.\Message_Queue_Notifications_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Message_Queue_Test"=.\Message_Queue_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Message_Queue_Test_Ex"=.\Message_Queue_Test_Ex.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Multicast_Test"=.\Multicast_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Multihomed_INET_Addr_Test"=.\Multihomed_INET_Addr_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Naming_Test"=.\Naming_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "New_Fail_Test"=.\New_Fail_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "NonBlocking_Conn_Test"=.\NonBlocking_Conn_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Notify_Performance_Test"=.\Notify_Performance_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "OS_Test"=.\OS_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Object_Manager_Test"=.\Object_Manager_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Obstack_Test"=.\Obstack_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "OrdMultiSet_Test"=.\OrdMultiSet_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Pipe_Test"=.\Pipe_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Priority_Buffer_Test"=.\Priority_Buffer_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Priority_Reactor_Test"=.\Priority_Reactor_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Priority_Task_Test"=.\Priority_Task_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Proactor_Scatter_Gather_Test"=.\Proactor_Scatter_Gather_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Proactor_Test"=.\Proactor_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Proactor_Timer_Test"=.\Proactor_Timer_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "Process_Manager_Test"=.\Process_Manager_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Process_Mutex_Test"=.\Process_Mutex_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Process_Strategy_Test"=.\Process_Strategy_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "RB_Tree_Test"=.\RB_Tree_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Reactor_Dispatch_Order_Test"=.\Reactor_Dispatch_Order_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Reactor_Exceptions_Test"=.\Reactor_Exceptions_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Reactor_Notify_Test"=.\Reactor_Notify_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Reactor_Performance_Test"=.\Reactor_Performance_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Reactor_Registration_Test"=.\Reactor_Registration_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Reactor_Timer_Test"=.\Reactor_Timer_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Reactors_Test"=.\Reactors_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Reader_Writer_Test"=.\Reader_Writer_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Recursive_Condition_Bug_Test"=.\Recursive_Condition_Bug_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Recursive_Condition_Test"=.\Recursive_Condition_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Recursive_Mutex_Test"=.\Recursive_Mutex_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Refcounted_Auto_Ptr_Test"=.\Refcounted_Auto_Ptr_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Reference_Counted_Event_Handler_Test"=.\Reference_Counted_Event_Handler_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Reverse_Lock_Test"=.\Reverse_Lock_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "SOCK_Connector_Test"=.\SOCK_Connector_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "SOCK_Send_Recv_Test"=.\SOCK_Send_Recv_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "SOCK_Test"=.\SOCK_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "SPIPE_Test"=.\SPIPE_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "SString_Test"=.\SString_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "SV_Shared_Memory_Test"=.\SV_Shared_Memory_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Semaphore_Test"=.\Semaphore_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Service_Config_DLL"=.\Service_Config_DLL.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "Service_Config_Test"=.\Service_Config_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Service_Config_DLL
End Project Dependency
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Sigset_Ops_Test"=.\Sigset_Ops_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Simple_Message_Block_Test"=.\Simple_Message_Block_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Svc_Handler_Test"=.\Svc_Handler_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "TP_Reactor_Test"=.\TP_Reactor_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "TSS_Test"=.\TSS_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Task_Test"=.\Task_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Test_Output DLL"=.\Test_Output.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "Thread_Manager_Test"=.\Thread_Manager_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Thread_Mutex_Test"=.\Thread_Mutex_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Thread_Pool_Reactor_Resume_Test"=.\Thread_Pool_Reactor_Resume_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Thread_Pool_Reactor_Test"=.\Thread_Pool_Reactor_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Thread_Pool_Test"=.\Thread_Pool_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Time_Service_Test"=.\Time_Service_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Time_Value_Test"=.\Time_Value_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Timeprobe_Test"=.\Timeprobe_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Timer_Cancellation_Test"=.\Timer_Cancellation_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Timer_Queue_Reference_Counting_Test"=.\Timer_Queue_Reference_Counting_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Timer_Queue_Test"=.\Timer_Queue_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Token_Strategy_Test"=.\Token_Strategy_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Tokens_Test"=.\Tokens_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "UPIPE_SAP_Test"=.\UPIPE_SAP_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Unbounded_Set_Test_Ex"=.\Unbounded_Set_Test_Ex.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Upgradable_RW_Test"=.\Upgradable_RW_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "Vector_Test"=.\Vector_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Project: "WFMO_Reactor_Test"=.\WFMO_Reactor_Test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name Test_Output DLL
End Project Dependency
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
\ No newline at end of file diff --git a/tests/tests.icp b/tests/tests.icp index 7e580d72b66..f8388513b13 100644 --- a/tests/tests.icp +++ b/tests/tests.icp @@ -2,7 +2,7 @@ // // Visual Age C++ 5 Project file for building all the tests. -subproject libTest_Output icc "libTest_Output.icc", ics "libTest_Output.ics" +subproject Aio_Platform_Test icc "Aio_Platform_Test.icc", ics "Aio_Platform_Test.ics" { } @@ -14,10 +14,6 @@ subproject ARGV_Test icc "ARGV_Test.icc", ics "ARGV_Test.ics" { } -subproject Aio_Platform_Test icc "Aio_Platform_Test.icc", ics "Aio_Platform_Test.ics" -{ -} - subproject Atomic_Op_Test icc "Atomic_Op_Test.icc", ics "Atomic_Op_Test.ics" { } @@ -42,31 +38,31 @@ subproject Buffer_Stream_Test icc "Buffer_Stream_Test.icc", ics "Buffer_Stream_T { } -subproject CDR_Array_Test icc "CDR_Array_Test.icc", ics "CDR_Array_Test.ics" +subproject Cache_Map_Manager_Test icc "Cache_Map_Manager_Test.icc", ics "Cache_Map_Manager_Test.ics" { } -subproject CDR_File_Test icc "CDR_File_Test.icc", ics "CDR_File_Test.ics" +subproject Cached_Accept_Conn_Test icc "Cached_Accept_Conn_Test.icc", ics "Cached_Accept_Conn_Test.ics" { } -subproject CDR_Test icc "CDR_Test.icc", ics "CDR_Test.ics" +subproject Cached_Conn_Test icc "Cached_Conn_Test.icc", ics "Cached_Conn_Test.ics" { } -subproject Cache_Map_Manager_Test icc "Cache_Map_Manager_Test.icc", ics "Cache_Map_Manager_Test.ics" +subproject Capabilities_Test icc "Capabilities_Test.icc", ics "Capabilities_Test.ics" { } -subproject Cached_Accept_Conn_Test icc "Cached_Accept_Conn_Test.icc", ics "Cached_Accept_Conn_Test.ics" +subproject CDR_Array_Test icc "CDR_Array_Test.icc", ics "CDR_Array_Test.ics" { } -subproject Cached_Conn_Test icc "Cached_Conn_Test.icc", ics "Cached_Conn_Test.ics" +subproject CDR_File_Test icc "CDR_File_Test.icc", ics "CDR_File_Test.ics" { } -subproject Capabilities_Test icc "Capabilities_Test.icc", ics "Capabilities_Test.ics" +subproject CDR_Test icc "CDR_Test.icc", ics "CDR_Test.ics" { } @@ -86,11 +82,11 @@ subproject Date_Time_Test icc "Date_Time_Test.icc", ics "Date_Time_Test.ics" { } -subproject DLL_Test icc "DLL_Test.icc", ics "DLL_Test.ics" +subproject Dirent_Test icc "Dirent_Test.icc", ics "Dirent_Test.ics" { } -subproject libDLL_Test icc "libDLL_Test.icc", ics "libDLL_Test.ics" +subproject DLL_Test icc "DLL_Test.icc", ics "DLL_Test.ics" { } @@ -98,10 +94,6 @@ subproject DLList_Test icc "DLList_Test.icc", ics "DLList_Test.ics" { } -subproject Dirent_Test icc "Dirent_Test.icc", ics "Dirent_Test.ics" -{ -} - subproject Dynamic_Priority_Test icc "Dynamic_Priority_Test.icc", ics "Dynamic_Priority_Test.ics" { } @@ -162,31 +154,23 @@ subproject Lazy_Map_Manager_Test icc "Lazy_Map_Manager_Test.icc", ics "Lazy_Map_ { } -subproject Log_Msg_Test icc "Log_Msg_Test.icc", ics "Log_Msg_Test.ics" -{ -} - -subproject Logging_Strategy_Test icc "Logging_Strategy_Test.icc", ics "Logging_Strategy_Test.ics" -{ -} - -subproject MEM_Stream_Test icc "MEM_Stream_Test.icc", ics "MEM_Stream_Test.ics" +subproject libDLL_Test icc "libDLL_Test.icc", ics "libDLL_Test.ics" { } -subproject MM_Shared_Memory_Test icc "MM_Shared_Memory_Test.icc", ics "MM_Shared_Memory_Test.ics" +subproject libService_Config_DLL icc "libService_Config_DLL.icc", ics "libService_Config_DLL.ics" { } -subproject MT_Reactor_Timer_Test icc "MT_Reactor_Timer_Test.icc", ics "MT_Reactor_Timer_Test.ics" +subproject libTest_Output icc "libTest_Output.icc", ics "libTest_Output.ics" { } -subproject MT_Reactor_Upcall_Test icc "MT_Reactor_Upcall_Test.icc", ics "MT_Reactor_Upcall_Test.ics" +subproject Log_Msg_Test icc "Log_Msg_Test.icc", ics "Log_Msg_Test.ics" { } -subproject MT_SOCK_Test icc "MT_SOCK_Test.icc", ics "MT_SOCK_Test.ics" +subproject Logging_Strategy_Test icc "Logging_Strategy_Test.icc", ics "Logging_Strategy_Test.ics" { } @@ -210,6 +194,10 @@ subproject Mem_Map_Test icc "Mem_Map_Test.icc", ics "Mem_Map_Test.ics" { } +subproject MEM_Stream_Test icc "MEM_Stream_Test.icc", ics "MEM_Stream_Test.ics" +{ +} + subproject Message_Block_Test icc "Message_Block_Test.icc", ics "Message_Block_Test.ics" { } @@ -226,6 +214,30 @@ subproject Message_Queue_Test_Ex icc "Message_Queue_Test_Ex.icc", ics "Message_Q { } +subproject MM_Shared_Memory_Test icc "MM_Shared_Memory_Test.icc", ics "MM_Shared_Memory_Test.ics" +{ +} + +subproject MT_Reactor_Timer_Test icc "MT_Reactor_Timer_Test.icc", ics "MT_Reactor_Timer_Test.ics" +{ +} + +subproject MT_Reactor_Upcall_Test icc "MT_Reactor_Upcall_Test.icc", ics "MT_Reactor_Upcall_Test.ics" +{ +} + +subproject MT_Reference_Counted_Event_Handler_Test icc "MT_Reference_Counted_Event_Handler_Test.icc", ics "MT_Reference_Counted_Event_Handler_Test.ics" +{ +} + +subproject MT_Reference_Counted_Notify_Test icc "MT_Reference_Counted_Nofity_Test.icc", ics "MT_Reference_Counted_Notify_Test.ics" +{ +} + +subproject MT_SOCK_Test icc "MT_SOCK_Test.icc", ics "MT_SOCK_Test.ics" +{ +} + subproject Multihomed_INET_Addr_Test icc "Multihomed_INET_Addr_Test.icc", ics "Multihomed_INET_Addr_Test.ics" { } @@ -238,11 +250,11 @@ subproject New_Fail_Test icc "New_Fail_Test.icc", ics "New_Fail_Test.ics" { } -subproject Notify_Performance_Test icc "Notify_Performance_Test.icc", ics "Notify_Performance_Test.ics" +subproject NonBlocking_Conn_Test icc "NonBlocking_Conn_Test.icc", ics "NonBlocking_Conn_Test.ics" { } -subproject OS_Test icc "OS_Test.icc", ics "OS_Test.ics" +subproject Notify_Performance_Test icc "Notify_Performance_Test.icc", ics "Notify_Performance_Test.ics" { } @@ -258,6 +270,10 @@ subproject OrdMultiSet_Test icc "OrdMultiSet_Test.icc", ics "OrdMultiSet_Test.ic { } +subproject OS_Test icc "OS_Test.icc", ics "OS_Test.ics" +{ +} + subproject Pipe_Test icc "Pipe_Test.icc", ics "Pipe_Test.ics" { } @@ -290,6 +306,10 @@ subproject RB_Tree_Test icc "RB_Tree_Test.icc", ics "RB_Tree_Test.ics" { } +subproject Reactor_Dispatch_Order_Test icc "Reactor_Dispatch_Order_Test.icc", ics "Reactor_Dispatch_Order_Test.ics" +{ +} + subproject Reactor_Exceptions_Test icc "Reactor_Exceptions_Test.icc", ics "Reactor_Exceptions_Test.ics" { } @@ -298,11 +318,11 @@ subproject Reactor_Notify_Test icc "Reactor_Notify_Test.icc", ics "Reactor_Notif { } -subproject Reactor_Dispatch_Order_Test icc "Reactor_Dispatch_Order_Test.icc", ics "Reactor_Dispatch_Order_Test.ics" +subproject Reactor_Performance_Test icc "Reactor_Performance_Test.icc", ics "Reactor_Performance_Test.ics" { } -subproject Reactor_Performance_Test icc "Reactor_Performance_Test.icc", ics "Reactor_Performance_Test.ics" +subproject Reactor_Registration_Test icc "Reactor_Registration_Test.icc", ics "Reactor_Registration_Test.ics" { } @@ -330,59 +350,59 @@ subproject Refcounted_Auto_Ptr_Test icc "Refcounted_Auto_Ptr_Test.icc", ics "Ref { } -subproject Reverse_Lock_Test icc "Reverse_Lock_Test.icc", ics "Reverse_Lock_Test.ics" +subproject Reference_Counted_Event_Handler_Test icc "Reference_Counted_Event_Handler_Test.icc", ics "Reference_Counted_Event_Handler_Test.ics" { } -subproject Service_Config_Test icc "Service_Config_Test.icc", ics "Service_Config_Test.ics" +subproject Reverse_Lock_Test icc "Reverse_Lock_Test.icc", ics "Reverse_Lock_Test.ics" { } -subproject libService_Config_DLL icc "libService_Config_DLL.icc", ics "libService_Config_DLL.ics" +subproject Semaphore_Test icc "Semaphore_Test.icc", ics "Semaphore_Test.ics" { } -subproject SOCK_Connector_Test icc "SOCK_Connector_Test.icc", ics "SOCK_Connector_Test.ics" +subproject Service_Config_Test icc "Service_Config_Test.icc", ics "Service_Config_Test.ics" { } -subproject SOCK_Send_Recv_Test icc "SOCK_Send_Recv_Test.icc", ics "SOCK_Send_Recv_Test.ics" +subproject Service_Config_Test icc "Service_Config_Test.icc", ics "Service_Config_Test.ics" { } -subproject SOCK_Test icc "SOCK_Test.icc", ics "SOCK_Test.ics" +subproject Signal_Test icc "Signal_Test.icc", ics "Signal_Test.ics" { } -subproject SPIPE_Test icc "SPIPE_Test.icc", ics "SPIPE_Test.ics" +subproject Sigset_Ops_Test icc "Sigset_Ops_Test.icc", ics "Sigset_Ops_Test.ics" { } -subproject SString_Test icc "SString_Test.icc", ics "SString_Test.ics" +subproject Simple_Message_Block_Test icc "Simple_Message_Block_Test.icc", ics "Simple_Message_Block_Test.ics" { } -subproject SV_Shared_Memory_Test icc "SV_Shared_Memory_Test.icc", ics "SV_Shared_Memory_Test.ics" +subproject SOCK_Connector_Test icc "SOCK_Connector_Test.icc", ics "SOCK_Connector_Test.ics" { } -subproject Semaphore_Test icc "Semaphore_Test.icc", ics "Semaphore_Test.ics" +subproject SOCK_Send_Recv_Test icc "SOCK_Send_Recv_Test.icc", ics "SOCK_Send_Recv_Test.ics" { } -subproject Service_Config_Test icc "Service_Config_Test.icc", ics "Service_Config_Test.ics" +subproject SOCK_Test icc "SOCK_Test.icc", ics "SOCK_Test.ics" { } -subproject Signal_Test icc "Signal_Test.icc", ics "Signal_Test.ics" +subproject SPIPE_Test icc "SPIPE_Test.icc", ics "SPIPE_Test.ics" { } -subproject Sigset_Ops_Test icc "Sigset_Ops_Test.icc", ics "Sigset_Ops_Test.ics" +subproject SString_Test icc "SString_Test.icc", ics "SString_Test.ics" { } -subproject Simple_Message_Block_Test icc "Simple_Message_Block_Test.icc", ics "Simple_Message_Block_Test.ics" +subproject SV_Shared_Memory_Test icc "SV_Shared_Memory_Test.icc", ics "SV_Shared_Memory_Test.ics" { } @@ -390,10 +410,6 @@ subproject Svc_Handler_Test icc "Svc_Handler_Test.icc", ics "Svc_Handler_Test.ic { } -subproject TSS_Test icc "TSS_Test.icc", ics "TSS_Test.ics" -{ -} - subproject Task_Test icc "Task_Test.icc", ics "Task_Test.ics" { } @@ -406,11 +422,11 @@ subproject Thread_Mutex_Test icc "Thread_Mutex_Test.icc", ics "Thread_Mutex_Test { } -subproject Thread_Pool_Reactor_Test icc "Thread_Pool_Reactor_Test.icc", ics "Thread_Pool_Reactor_Test.ics" +subproject Thread_Pool_Reactor_Resume_Test icc "Thread_Pool_Reactor_Resume_Test.icc", ics "Thread_Pool_Reactor_Resume_Test.ics" { } -subproject Thread_Pool_Reactor_Resume_Test icc "Thread_Pool_Reactor_Resume_Test.icc", ics "Thread_Pool_Reactor_Resume_Test.ics" +subproject Thread_Pool_Reactor_Test icc "Thread_Pool_Reactor_Test.icc", ics "Thread_Pool_Reactor_Test.ics" { } @@ -430,6 +446,14 @@ subproject Timeprobe_Test icc "Timeprobe_Test.icc", ics "Timeprobe_Test.ics" { } +subproject Timer_Cancellation_Test icc "Timer_Cancellation_Test.icc", ics "Timer_Cancellation_Test.ics" +{ +} + +subproject Timer_Queue_Reference_Counting_Test icc "Timer_Queue_Reference_Counting_Test.icc", ics "Timer_Queue_Reference_Counting_Test.ics" +{ +} + subproject Timer_Queue_Test icc "Timer_Queue_Test.icc", ics "Timer_Queue_Test.ics" { } @@ -442,7 +466,7 @@ subproject Tokens_Test icc "Tokens_Test.icc", ics "Tokens_Test.ics" { } -subproject UPIPE_SAP_Test icc "UPIPE_SAP_Test.icc", ics "UPIPE_SAP_Test.ics" +subproject TSS_Test icc "TSS_Test.icc", ics "TSS_Test.ics" { } @@ -454,10 +478,18 @@ subproject Upgradable_RW_Test icc "Upgradable_RW_Test.icc", ics "Upgradable_RW_T { } +subproject UPIPE_SAP_Test icc "UPIPE_SAP_Test.icc", ics "UPIPE_SAP_Test.ics" +{ +} + subproject Vector_Test icc "Vector_Test.icc", ics "Vector_Test.ics" { } +subproject WFMO_Reactor_Test icc "WFMO_Reactor_Test.icc", ics "WFMO_Reactor_Test.ics" +{ +} + subproject XtReactor_Test icc "XtReactor_Test.icc", ics "XtReactor_Test.ics" { } @@ -465,27 +497,26 @@ subproject XtReactor_Test icc "XtReactor_Test.icc", ics "XtReactor_Test.ics" build all { -use ARGV_Test use Aio_Platform_Test +use ARGV_Test use Atomic_Op_Test use Auto_IncDec_Test use Barrier_Test use Basic_Types_Test use Buffer_Stream_Test -use CDR_Array_Test -use CDR_File_Test -use CDR_Test use Cache_Map_Manager_Test use Cached_Accept_Conn_Test use Cached_Conn_Test use Capabilities_Test +use CDR_Array_Test +use CDR_File_Test +use CDR_Test use Collection_Test use Config_Test use Conn_Test +use Dirent_Test use DLL_Test -use libDLL_Test use DLList_Test -use Dirent_Test use Dynamic_Priority_Test use Enum_Interfaces_Test use Env_Value_Test @@ -499,27 +530,32 @@ use Hash_Map_Manager_Test use High_Res_Timer_Test use IOStream_Test use Lazy_Map_Manager_Test +use libDLL_Test +use libTest_Output use Log_Msg_Test use Logging_Strategy_Test -use MEM_Stream_Test -use MM_Shared_Memory_Test -use MT_Reactor_Timer_Test -use MT_Reactor_Upcall_Test -use MT_SOCK_Test use Malloc_Test use Map_Manager_Test use Map_Test use Mem_Map_Test +use MEM_Stream_Test use Message_Block_Test use Message_Queue_Notifications_Test use Message_Queue_Test use Message_Queue_Test_Ex +use MM_Shared_Memory_Test +use MT_Reactor_Timer_Test +use MT_Reactor_Upcall_Test +use MT_Reference_Counted_Event_Handler_Test +use MT_Reference_Counted_Notify_Test +use MT_SOCK_Test use Naming_Test use New_Fail_Test +use NonBlocking_Conn_Test use Notify_Performance_Test -use OS_Test use Object_Manager_Test use OrdMultiSet_Test +use OS_Test use Pipe_Test use Priority_Buffer_Test use Priority_Reactor_Test @@ -528,29 +564,30 @@ use Process_Manager_Test use Process_Mutex_Test use Process_Strategy_Test use RB_Tree_Test +use Reactor_Dispatch_Order_Test use Reactor_Exceptions_Test use Reactor_Notify_Test -use Reactor_Dispatch_Order_Test use Reactor_Performance_Test +use Reactor_Registration_Test use Reactor_Timer_Test use Reactors_Test use Reader_Writer_Test use Recursive_Mutex_Test use Refcounted_Auto_Ptr_Test +use Reference_Counted_Event_Handler_Test use Reverse_Lock_Test +use Semaphore_Test +use Service_Config_Test +use Signal_Test +use Sigset_Ops_Test +use Simple_Message_Block_Test use SOCK_Connector_Test use SOCK_Send_Recv_Test use SOCK_Test use SPIPE_Test use SString_Test use SV_Shared_Memory_Test -use Semaphore_Test -use Service_Config_Test -use Signal_Test -use Sigset_Ops_Test -use Simple_Message_Block_Test use Svc_Handler_Test -use TSS_Test use Task_Test use Thread_Manager_Test use Thread_Mutex_Test @@ -559,12 +596,16 @@ use Thread_Pool_Test use Time_Service_Test use Time_Value_Test use Timeprobe_Test +use Timer_Cancellation_Test +use Timer_Queue_Reference_Counting_Test use Timer_Queue_Test use TkReactor_Test use Tokens_Test -use UPIPE_SAP_Test +use TSS_Test use Unbounded_Set_Test_Ex use Upgradable_RW_Test +use UPIPE_SAP_Test use Vector_Test +use WFMO_Reactor_Test use XtReactor_Test } diff --git a/tests/tests.mpc b/tests/tests.mpc index d6691bc9979..f59fc013bde 100644 --- a/tests/tests.mpc +++ b/tests/tests.mpc @@ -930,3 +930,75 @@ project(FIFO Test) : acetest { Header_Files { } } + +project(WFMO Reactor Test) : aceexe { + exename = WFMO_Reactor_Test + Source_Files { + WFMO_Reactor_Test.cpp + } + Header_Files { + } +} + +project(NonBlocking Conn Test) : aceexe { + exename = NonBlocking_Conn_Test + Source_Files { + NonBlocking_Conn_Test.cpp + } + Header_Files { + } +} + +project(Reference Counted Event Handler Test) : aceexe { + exename = Reference_Counted_Event_Handler_Test + Source_Files { + Reference_Counted_Event_Handler_Test.cpp + } + Header_Files { + } +} + +project(MT Reference Counted Event Handler Test) : aceexe { + exename = MT_Reference_Counted_Event_Handler_Test + Source_Files { + MT_Reference_Counted_Event_Handler_Test.cpp + } + Header_Files { + } +} + +project(MT Reference Counted Notify Test) : aceexe { + exename = MT_Reference_Counted_Notify_Test + Source_Files { + MT_Reference_Counted_Notify_Test.cpp + } + Header_Files { + } +} + +project(Timer Cancellation Test) : aceexe { + exename = Timer_Cancellation_Test + Source_Files { + Timer_Cancellation_Test.cpp + } + Header_Files { + } +} + +project(Timer Queue Reference Counting Test) : aceexe { + exename = Timer_Queue_Reference_Counting_Test + Source_Files { + Timer_Queue_Reference_Counting_Test.cpp + } + Header_Files { + } +} + +project(Reactor Registration Test) : aceexe { + exename = Reactor_Registration_Test + Source_Files { + Reactor_Registration_Test.cpp + } + Header_Files { + } +} |