summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>2001-04-23 21:24:13 +0000
committerSteve Huston <shuston@riverace.com>2001-04-23 21:24:13 +0000
commitad7f2d4ae4273710073d841fe5afccaf14e6718a (patch)
tree430b5f3d5e9d91ae462fea18802c19c6d070d15a
parentdac637c4ad8e468f07e22b911edb0c1f642182a0 (diff)
downloadATCD-ad7f2d4ae4273710073d841fe5afccaf14e6718a.tar.gz
ChangeLogTag:Mon Apr 23 17:18:35 2001 Steve Huston <shuston@riverace.com>
-rw-r--r--ChangeLog14
-rw-r--r--ChangeLogs/ChangeLog-02a14
-rw-r--r--ChangeLogs/ChangeLog-03a14
-rw-r--r--ace/ACE.cpp29
-rw-r--r--tests/SOCK_Connector_Test.cpp2
5 files changed, 61 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index ee6e9762758..5a7cf713c8a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+Mon Apr 23 17:18:35 2001 Steve Huston <shuston@riverace.com>
+
+ * ace/ACE.cpp (ACE::handle_timed_complete): Set need_to_check for
+ any non-success result, or on a system where you can't tell (AIX).
+ Also, to check, use getsockopt to retrieve the status/error if
+ SOL_SOCKET and SO_ERROR are defined; else use the old recv method.
+ This gets you a real error code on a failed connect, if the platform
+ supports it.
+
+ * tests/SOCK_Connector_Test.cpp: For an expected success, allow test
+ to pass if socket gets a reset but not if it says ENOTCONN. If there
+ are platforms that can't do SOL_SOCKET/SO_ERROR (above) then this
+ other code may need to be re-enabled.
+
Mon Apr 23 13:36:27 2001 Steve Huston <shuston@riverace.com>
* ace/ACE.cpp (ACE::handle_timed_complete): Winsock (ACE_WIN32) sets
diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a
index ee6e9762758..5a7cf713c8a 100644
--- a/ChangeLogs/ChangeLog-02a
+++ b/ChangeLogs/ChangeLog-02a
@@ -1,3 +1,17 @@
+Mon Apr 23 17:18:35 2001 Steve Huston <shuston@riverace.com>
+
+ * ace/ACE.cpp (ACE::handle_timed_complete): Set need_to_check for
+ any non-success result, or on a system where you can't tell (AIX).
+ Also, to check, use getsockopt to retrieve the status/error if
+ SOL_SOCKET and SO_ERROR are defined; else use the old recv method.
+ This gets you a real error code on a failed connect, if the platform
+ supports it.
+
+ * tests/SOCK_Connector_Test.cpp: For an expected success, allow test
+ to pass if socket gets a reset but not if it says ENOTCONN. If there
+ are platforms that can't do SOL_SOCKET/SO_ERROR (above) then this
+ other code may need to be re-enabled.
+
Mon Apr 23 13:36:27 2001 Steve Huston <shuston@riverace.com>
* ace/ACE.cpp (ACE::handle_timed_complete): Winsock (ACE_WIN32) sets
diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a
index ee6e9762758..5a7cf713c8a 100644
--- a/ChangeLogs/ChangeLog-03a
+++ b/ChangeLogs/ChangeLog-03a
@@ -1,3 +1,17 @@
+Mon Apr 23 17:18:35 2001 Steve Huston <shuston@riverace.com>
+
+ * ace/ACE.cpp (ACE::handle_timed_complete): Set need_to_check for
+ any non-success result, or on a system where you can't tell (AIX).
+ Also, to check, use getsockopt to retrieve the status/error if
+ SOL_SOCKET and SO_ERROR are defined; else use the old recv method.
+ This gets you a real error code on a failed connect, if the platform
+ supports it.
+
+ * tests/SOCK_Connector_Test.cpp: For an expected success, allow test
+ to pass if socket gets a reset but not if it says ENOTCONN. If there
+ are platforms that can't do SOL_SOCKET/SO_ERROR (above) then this
+ other code may need to be re-enabled.
+
Mon Apr 23 13:36:27 2001 Steve Huston <shuston@riverace.com>
* ace/ACE.cpp (ACE::handle_timed_complete): Winsock (ACE_WIN32) sets
diff --git a/ace/ACE.cpp b/ace/ACE.cpp
index a6deb165571..dc2e05caff5 100644
--- a/ace/ACE.cpp
+++ b/ace/ACE.cpp
@@ -2570,18 +2570,13 @@ ACE::handle_timed_complete (ACE_HANDLE h,
return ACE_INVALID_HANDLE;
}
- // Check if the handle is ready for reading and the handle is *not*
- // ready for writing, which may indicate a problem. But we need to
- // make sure...
+ // Usually, a ready-for-write handle is successfully connected, and
+ // ready-for-read (exception on Win32) is a failure. On fails, we
+ // need to grab the error code via getsockopt. On possible success for
+ // any platform where we can't tell just from select() (e.g. AIX),
+ // we also need to check for success/fail.
#if defined (ACE_WIN32)
if (ex_handles.is_set (h))
- h = ACE_INVALID_HANDLE;
- else
- // There's a funky time window on some Win32 versions (pre-Win2000)
- // where the socket is marked complete, but operations will still
- // fail. We need to find if this is one of those and return an error
- // if so - the caller will then need to decide to ignore it or sleep
- // and retry (see SOCK_Connector.cpp)
need_to_check = 1;
#elif defined (VXWORKS)
ACE_UNUSED_ARG (is_tli);
@@ -2596,7 +2591,7 @@ ACE::handle_timed_complete (ACE_HANDLE h,
# 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);
+ need_to_check = rd_handles.is_set (h) && !wr_handles.is_set (h);
# endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */
else
@@ -2615,6 +2610,17 @@ ACE::handle_timed_complete (ACE_HANDLE h,
if (need_to_check)
{
+#if defined (SOL_SOCKET) && defined (SO_ERROR)
+ int sock_err = 0;
+ int sock_err_len = sizeof (sock_err);
+ ACE_OS::getsockopt (h, SOL_SOCKET, SO_ERROR,
+ (char *)&sock_err, &sock_err_len);
+ if (sock_err != 0)
+ {
+ h = ACE_INVALID_HANDLE;
+ errno = sock_err;
+ }
+#else
char dummy;
// The following recv() won't block provided that the
@@ -2634,6 +2640,7 @@ ACE::handle_timed_complete (ACE_HANDLE h,
else if (errno != EWOULDBLOCK && errno != EAGAIN)
h = ACE_INVALID_HANDLE;
}
+#endif
}
// 1. The HANDLE is ready for writing and doesn't need to be checked or
diff --git a/tests/SOCK_Connector_Test.cpp b/tests/SOCK_Connector_Test.cpp
index baf3037e163..42e347cf26f 100644
--- a/tests/SOCK_Connector_Test.cpp
+++ b/tests/SOCK_Connector_Test.cpp
@@ -259,7 +259,7 @@ succeed_nonblocking (void)
{
// Reset the status _before_ doing the printout, in case the
// printout overwrites errno.
- if (errno == ECONNREFUSED || errno == ENOTCONN)
+ if (errno == ECONNREFUSED) // ENOTCONN should not happen any more || errno == ENOTCONN)
status = 0;
ACE_DEBUG ((LM_DEBUG,