summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>2010-09-01 20:50:56 +0000
committerSteve Huston <shuston@riverace.com>2010-09-01 20:50:56 +0000
commit5a266c95f4defea2c527463faf9b31cd73404401 (patch)
treebfa078ad753d5aa400cb20328cf9d7c9beaadd5d
parentc64fe42702fc8b02260463c4c583e6c91d6a29a7 (diff)
downloadATCD-5a266c95f4defea2c527463faf9b31cd73404401.tar.gz
ChangeLogTag:Wed Sep 1 19:31:24 UTC 2010 Steve Huston <shuston@riverace.com>
-rw-r--r--ChangeLog18
-rw-r--r--ace/ACE.cpp14
-rw-r--r--ace/SOCK_Dgram.cpp45
-rw-r--r--ace/SOCK_IO.cpp11
-rw-r--r--tests/MT_SOCK_Test.cpp40
-rw-r--r--tests/SOCK_Test.cpp15
6 files changed, 91 insertions, 52 deletions
diff --git a/ChangeLog b/ChangeLog
index c54d1e38b93..def13dd1fea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+Wed Sep 1 19:31:24 UTC 2010 Steve Huston <shuston@riverace.com>
+
+ * ace/ACE.cpp (handle_ready): Changed the timeout behavior to just
+ return 0, no errno, as ACE_OS::poll() and ACE_OS::select() both do.
+ This restores historic behavior changed inadvertently at
+ Fri Aug 27 19:17:11 UTC 2010 Steve Huston <shuston@riverace.com>
+
+ * ace/SOCK_Dgram.cpp:
+ * ace/SOCK_IO.cpp:
+ * tests/MT_SOCK_Test.cpp:
+ * tests/SOCK_Test.cpp: Re-added the if/switch on return value from
+ ACE::handle_read|write_ready() to detect timeout and set errno
+ here.
+
+ These changes were necessary to fix the TAO faults test. Thanks
+ to Johnny and Simon for narrowing down the cause and testing
+ the fix.
+
Mon Aug 30 16:48:34 UTC 2010 Steve Huston <shuston@riverace.com>
* ace/FIFO.h:
diff --git a/ace/ACE.cpp b/ace/ACE.cpp
index 0d4d9b80300..22a37a2477e 100644
--- a/ace/ACE.cpp
+++ b/ace/ACE.cpp
@@ -2231,19 +2231,7 @@ ACE::handle_ready (ACE_HANDLE handle,
#endif /* ACE_HAS_POLL */
- 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;
- }
+ return result;
}
int
diff --git a/ace/SOCK_Dgram.cpp b/ace/SOCK_Dgram.cpp
index 6dc776bc4b8..d4c67c16a60 100644
--- a/ace/SOCK_Dgram.cpp
+++ b/ace/SOCK_Dgram.cpp
@@ -52,9 +52,18 @@ ACE_SOCK_Dgram::recv (iovec *io_vec,
{
ACE_TRACE ("ACE_SOCK_Dgram::recv");
#if defined (FIONREAD)
- if( ACE::handle_read_ready (this->get_handle (), timeout) != 1 )
+ switch (ACE::handle_read_ready (this->get_handle (), timeout))
{
+ case -1:
return -1;
+ /* NOTREACHED */
+ case 0:
+ errno = ETIME;
+ return -1;
+ /* NOTREACHED */
+ default:
+ // Goes fine, fallthrough to get data
+ break;
}
sockaddr *saddr = (sockaddr *) addr.get_addr ();
@@ -426,15 +435,20 @@ ACE_SOCK_Dgram::recv (void *buf,
int flags,
const ACE_Time_Value *timeout) const
{
- if( ACE::handle_read_ready (this->get_handle (), timeout) == 1 )
- {
- // Goes fine, call <recv> to get data
- return this->recv (buf, n, addr, flags);
- }
- else
+ switch (ACE::handle_read_ready (this->get_handle (), timeout))
{
+ case -1:
+ return -1;
+ /* NOTREACHED */
+ case 0:
+ errno = ETIME;
return -1;
+ /* NOTREACHED */
+ default:
+ // Goes fine, call <recv> to get data
+ break;
}
+ return this->recv (buf, n, addr, flags);
}
ssize_t
@@ -445,15 +459,20 @@ ACE_SOCK_Dgram::send (const void *buf,
const ACE_Time_Value *timeout) const
{
// Check the status of the current socket.
- if( ACE::handle_write_ready (this->get_handle (), timeout) == 1 )
- {
- // Goes fine, call <send> to transmit the data.
- return this->send (buf, n, addr, flags);
- }
- else
+ switch (ACE::handle_write_ready (this->get_handle (), timeout))
{
+ case -1:
+ return -1;
+ /* NOTREACHED */
+ case 0:
+ errno = ETIME;
return -1;
+ /* NOTREACHED */
+ default:
+ // Goes fine, call <send> to transmit the data.
+ break;
}
+ return this->send (buf, n, addr, flags);
}
int
diff --git a/ace/SOCK_IO.cpp b/ace/SOCK_IO.cpp
index 31aaaa00dea..8deceec7738 100644
--- a/ace/SOCK_IO.cpp
+++ b/ace/SOCK_IO.cpp
@@ -36,9 +36,18 @@ ACE_SOCK_IO::recvv (iovec *io_vec,
ACE_TRACE ("ACE_SOCK_IO::recvv");
#if defined (FIONREAD)
io_vec->iov_base = 0;
- if( ACE::handle_read_ready (this->get_handle (), timeout) != 1 )
+ switch (ACE::handle_read_ready (this->get_handle (), timeout))
{
+ case -1:
return -1;
+ /* NOTREACHED */
+ case 0:
+ errno = ETIME;
+ return -1;
+ /* NOTREACHED */
+ default:
+ // Goes fine, fall through to get the data.
+ break;
}
int inlen = 0;
diff --git a/tests/MT_SOCK_Test.cpp b/tests/MT_SOCK_Test.cpp
index 638d5e81613..97711aa90de 100644
--- a/tests/MT_SOCK_Test.cpp
+++ b/tests/MT_SOCK_Test.cpp
@@ -30,7 +30,6 @@
#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$")
@@ -189,28 +188,25 @@ server (void *arg)
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")),
+ 0);
+ else if (result == 0)
{
- if (errno == ETIME)
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("(%P|%t) server: Test finished.\n")));
- // The meaning of the backlog parameter for listen() varies by
- // platform. For some reason lost to history, the specified value
- // 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)
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("(%P|%t) server: Incorrect # client ")
- ACE_TEXT ("connections. Expected:%d-%d Actual:%d\n"),
- BACKLOG, BACKLOG * 2, num_clients_connected));
- return 0;
- }
-
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("(%P|%t) %p\n"),
- ACE_TEXT ("server: handle_read_ready acceptor")),
- 0);
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) server: Test finished.\n")));
+ // The meaning of the backlog parameter for listen() varies by
+ // platform. For some reason lost to history, the specified value
+ // 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)
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) server: Incorrect # client ")
+ ACE_TEXT ("connections. Expected:%d-%d Actual:%d\n"),
+ BACKLOG, BACKLOG * 2, num_clients_connected));
+ return 0;
}
// Create a new ACE_SOCK_Stream endpoint (note automatic restart
diff --git a/tests/SOCK_Test.cpp b/tests/SOCK_Test.cpp
index 2fa4e1f36e3..a26b66b6243 100644
--- a/tests/SOCK_Test.cpp
+++ b/tests/SOCK_Test.cpp
@@ -28,7 +28,6 @@
#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$")
@@ -77,7 +76,10 @@ client (void *arg)
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);
+ 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").
@@ -125,7 +127,14 @@ server (void *arg)
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 ("handle_read_ready")), 0);
+ else if (result == 0)
+ {
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) select timed out, shutting down\n")));
+ return 0;
+ }
// Create a new ACE_SOCK_Stream endpoint (note automatic restart
// if errno == EINTR).