summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>2010-09-01 20:47:34 +0000
committerSteve Huston <shuston@riverace.com>2010-09-01 20:47:34 +0000
commitebb0acf4e3170f5e4dfd961785749d3f3edab660 (patch)
tree716825d8b34608ef8af3a2493ed4d00a1a84584f
parent813ee10be2a204ae76a3c91a424ec89a1ba46ae2 (diff)
downloadATCD-ebb0acf4e3170f5e4dfd961785749d3f3edab660.tar.gz
ChangeLogTag:Wed Sep 1 19:31:24 UTC 2010 Steve Huston <shuston@riverace.com>
-rw-r--r--ACE/ChangeLog18
-rw-r--r--ACE/ace/ACE.cpp14
-rw-r--r--ACE/ace/SOCK_Dgram.cpp45
-rw-r--r--ACE/ace/SOCK_IO.cpp11
-rw-r--r--ACE/tests/MT_SOCK_Test.cpp40
-rw-r--r--ACE/tests/SOCK_Test.cpp15
6 files changed, 91 insertions, 52 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog
index 83a3ab150ff..b2f914c9248 100644
--- a/ACE/ChangeLog
+++ b/ACE/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.
+
Wed Sep 1 15:58:47 UTC 2010 Adam Mitz <mitza@ociweb.com>
* bin/MakeProjectCreator/templates/gnu.mpd:
diff --git a/ACE/ace/ACE.cpp b/ACE/ace/ACE.cpp
index a3866079ab6..925be0a034b 100644
--- a/ACE/ace/ACE.cpp
+++ b/ACE/ace/ACE.cpp
@@ -2206,19 +2206,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/ace/SOCK_Dgram.cpp b/ACE/ace/SOCK_Dgram.cpp
index 5b48418a846..8b546553df4 100644
--- a/ACE/ace/SOCK_Dgram.cpp
+++ b/ACE/ace/SOCK_Dgram.cpp
@@ -50,9 +50,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 ();
@@ -424,15 +433,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
@@ -443,15 +457,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/ace/SOCK_IO.cpp b/ACE/ace/SOCK_IO.cpp
index b9175e7d621..cd3237caf17 100644
--- a/ACE/ace/SOCK_IO.cpp
+++ b/ACE/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/ACE/tests/MT_SOCK_Test.cpp b/ACE/tests/MT_SOCK_Test.cpp
index 638d5e81613..97711aa90de 100644
--- a/ACE/tests/MT_SOCK_Test.cpp
+++ b/ACE/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/ACE/tests/SOCK_Test.cpp b/ACE/tests/SOCK_Test.cpp
index 2fa4e1f36e3..a26b66b6243 100644
--- a/ACE/tests/SOCK_Test.cpp
+++ b/ACE/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).