summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-09-02 14:51:58 +0000
committervzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-09-02 14:51:58 +0000
commit9d446c24621ade4dd8d4fe5a65e41bad9ff2485a (patch)
treeb12714f96f26114214f514ee8c1fe6bdc34d2706
parent551e3347e4a9c5f92614c8069e8c6a67ef761bb1 (diff)
downloadATCD-9d446c24621ade4dd8d4fe5a65e41bad9ff2485a.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.
-rw-r--r--ACE/ChangeLog15
-rw-r--r--ACE/NEWS14
-rw-r--r--ACE/ace/ACE.cpp55
-rw-r--r--ACE/ace/Acceptor.cpp21
-rw-r--r--ACE/ace/SOCK_Dgram.cpp61
-rw-r--r--ACE/ace/SOCK_IO.cpp22
-rw-r--r--ACE/tests/MT_SOCK_Test.cpp37
-rw-r--r--ACE/tests/SOCK_Test.cpp54
8 files changed, 203 insertions, 76 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog
index b2f914c9248..4e551a3cf5f 100644
--- a/ACE/ChangeLog
+++ b/ACE/ChangeLog
@@ -1,3 +1,18 @@
+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.
+
Wed Sep 1 19:31:24 UTC 2010 Steve Huston <shuston@riverace.com>
* ace/ACE.cpp (handle_ready): Changed the timeout behavior to just
diff --git a/ACE/NEWS b/ACE/NEWS
index 6f110876368..9c845b1a7b7 100644
--- a/ACE/NEWS
+++ b/ACE/NEWS
@@ -5,20 +5,6 @@ USER VISIBLE CHANGES BETWEEN ACE-5.8.1 and ACE-5.8.2
. Removed complete support for emulated C++ exceptions
-. The ACE::handle_ready() family of methods was changed to prefer using
- poll() over select() on platforms where poll() is available. This preference
- was previously only used if ACE_HAS_LIMITED_SELECT was set. The
- ACE_HAS_LIMITED_SELECT choice is removed, making ACE_HAS_POLL the
- setting that switches this preference. The driving reason for this
- is that if select() is called to detect changes on a handle whose
- values falls outside that which can safely be stored in an fdset,
- the handle-setting macros/functions will set/clear bits outside
- of the fdset. This results in very weird memory changes, often in
- the stack, which are very hard to diagnose. poll()'s operation
- does not suffer from this affect. With the growing use of large
- numbers of handles and use of ACE_Dev_Poll_Reactor on Linux,
- the rate at which this problem was cropping up was increasing.
-
USER VISIBLE CHANGES BETWEEN ACE-5.8.0 and ACE-5.8.1
====================================================
diff --git a/ACE/ace/ACE.cpp b/ACE/ace/ACE.cpp
index 925be0a034b..ba5bbd3a662 100644
--- a/ACE/ace/ACE.cpp
+++ b/ACE/ace/ACE.cpp
@@ -33,9 +33,9 @@ extern "C" int maxFiles;
#include "ace/ACE.inl"
#endif /* __ACE_INLINE__ */
-#if defined (ACE_HAS_POLL)
+#if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT)
# include "ace/OS_NS_poll.h"
-#endif /* ACE_HAS_POLL */
+#endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */
// Open versioned namespace, if enabled by the user.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -2169,19 +2169,14 @@ ACE::handle_ready (ACE_HANDLE handle,
int write_ready,
int exception_ready)
{
-#if defined (ACE_HAS_POLL)
+#if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT)
+ ACE_UNUSED_ARG (write_ready);
ACE_UNUSED_ARG (exception_ready);
struct pollfd fds;
fds.fd = handle;
- fds.events = read_ready ? POLLIN : 0;
-
- if( write_ready )
- {
- fds.events |= POLLOUT;
- }
-
+ fds.events = read_ready ? POLLIN : POLLOUT;
fds.revents = 0;
int result = ACE_OS::poll (&fds, 1, timeout);
@@ -2204,9 +2199,21 @@ ACE::handle_ready (ACE_HANDLE handle,
exception_ready ? handle_set.fdset () : 0, // exception_fds.
timeout);
-#endif /* ACE_HAS_POLL */
+#endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */
- return result;
+ switch (result)
+ {
+ case 0: // Timer expired.
+ errno = ETIME;
+ /* FALLTHRU */
+ case -1: // we got here directly - select() returned -1.
+ return -1;
+ case 1: // Handle has data.
+ /* FALLTHRU */
+ default: // default is case result > 0; return a
+ // ACE_ASSERT (result == 1);
+ return result;
+ }
}
int
@@ -2521,7 +2528,7 @@ ACE::handle_timed_complete (ACE_HANDLE h,
{
ACE_TRACE ("ACE::handle_timed_complete");
-#if !defined (ACE_WIN32) && defined (ACE_HAS_POLL)
+#if !defined (ACE_WIN32) && defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT)
struct pollfd fds;
@@ -2534,7 +2541,7 @@ ACE::handle_timed_complete (ACE_HANDLE h,
ACE_Handle_Set wr_handles;
rd_handles.set_bit (h);
wr_handles.set_bit (h);
-#endif /* !ACE_WIN32 && ACE_HAS_POLL */
+#endif /* !ACE_WIN32 && ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */
#if defined (ACE_WIN32)
// Winsock is different - it sets the exception bit for failed connect,
@@ -2554,7 +2561,7 @@ ACE::handle_timed_complete (ACE_HANDLE h,
ex_handles,
timeout);
#else
-# if defined (ACE_HAS_POLL)
+# if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT)
int n = ACE_OS::poll (&fds, 1, timeout);
@@ -2572,7 +2579,7 @@ ACE::handle_timed_complete (ACE_HANDLE h,
wr_handles,
0,
timeout);
-# endif /* ACE_HAS_POLL */
+# endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */
#endif /* ACE_WIN32 */
// If we failed to connect within the time period allocated by the
@@ -2606,18 +2613,18 @@ ACE::handle_timed_complete (ACE_HANDLE h,
}
#else
if (is_tli)
-# if defined (ACE_HAS_POLL)
+# if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT)
need_to_check = (fds.revents & POLLIN) && !(fds.revents & POLLOUT);
# else
need_to_check = rd_handles.is_set (h) && !wr_handles.is_set (h);
-# endif /* ACE_HAS_POLL */
+# endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */
else
-# if defined (ACE_HAS_POLL)
+# if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT)
need_to_check = (fds.revents & POLLIN);
# else
need_to_check = true;
-# endif /* ACE_HAS_POLL */
+# endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */
#endif /* ACE_WIN32 */
if (need_to_check)
@@ -2679,7 +2686,7 @@ ACE::handle_timed_accept (ACE_HANDLE listener,
if (listener == ACE_INVALID_HANDLE)
return -1;
-#if defined (ACE_HAS_POLL)
+#if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT)
struct pollfd fds;
@@ -2691,13 +2698,13 @@ ACE::handle_timed_accept (ACE_HANDLE listener,
// Use the select() implementation rather than poll().
ACE_Handle_Set rd_handle;
rd_handle.set_bit (listener);
-#endif /* ACE_HAS_POLL */
+#endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */
// We need a loop here if <restart> is enabled.
for (;;)
{
-#if defined (ACE_HAS_POLL)
+#if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT)
int n = ACE_OS::poll (&fds, 1, timeout);
@@ -2713,7 +2720,7 @@ ACE::handle_timed_accept (ACE_HANDLE listener,
int n = ACE_OS::select (select_width,
rd_handle, 0, 0,
timeout);
-#endif /* ACE_HAS_POLL */
+#endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */
switch (n)
{
diff --git a/ACE/ace/Acceptor.cpp b/ACE/ace/Acceptor.cpp
index 6b1a55ae6ff..bf46bff01a5 100644
--- a/ACE/ace/Acceptor.cpp
+++ b/ACE/ace/Acceptor.cpp
@@ -10,10 +10,12 @@
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Acceptor.h"
+#include "ace/Handle_Set.h"
#include "ace/Svc_Handler.h"
#include "ace/WFMO_Reactor.h"
#include "ace/OS_NS_stdio.h"
#include "ace/OS_NS_string.h"
+#include "ace/OS_NS_sys_select.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -363,9 +365,17 @@ template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int
ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::handle_input (ACE_HANDLE listener)
{
ACE_TRACE ("ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::handle_input");
+ ACE_Handle_Set conn_handle;
// Default is "timeout (0, 0)," which means "poll."
ACE_Time_Value timeout;
+# if defined (ACE_WIN32)
+ // This arg is ignored on Windows and causes pointer truncation
+ // warnings on 64-bit compiles
+ int select_width = 0;
+# else
+ int select_width = int (listener) + 1;
+# endif /* ACE_WIN32 */
// Accept connections from clients. Note that a loop is used for two
// reasons:
@@ -422,13 +432,18 @@ ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::handle_input (ACE_HANDLE listene
ACE_TEXT ("activate_svc_handler")));
return 0;
}
+
+ conn_handle.set_bit (listener);
}
// Now, check to see if there is another connection pending and
// break out of the loop if there is none.
- while (this->use_select_ &&
- ACE::handle_read_ready (listener,
- &timeout) == 1);
+ while (this->use_select_
+ && ACE_OS::select (select_width,
+ conn_handle,
+ 0,
+ 0,
+ &timeout) == 1);
return 0;
}
diff --git a/ACE/ace/SOCK_Dgram.cpp b/ACE/ace/SOCK_Dgram.cpp
index 8b546553df4..9df9dcb6094 100644
--- a/ACE/ace/SOCK_Dgram.cpp
+++ b/ACE/ace/SOCK_Dgram.cpp
@@ -2,11 +2,13 @@
#include "ace/SOCK_Dgram.h"
+#include "ace/Handle_Set.h"
#include "ace/Log_Msg.h"
#include "ace/INET_Addr.h"
#include "ace/ACE.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_Memory.h"
+#include "ace/OS_NS_sys_select.h"
#include "ace/OS_NS_ctype.h"
#include "ace/os_include/net/os_if.h"
#include "ace/Truncate.h"
@@ -50,7 +52,23 @@ ACE_SOCK_Dgram::recv (iovec *io_vec,
{
ACE_TRACE ("ACE_SOCK_Dgram::recv");
#if defined (FIONREAD)
- switch (ACE::handle_read_ready (this->get_handle (), timeout))
+ ACE_Handle_Set handle_set;
+ handle_set.reset ();
+ handle_set.set_bit (this->get_handle ());
+
+ // Check the status of the current socket to make sure there's data
+ // to recv (or time out).
+# if defined (ACE_WIN32)
+ // This arg is ignored on Windows and causes pointer truncation
+ // warnings on 64-bit compiles.
+ int select_width = 0;
+# else
+ int select_width = int (this->get_handle ()) + 1;
+# endif /* ACE_WIN32 */
+ switch (ACE_OS::select (select_width,
+ handle_set,
+ 0, 0,
+ timeout))
{
case -1:
return -1;
@@ -433,7 +451,23 @@ ACE_SOCK_Dgram::recv (void *buf,
int flags,
const ACE_Time_Value *timeout) const
{
- switch (ACE::handle_read_ready (this->get_handle (), timeout))
+ ACE_Handle_Set handle_set;
+ handle_set.reset ();
+ handle_set.set_bit (this->get_handle ());
+
+ // Check the status of the current socket.
+#if defined (ACE_WIN32)
+ // This arg is ignored on Windows and causes pointer truncation
+ // warnings on 64-bit compiles.
+ int select_width = 0;
+#else
+ int select_width = int (this->get_handle ()) + 1;
+#endif /* ACE_WIN32 */
+ switch (ACE_OS::select (select_width,
+ handle_set,
+ 0,
+ 0,
+ timeout))
{
case -1:
return -1;
@@ -444,9 +478,8 @@ ACE_SOCK_Dgram::recv (void *buf,
/* NOTREACHED */
default:
// Goes fine, call <recv> to get data
- break;
+ return this->recv (buf, n, addr, flags);
}
- return this->recv (buf, n, addr, flags);
}
ssize_t
@@ -456,8 +489,23 @@ ACE_SOCK_Dgram::send (const void *buf,
int flags,
const ACE_Time_Value *timeout) const
{
+ ACE_Handle_Set handle_set;
+ handle_set.reset ();
+ handle_set.set_bit (this->get_handle ());
+
// Check the status of the current socket.
- switch (ACE::handle_write_ready (this->get_handle (), timeout))
+#if defined (ACE_WIN32)
+ // This arg is ignored on Windows and causes pointer truncation
+ // warnings on 64-bit compiles.
+ int select_width = 0;
+#else
+ int select_width = int (this->get_handle ()) + 1;
+#endif /* ACE_WIN32 */
+ switch (ACE_OS::select (select_width,
+ 0,
+ handle_set,
+ 0,
+ timeout))
{
case -1:
return -1;
@@ -468,9 +516,8 @@ ACE_SOCK_Dgram::send (const void *buf,
/* NOTREACHED */
default:
// Goes fine, call <send> to transmit the data.
- break;
+ return this->send (buf, n, addr, flags);
}
- return this->send (buf, n, addr, flags);
}
int
diff --git a/ACE/ace/SOCK_IO.cpp b/ACE/ace/SOCK_IO.cpp
index cd3237caf17..41897e680de 100644
--- a/ACE/ace/SOCK_IO.cpp
+++ b/ACE/ace/SOCK_IO.cpp
@@ -2,6 +2,8 @@
#include "ace/SOCK_IO.h"
+#include "ace/Handle_Set.h"
+#include "ace/OS_NS_sys_select.h"
#include "ace/OS_NS_sys_socket.h"
#include "ace/OS_Memory.h"
#include "ace/Truncate.h"
@@ -35,8 +37,24 @@ ACE_SOCK_IO::recvv (iovec *io_vec,
{
ACE_TRACE ("ACE_SOCK_IO::recvv");
#if defined (FIONREAD)
+ ACE_Handle_Set handle_set;
+ handle_set.reset ();
+ handle_set.set_bit (this->get_handle ());
+
io_vec->iov_base = 0;
- switch (ACE::handle_read_ready (this->get_handle (), timeout))
+
+ // Check the status of the current socket.
+# if defined (ACE_WIN32)
+ // This arg is ignored on Windows and causes pointer truncation
+ // warnings on 64-bit compiles.
+ int select_width = 0;
+# else
+ int select_width = int (this->get_handle ()) + 1;
+# endif /* ACE_WIN32 */
+ switch (ACE_OS::select (select_width,
+ handle_set,
+ 0, 0,
+ timeout))
{
case -1:
return -1;
@@ -46,7 +64,7 @@ ACE_SOCK_IO::recvv (iovec *io_vec,
return -1;
/* NOTREACHED */
default:
- // Goes fine, fall through to get the data.
+ // Goes fine, fallthrough to get data
break;
}
diff --git a/ACE/tests/MT_SOCK_Test.cpp b/ACE/tests/MT_SOCK_Test.cpp
index 97711aa90de..ea12c5f310b 100644
--- a/ACE/tests/MT_SOCK_Test.cpp
+++ b/ACE/tests/MT_SOCK_Test.cpp
@@ -24,12 +24,14 @@
// ============================================================================
#include "test_config.h"
+#include "ace/OS_NS_sys_select.h"
#include "ace/OS_NS_sys_wait.h"
#include "ace/OS_NS_unistd.h"
#include "ace/Thread.h"
#include "ace/Thread_Manager.h"
#include "ace/SOCK_Connector.h"
#include "ace/SOCK_Acceptor.h"
+#include "ace/Handle_Set.h"
#include "ace/Time_Value.h"
ACE_RCSID(tests, MT_SOCK_Test, "$Id$")
@@ -166,6 +168,7 @@ 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);
@@ -182,15 +185,26 @@ server (void *arg)
{
char buf[BUFSIZ];
+ handle_set.reset ();
+ handle_set.set_bit (peer_acceptor->get_handle ());
+
ACE_DEBUG((LM_DEBUG, "(%P|%t) server: Waiting for connection...\n"));
- int result = ACE::handle_read_ready (peer_acceptor->get_handle (), &tv);
+ 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 ("server: handle_read_ready acceptor")),
+ ACE_TEXT ("server: select acceptor")),
0);
else if (result == 0)
{
@@ -201,7 +215,7 @@ server (void *arg)
// is typically backlog * 1.5, backlog * 1.5 + 1, or event taken
// literally as on Windows. We'll accept any number less than
// backlog * 2 as valid.
- if (num_clients_connected > BACKLOG * 2)
+ if (num_clients_connected >= BACKLOG * 2)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("(%P|%t) server: Incorrect # client ")
ACE_TEXT ("connections. Expected:%d-%d Actual:%d\n"),
@@ -230,16 +244,29 @@ server (void *arg)
ACE_TEXT ("(%P|%t) %p\n"),
ACE_TEXT ("server: enable non blocking i/o")),
0);
+ handle_set.reset ();
+ handle_set.set_bit (new_stream.get_handle ());
+
// Read data from client (terminate on error).
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P|%t) server: Waiting for data...\n")));
for (ssize_t r_bytes; ;)
{
- if (ACE::handle_read_ready (new_stream.get_handle (), 0) == -1)
+ 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 (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 ("stream handle_read_ready")),
+ ACE_TEXT ("select")),
0);
ACE_DEBUG ((LM_DEBUG, "(%P|%t) server: Receiving data...\n"));
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)
{