diff options
Diffstat (limited to 'tests/Conn_Test.cpp')
-rw-r--r-- | tests/Conn_Test.cpp | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/tests/Conn_Test.cpp b/tests/Conn_Test.cpp index 46a23e23a31..1d38280f55a 100644 --- a/tests/Conn_Test.cpp +++ b/tests/Conn_Test.cpp @@ -175,6 +175,8 @@ Svc_Handler::idle (u_long flags) return ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>::idle (flags); } +// **************************************** + // The following works around bugs with some operating systems, which // don't allow multiple threads/process to call accept() on the same // listen-mode port/socket. @@ -226,9 +228,7 @@ timed_blocking_connect (CONNECTOR &con, // Perform a timed-blocking connect to the server (this should // connect quickly since we're in the same address space or same // host). - if (con.connect (svc_handler, - server_addr, - options) == -1) + if (con.connect (svc_handler, server_addr, options) == -1) ACE_ERROR ((LM_ERROR, ASYS_TEXT ("(%P|%t) %p\n"), ASYS_TEXT ("connection failed"))); @@ -254,8 +254,7 @@ blocking_connect (CONNECTOR &con, Svc_Handler); // Perform a blocking connect to the server. - if (con.connect (svc_handler, - server_addr) == -1) + if (con.connect (svc_handler, server_addr) == -1) ACE_ERROR ((LM_ERROR, ASYS_TEXT ("(%P|%t) %p\n"), ASYS_TEXT ("connection failed"))); @@ -288,8 +287,7 @@ cached_connect (STRAT_CONNECTOR &con, // connecting to the same <server_addr> these calls will return // the same dynamically allocated <Svc_Handler> for each // <connect>. - if (con.connect (svc_handler, - server_addr) == -1) + if (con.connect (svc_handler, server_addr) == -1) { ACE_ERROR ((LM_ERROR, ASYS_TEXT ("(%P|%t) %p\n"), @@ -362,6 +360,7 @@ client_connections (void *arg) ASYS_TEXT ("(%P|%t) **** starting cached blocking connect\n"))); cached_connect (*info->strat_connector_, *info->server_addr_); + return 0; } @@ -467,10 +466,12 @@ server (void *arg) return 0; } else - ACE_ERROR_RETURN ((LM_ERROR, - ASYS_TEXT ("(%P|%t) %p\n"), - ASYS_TEXT ("accept failed, shutting down")), - 0); + { + ACE_ERROR_RETURN ((LM_ERROR, + ASYS_TEXT ("(%P|%t) %p\n"), + ASYS_TEXT ("accept failed, shutting down")), + 0); + } } ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("(%P|%t) client %s connected from %d\n"), @@ -572,19 +573,14 @@ spawn_threads (ACCEPTOR *acceptor, #if defined (VXWORKS) // Assign thread (VxWorks task) names to test that feature. ACE_thread_t *server_name; - ACE_NEW_RETURN (server_name, - ACE_thread_t[n_servers], - -1); + ACE_NEW_RETURN (server_name, ACE_thread_t[n_servers], -1); // And test ability to provide stacks. size_t *stack_size; - ACE_NEW_RETURN (stack_size, - size_t[n_servers], - -1); + ACE_NEW_RETURN (stack_size, size_t[n_servers], -1); char **stack; - ACE_NEW_RETURN (stack, - char *[n_servers], - -1); + ACE_NEW_RETURN (stack, char *[n_servers], -1); + int i; for (i = 0; i < n_servers; ++i) @@ -705,12 +701,10 @@ main (int argc, ASYS_TCHAR *argv[]) { ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("(%P|%t) starting server at port %d\n"), - server_addr.get_port_number ())); #if !defined (ACE_LACKS_FORK) - if (spawn_processes (&acceptor, - &server_addr) == -1) + if (spawn_processes (&acceptor, &server_addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, ASYS_TEXT ("(%P|%r) %p\n"), ASYS_TEXT ("spawn_processes")), @@ -719,8 +713,7 @@ main (int argc, ASYS_TCHAR *argv[]) status = spawn_threads (&acceptor, &server_addr); #else /* ACE_LACKS_FORK && ! ACE_HAS_THREADS */ ACE_ERROR ((LM_ERROR, - ASYS_TEXT ("(%P|%t) only one thread may be run in a process on this platform\n%a"), - 1)); + ASYS_TEXT ("(%P|%t) only one thread may be run in a process on this platform\n%a"), 1)); #endif /* ACE_LACKS_FORK && ! ACE_HAS_THREADS */ } |