From da66918781d560d8b0c3f10b678d18bc24781653 Mon Sep 17 00:00:00 2001 From: bala Date: Sat, 23 Jun 2001 13:37:31 +0000 Subject: ChangeLogTag: Sat Jun 23 08:34:54 2001 Balachandran Natarajan --- ChangeLog | 8 ++++ ChangeLogs/ChangeLog-02a | 8 ++++ ChangeLogs/ChangeLog-03a | 8 ++++ tests/Max_Default_Port_Test.cpp | 90 ++++++++++++++++++++--------------------- tests/run_test.lst | 2 +- 5 files changed, 70 insertions(+), 46 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5fc0ea776b7..9ac55c78161 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Sat Jun 23 08:34:54 2001 Balachandran Natarajan + + * tests/Max_Default_Port_Test.cpp: Fixed a unused warning in + Single Threaded builds. + + * tests/run_tests.lst: Prevented the above test from running in + Single Threaded configurations. + Sat Jun 23 06:19:39 2001 Douglas C. Schmidt * ace/OS.i: For some god knows why reason, _POSIX_C_SOURCE doesn't diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a index 5fc0ea776b7..9ac55c78161 100644 --- a/ChangeLogs/ChangeLog-02a +++ b/ChangeLogs/ChangeLog-02a @@ -1,3 +1,11 @@ +Sat Jun 23 08:34:54 2001 Balachandran Natarajan + + * tests/Max_Default_Port_Test.cpp: Fixed a unused warning in + Single Threaded builds. + + * tests/run_tests.lst: Prevented the above test from running in + Single Threaded configurations. + Sat Jun 23 06:19:39 2001 Douglas C. Schmidt * ace/OS.i: For some god knows why reason, _POSIX_C_SOURCE doesn't diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index 5fc0ea776b7..9ac55c78161 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,11 @@ +Sat Jun 23 08:34:54 2001 Balachandran Natarajan + + * tests/Max_Default_Port_Test.cpp: Fixed a unused warning in + Single Threaded builds. + + * tests/run_tests.lst: Prevented the above test from running in + Single Threaded configurations. + Sat Jun 23 06:19:39 2001 Douglas C. Schmidt * ace/OS.i: For some god knows why reason, _POSIX_C_SOURCE doesn't diff --git a/tests/Max_Default_Port_Test.cpp b/tests/Max_Default_Port_Test.cpp index 0dbd0a41ef9..5a979719166 100644 --- a/tests/Max_Default_Port_Test.cpp +++ b/tests/Max_Default_Port_Test.cpp @@ -8,18 +8,18 @@ // Max_Default_Port_Test.cpp // // = DESCRIPTION -// This is a test for ACE_MAX_DEFAULT_PORT value. The test tests the +// This is a test for ACE_MAX_DEFAULT_PORT value. The test tests the // highest value of the port number at which an event handler can be // registered and a Connector can be connected to. // // Some weird behaviour has been reported on Windows NT (sp 3) when // the port number exceeds 65279 resulting ACE_MAX_DEFAULT_PORT to set -// to zero on that platform. +// to zero on that platform. // -// In this test, the event handler is started at the port value +// In this test, the event handler is started at the port value // USHRT_MAX and decremented for 300 port values and tested if the // highest port number used agrees with ACE_MAX_DEFAULT_PORT value. -// +// // // = AUTHOR // Chanaka Liyanaarachchi @@ -41,19 +41,19 @@ My_Accept_Handler::My_Accept_Handler (ACE_INET_Addr &addr) if (addr.get_port_number() != 0) this->open (addr); } - -int + +int My_Accept_Handler::open (ACE_INET_Addr &addr) { - + if (peer_acceptor_.open (addr, 1) == -1) - { + { ACE_ERROR ((LM_ERROR, "My_Accept_Handler open %p\n")); ACE_OS::exit (1); - } - + } + return 0; - + } ACE_HANDLE @@ -62,7 +62,7 @@ My_Accept_Handler::get_handle () const return peer_acceptor_.get_handle (); } -int +int My_Accept_Handler::handle_input (ACE_HANDLE) { @@ -79,8 +79,8 @@ My_Accept_Handler::handle_input (ACE_HANDLE) return 0; } -u_short -My_Accept_Handler::port () +u_short +My_Accept_Handler::port () { return this->addr_.get_port_number(); } @@ -92,7 +92,7 @@ client (void *arg) { ACE_INET_Addr *remote_addr = ACE_reinterpret_cast (ACE_INET_Addr *, arg); - + ACE_INET_Addr server_addr (remote_addr->get_port_number (), ACE_LOCALHOST); @@ -115,11 +115,11 @@ client (void *arg) return 0; } - + // if connect succesful, what is the max port number we connected // up to now. int connected_port = server_addr.get_port_number (); - + if (connected_port > max_connected_port) max_connected_port = connected_port; @@ -127,7 +127,7 @@ client (void *arg) return 0; } -int +int main (int argc, ACE_TCHAR *argv[]) { @@ -137,98 +137,98 @@ main (int argc, ACE_TCHAR *argv[]) ACE_UNUSED_ARG (argv); u_short max_listened_port = 0; - + //Ports beyond 65279 were said to bad on NT sp 3. - for (u_short idx = USHRT_MAX; idx != USHRT_MAX - 300; --idx) + for (u_short idx = USHRT_MAX; idx != USHRT_MAX - 300; --idx) { ACE_INET_Addr addr (idx); My_Accept_Handler *eh = new My_Accept_Handler (addr); - + if ( ACE_Reactor::instance()->register_handler ( eh, ACE_Event_Handler::ACCEPT_MASK) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Failed to register event handler %p\n"))); - + ACE_OS::exit (1); - + } - + ACE_DEBUG ((LM_DEBUG, "Registered event handler at %d\n", idx)); - + ACE_Time_Value tv (1); -#if defined (ACE_HAS_THREADS) +#if defined (ACE_HAS_THREADS) if (ACE_Thread_Manager::instance ()->spawn_n (1, ACE_THR_FUNC (client), ACE_reinterpret_cast (void *, &addr), THR_NEW_LWP | THR_DETACHED) == -1) - + ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n%a"), ACE_TEXT ("thread create failed"))); - + ACE_Thread_Manager::instance ()->wait (); - + #else + ACE_UNUSED_ARG (client); ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) only one thread may be run in a process on this platform\n%a"), 1)); -#endif //ACE_HAS_THREADS +#endif //ACE_HAS_THREADS if (ACE_Reactor::instance()->handle_events (tv) == -1 ) { ACE_ERROR ((LM_ERROR, "Reactor::handle_events returned with error\n")); ACE_OS::exit (1); } - + // see if I can register a reactor at this port. - if (eh->port () == idx) + if (eh->port () == idx) { if (idx > max_listened_port) max_listened_port = idx; } - else + else { ACE_ERROR ((LM_ERROR, "Test Fail, listening port %d\n", eh->port())); ACE_OS::exit (1); } - + ACE_Reactor::instance()->remove_handler ( eh, ACE_Event_Handler::ACCEPT_MASK | - ACE_Event_Handler::DONT_CALL); + ACE_Event_Handler::DONT_CALL); delete eh; - } + } - ACE_DEBUG ((LM_DEBUG, - "Value of ACE_MAX_DEFAULT_PORT %d\n", + ACE_DEBUG ((LM_DEBUG, + "Value of ACE_MAX_DEFAULT_PORT %d\n", ACE_MAX_DEFAULT_PORT)); - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "Highest port value I can listen at %d\n", - max_listened_port)); + max_listened_port)); - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "Highest port value I can connect to %d\n", max_connected_port)); - - if ((max_listened_port == ACE_MAX_DEFAULT_PORT) && + + if ((max_listened_port == ACE_MAX_DEFAULT_PORT) && (max_connected_port == ACE_MAX_DEFAULT_PORT)) ACE_DEBUG ((LM_DEBUG, "Valid ACE_MAX_DEFAULT_PORT value \n")); else { ACE_DEBUG ((LM_DEBUG, "Invalid ACE_MAX_DEFAULT_PORT or %d port may be busy\n", ACE_MAX_DEFAULT_PORT)); - + } ACE_END_TEST; return 0; } - diff --git a/tests/run_test.lst b/tests/run_test.lst index 0506f21ce82..f1740eade7b 100644 --- a/tests/run_test.lst +++ b/tests/run_test.lst @@ -49,7 +49,7 @@ Log_Msg_Test Logging_Strategy_Test: !STATIC !ST Map_Manager_Test Map_Test -Max_Default_Port_Test +Max_Default_Port_Test: !ST MEM_Stream_Test: !Linux Mem_Map_Test: !chorus !Unicos Message_Block_Test: !chorus -- cgit v1.2.1