diff options
author | vzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2010-09-02 14:51:58 +0000 |
---|---|---|
committer | vzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2010-09-02 14:51:58 +0000 |
commit | 9d52cd71390d9e0de7d6461bc186b9da28f2b652 (patch) | |
tree | b12714f96f26114214f514ee8c1fe6bdc34d2706 /ACE/tests/SOCK_Test.cpp | |
parent | 74a8ffda3b866a763ca5c0d54b2ab4cf41ce206a (diff) | |
download | ATCD-9d52cd71390d9e0de7d6461bc186b9da28f2b652.tar.gz |
Thu Sep 2 14:46:56 UTC 2010 Vladimir Zykov <vladimir.zykov@prismtech.com>
* ace/Acceptor.cpp:
* ace/SOCK_IO.cpp:
* ace/SOCK_Dgram.cpp:
* ace/ACE.cpp:
* tests/SOCK_Test.cpp:
* tests/MT_SOCK_Test.cpp:
* NEWS:
Reverted both commits by Steve Huston related to handle_ready()
and a NEWS entry.
Wed Sep 1 19:31:24 UTC 2010 Steve Huston <shuston@riverace.com>
Fri Aug 27 19:17:11 UTC 2010 Steve Huston <shuston@riverace.com>
This is necessary for a quick release of 1.8.2.
Diffstat (limited to 'ACE/tests/SOCK_Test.cpp')
-rw-r--r-- | ACE/tests/SOCK_Test.cpp | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/ACE/tests/SOCK_Test.cpp b/ACE/tests/SOCK_Test.cpp index a26b66b6243..34000f53eee 100644 --- a/ACE/tests/SOCK_Test.cpp +++ b/ACE/tests/SOCK_Test.cpp @@ -22,12 +22,14 @@ #include "test_config.h" #include "ace/OS_NS_unistd.h" +#include "ace/OS_NS_sys_select.h" #include "ace/OS_NS_sys_wait.h" #include "ace/Thread.h" #include "ace/Time_Value.h" #include "ace/Thread_Manager.h" #include "ace/SOCK_Connector.h" #include "ace/SOCK_Acceptor.h" +#include "ace/Handle_Set.h" ACE_RCSID(tests, SOCK_Test, "$Id$") @@ -67,20 +69,6 @@ client (void *arg) if (cli_stream.disable (ACE_NONBLOCK) == -1) ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("disable"))); - // Test Bug 3606 - const ACE_Time_Value def_timeout (ACE_DEFAULT_TIMEOUT); - ACE_Time_Value tv (def_timeout); - int result = ACE::handle_ready (cli_stream.get_handle (), &tv, - 1, // read_ready - 1, // write_ready - 0); - // we expect the handle to be at leat write_ready since it is freshly connected. - if (result == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("(%P|%t) %p\n"), - ACE_TEXT ("ACE::handle_ready")), - 0); - // Send data to server (correctly handles "incomplete writes"). for (const char *c = ACE_ALPHABET; *c != '\0'; c++) @@ -116,20 +104,31 @@ server (void *arg) // calls... ACE_SOCK_Stream new_stream; ACE_INET_Addr cli_addr; + ACE_Handle_Set handle_set; const ACE_Time_Value def_timeout (ACE_DEFAULT_TIMEOUT); ACE_Time_Value tv (def_timeout); char buf[BUFSIZ]; const char *t = ACE_ALPHABET; - int result = ACE::handle_read_ready (peer_acceptor->get_handle (), &tv); - + handle_set.reset (); + handle_set.set_bit (peer_acceptor->get_handle ()); + + int select_width; +# if defined (ACE_WIN64) + // This arg is ignored on Windows and causes pointer truncation + // warnings on 64-bit compiles. + select_width = 0; +# else + select_width = int (peer_acceptor->get_handle ()) + 1; +# endif /* ACE_WIN64 */ + int result = ACE_OS::select (select_width, + handle_set, + 0, 0, &tv); ACE_ASSERT (tv == def_timeout); if (result == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("(%P|%t) %p\n"), - ACE_TEXT ("handle_read_ready")), 0); + ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("select")), 0); else if (result == 0) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) select timed out, shutting down\n"))); @@ -148,11 +147,24 @@ server (void *arg) if (new_stream.enable (ACE_NONBLOCK) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("enable")), 0); + handle_set.reset (); + handle_set.set_bit (new_stream.get_handle ()); + // Read data from client (terminate on error). + int select_width; for (ssize_t r_bytes; ;) { - if (ACE::handle_read_ready (new_stream.get_handle (), 0) == -1) - ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("handle_read_ready")), 0); +# if defined (ACE_WIN64) + // This arg is ignored on Windows and causes pointer truncation + // warnings on 64-bit compiles. + select_width = 0; +# else + select_width = int (new_stream.get_handle ()) + 1; +# endif /* ACE_WIN64 */ + if (ACE_OS::select (select_width, + handle_set, + 0, 0, 0) == -1) + ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("select")), 0); while ((r_bytes = new_stream.recv (buf, 1)) > 0) { |