summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>2010-09-02 15:03:17 +0000
committerSteve Huston <shuston@riverace.com>2010-09-02 15:03:17 +0000
commit4a0521a90f50368985d42bc19ae166989df31458 (patch)
tree06d97b52ed2577dc138646de21df5cdf7fac9204
parent5a266c95f4defea2c527463faf9b31cd73404401 (diff)
downloadATCD-4a0521a90f50368985d42bc19ae166989df31458.tar.gz
ChangeLogTag:Thu Sep 2 14:59:27 UTC 2010 Steve Huston <shuston@riverace.com>
-rw-r--r--ChangeLog11
-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, 63 insertions, 73 deletions
diff --git a/ChangeLog b/ChangeLog
index def13dd1fea..734bb3898ea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Thu Sep 2 14:59:27 UTC 2010 Steve Huston <shuston@riverace.com>
+
+ * ace/ACE.cpp (handle_ready):
+ * ace/SOCK_Dgram.cpp:
+ * ace/SOCK_IO.cpp:
+ * tests/MT_SOCK_Test.cpp:
+ * tests/SOCK_Test.cpp: Reverted the changes from
+ Wed Sep 1 19:31:24 UTC 2010 Steve Huston <shuston@riverace.com>
+ They caused other problems with existing usage. The referenced
+ TAO test behind the problems needs to be fixed, not ACE.
+
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/ACE.cpp b/ace/ACE.cpp
index 22a37a2477e..0d4d9b80300 100644
--- a/ace/ACE.cpp
+++ b/ace/ACE.cpp
@@ -2231,7 +2231,19 @@ ACE::handle_ready (ACE_HANDLE handle,
#endif /* ACE_HAS_POLL */
- 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
diff --git a/ace/SOCK_Dgram.cpp b/ace/SOCK_Dgram.cpp
index d4c67c16a60..6dc776bc4b8 100644
--- a/ace/SOCK_Dgram.cpp
+++ b/ace/SOCK_Dgram.cpp
@@ -52,18 +52,9 @@ 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))
+ if( ACE::handle_read_ready (this->get_handle (), timeout) != 1 )
{
- 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 ();
@@ -435,20 +426,15 @@ ACE_SOCK_Dgram::recv (void *buf,
int flags,
const ACE_Time_Value *timeout) const
{
- switch (ACE::handle_read_ready (this->get_handle (), timeout))
+ if( ACE::handle_read_ready (this->get_handle (), timeout) == 1 )
{
- 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);
+ }
+ else
+ {
+ return -1;
}
- return this->recv (buf, n, addr, flags);
}
ssize_t
@@ -459,20 +445,15 @@ ACE_SOCK_Dgram::send (const void *buf,
const ACE_Time_Value *timeout) const
{
// Check the status of the current socket.
- switch (ACE::handle_write_ready (this->get_handle (), timeout))
+ if( ACE::handle_write_ready (this->get_handle (), timeout) == 1 )
{
- 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);
+ }
+ else
+ {
+ return -1;
}
- return this->send (buf, n, addr, flags);
}
int
diff --git a/ace/SOCK_IO.cpp b/ace/SOCK_IO.cpp
index 8deceec7738..31aaaa00dea 100644
--- a/ace/SOCK_IO.cpp
+++ b/ace/SOCK_IO.cpp
@@ -36,18 +36,9 @@ ACE_SOCK_IO::recvv (iovec *io_vec,
ACE_TRACE ("ACE_SOCK_IO::recvv");
#if defined (FIONREAD)
io_vec->iov_base = 0;
- switch (ACE::handle_read_ready (this->get_handle (), timeout))
+ if( ACE::handle_read_ready (this->get_handle (), timeout) != 1 )
{
- 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 97711aa90de..638d5e81613 100644
--- a/tests/MT_SOCK_Test.cpp
+++ b/tests/MT_SOCK_Test.cpp
@@ -30,6 +30,7 @@
#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$")
@@ -188,25 +189,28 @@ 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)
{
- 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;
+ 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);
}
// Create a new ACE_SOCK_Stream endpoint (note automatic restart
diff --git a/tests/SOCK_Test.cpp b/tests/SOCK_Test.cpp
index a26b66b6243..2fa4e1f36e3 100644
--- a/tests/SOCK_Test.cpp
+++ b/tests/SOCK_Test.cpp
@@ -28,6 +28,7 @@
#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$")
@@ -76,10 +77,7 @@ 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").
@@ -127,14 +125,7 @@ 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);
- else if (result == 0)
- {
- ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) select timed out, shutting down\n")));
- return 0;
- }
+ ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) %p\n"), ACE_TEXT ("handle_read_ready")), 0);
// Create a new ACE_SOCK_Stream endpoint (note automatic restart
// if errno == EINTR).