summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>2001-04-23 17:50:30 +0000
committerSteve Huston <shuston@riverace.com>2001-04-23 17:50:30 +0000
commitdac637c4ad8e468f07e22b911edb0c1f642182a0 (patch)
tree0210bf354a22bdab577299d74d4ecbbd0234bbfe
parentabb9ce3a6566d088e07cc2883508f10fb265dc6b (diff)
downloadATCD-dac637c4ad8e468f07e22b911edb0c1f642182a0.tar.gz
ChangeLogTag:Mon Apr 23 13:36:27 2001 Steve Huston <shuston@riverace.com>
-rw-r--r--ChangeLog20
-rw-r--r--ChangeLogs/ChangeLog-02a20
-rw-r--r--ChangeLogs/ChangeLog-03a20
-rw-r--r--ace/ACE.cpp15
-rw-r--r--ace/Connector.cpp24
-rw-r--r--ace/README3
-rw-r--r--ace/SOCK_Connector.cpp25
-rw-r--r--ace/config-win32-common.h3
8 files changed, 103 insertions, 27 deletions
diff --git a/ChangeLog b/ChangeLog
index 741cc49afbe..ee6e9762758 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+Mon Apr 23 13:36:27 2001 Steve Huston <shuston@riverace.com>
+
+ * ace/ACE.cpp (ACE::handle_timed_complete): Winsock (ACE_WIN32) sets
+ the exception bit (not the read bit) for a failed async connect.
+ So on fail, don't bother to do the recv trick to see if the socket
+ really did fail.
+
+ * ace/Connector.cpp (ACE_Connector::handle_output):
+ * ace/SOCK_Connector.cpp (complete): Apparantly, Win2000 has
+ fixed the problem where a connection succeeds but can't be used
+ for a time. So, the sleep workaround is restructured for ACE_WIN32
+ to try the new socket first, and only do the sleep if it fails.
+ Don't try to do this check (e.g. building on Win2000) at compile
+ time, since we want to be able to build on NT and run on Win2000.
+
+ * ace/README:
+ * ace/config-win32-common.h: Removed the macro,
+ ACE_HAS_BROKEN_NONBLOCKING_CONNECTS. It was only used in the two
+ cases above, and is not needed any longer.
+
Mon Apr 23 07:08:09 2001 Douglas C. Schmidt <schmidt@tango.doc.wustl.edu>
* ace/Based_Pointer_T.h: Updated the documentation to
diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a
index 741cc49afbe..ee6e9762758 100644
--- a/ChangeLogs/ChangeLog-02a
+++ b/ChangeLogs/ChangeLog-02a
@@ -1,3 +1,23 @@
+Mon Apr 23 13:36:27 2001 Steve Huston <shuston@riverace.com>
+
+ * ace/ACE.cpp (ACE::handle_timed_complete): Winsock (ACE_WIN32) sets
+ the exception bit (not the read bit) for a failed async connect.
+ So on fail, don't bother to do the recv trick to see if the socket
+ really did fail.
+
+ * ace/Connector.cpp (ACE_Connector::handle_output):
+ * ace/SOCK_Connector.cpp (complete): Apparantly, Win2000 has
+ fixed the problem where a connection succeeds but can't be used
+ for a time. So, the sleep workaround is restructured for ACE_WIN32
+ to try the new socket first, and only do the sleep if it fails.
+ Don't try to do this check (e.g. building on Win2000) at compile
+ time, since we want to be able to build on NT and run on Win2000.
+
+ * ace/README:
+ * ace/config-win32-common.h: Removed the macro,
+ ACE_HAS_BROKEN_NONBLOCKING_CONNECTS. It was only used in the two
+ cases above, and is not needed any longer.
+
Mon Apr 23 07:08:09 2001 Douglas C. Schmidt <schmidt@tango.doc.wustl.edu>
* ace/Based_Pointer_T.h: Updated the documentation to
diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a
index 741cc49afbe..ee6e9762758 100644
--- a/ChangeLogs/ChangeLog-03a
+++ b/ChangeLogs/ChangeLog-03a
@@ -1,3 +1,23 @@
+Mon Apr 23 13:36:27 2001 Steve Huston <shuston@riverace.com>
+
+ * ace/ACE.cpp (ACE::handle_timed_complete): Winsock (ACE_WIN32) sets
+ the exception bit (not the read bit) for a failed async connect.
+ So on fail, don't bother to do the recv trick to see if the socket
+ really did fail.
+
+ * ace/Connector.cpp (ACE_Connector::handle_output):
+ * ace/SOCK_Connector.cpp (complete): Apparantly, Win2000 has
+ fixed the problem where a connection succeeds but can't be used
+ for a time. So, the sleep workaround is restructured for ACE_WIN32
+ to try the new socket first, and only do the sleep if it fails.
+ Don't try to do this check (e.g. building on Win2000) at compile
+ time, since we want to be able to build on NT and run on Win2000.
+
+ * ace/README:
+ * ace/config-win32-common.h: Removed the macro,
+ ACE_HAS_BROKEN_NONBLOCKING_CONNECTS. It was only used in the two
+ cases above, and is not needed any longer.
+
Mon Apr 23 07:08:09 2001 Douglas C. Schmidt <schmidt@tango.doc.wustl.edu>
* ace/Based_Pointer_T.h: Updated the documentation to
diff --git a/ace/ACE.cpp b/ace/ACE.cpp
index 9e2036c215f..a6deb165571 100644
--- a/ace/ACE.cpp
+++ b/ace/ACE.cpp
@@ -2532,6 +2532,8 @@ ACE::handle_timed_complete (ACE_HANDLE h,
#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,
+ // unlike other platforms, where the read bit is set.
ACE_Handle_Set ex_handles;
ex_handles.set_bit (h);
#endif /* ACE_WIN32 */
@@ -2540,7 +2542,7 @@ ACE::handle_timed_complete (ACE_HANDLE h,
#if defined (ACE_WIN32)
int n = ACE_OS::select (int (h) + 1,
- rd_handles,
+ 0,
wr_handles,
ex_handles,
timeout);
@@ -2572,8 +2574,15 @@ ACE::handle_timed_complete (ACE_HANDLE h,
// ready for writing, which may indicate a problem. But we need to
// make sure...
#if defined (ACE_WIN32)
- ACE_UNUSED_ARG (is_tli);
- need_to_check = rd_handles.is_set (h) || ex_handles.is_set (h);
+ 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);
diff --git a/ace/Connector.cpp b/ace/Connector.cpp
index 15eef258692..a2261613ae0 100644
--- a/ace/Connector.cpp
+++ b/ace/Connector.cpp
@@ -339,20 +339,24 @@ ACE_Connector<SH, PR_CO_2>::handle_output (ACE_HANDLE handle)
PR_AD raddr;
-#if defined (ACE_HAS_BROKEN_NON_BLOCKING_CONNECTS)
- // Win32 has a timing problem - if you check to see if the
- // connection has completed too fast, it will fail - so wait 35
- // millisecond to let it catch up.
- ACE_Time_Value tv (0, ACE_NON_BLOCKING_BUG_DELAY);
- ACE_OS::sleep (tv);
-#endif /* ACE_HAS_BROKEN_NON_BLOCKING_CONNECTS */
-
// Check to see if we're connected.
if (ast->svc_handler ()->peer ().get_remote_addr (raddr) != -1)
this->activate_svc_handler (ast->svc_handler ());
else // Somethings gone wrong, so close down...
- ast->svc_handler ()->close (0);
-
+ {
+#if defined (ACE_WIN32)
+ ACE_DEBUG ((LM_DEBUG, "errno %d; Sleeping to retry get_remote_addr\n", errno));
+ // Win32 (at least prior to Windows 2000) has a timing problem.
+ // If you check to see if the connection has completed too fast,
+ // it will fail - so wait 35 milliseconds to let it catch up.
+ ACE_Time_Value tv (0, ACE_NON_BLOCKING_BUG_DELAY);
+ ACE_OS::sleep (tv);
+ if (ast->svc_handler ()->peer ().get_remote_addr (raddr) != -1)
+ this->activate_svc_handler (ast->svc_handler ());
+ else // do the svc handler close below...
+#endif /* ACE_HAS_BROKEN_NON_BLOCKING_CONNECTS */
+ ast->svc_handler ()->close (0);
+ }
delete ast;
return 0;
}
diff --git a/ace/README b/ace/README
index 7ca0c70e20f..eba23c9d8bd 100644
--- a/ace/README
+++ b/ace/README
@@ -218,9 +218,6 @@ ACE_HAS_BROKEN_MMAP_H HP/UX does not wrap the
ACE_HAS_BROKEN_NESTED_TEMPLATES MSVC has trouble with defining
STL containers for nested
structs and classes
-ACE_HAS_BROKEN_NON_BLOCKING_CONNECTS Platform has a bug with
- non-blocking connects (e.g.,
- WinNT 4.0)
ACE_HAS_BROKEN_POSIX_TIME Platform defines struct
timespec in <sys/timers.h>
ACE_HAS_BROKEN_RANDR OS/compiler's header files are
diff --git a/ace/SOCK_Connector.cpp b/ace/SOCK_Connector.cpp
index 6006bef20c1..062df45f423 100644
--- a/ace/SOCK_Connector.cpp
+++ b/ace/SOCK_Connector.cpp
@@ -215,24 +215,33 @@ ACE_SOCK_Connector::complete (ACE_SOCK_Stream &new_stream,
const ACE_Time_Value *tv)
{
ACE_TRACE ("ACE_SOCK_Connector::complete");
-#if defined (ACE_HAS_BROKEN_NON_BLOCKING_CONNECTS)
- // Win32 has a timing problem - if you check to see if the
- // connection has completed too fast, it will fail - so wait
- // <ACE_NON_BLOCKING_BUG_DELAY> microseconds to let it catch up.
- ACE_Time_Value time (0, ACE_NON_BLOCKING_BUG_DELAY);
- ACE_OS::sleep (time);
-#endif /* ACE_HAS_BROKEN_NON_BLOCKING_CONNECTS */
ACE_HANDLE h = ACE::handle_timed_complete (new_stream.get_handle (),
tv);
// We failed to get connected.
if (h == ACE_INVALID_HANDLE)
{
+#if defined (ACE_WIN32)
+ // Win32 has a timing problem - if you check to see if the
+ // connection has completed too fast, it will fail - so wait
+ // <ACE_NON_BLOCKING_BUG_DELAY> microseconds to let it catch up
+ // then retry to see if it's a real failure.
+ ACE_Time_Value time (0, ACE_NON_BLOCKING_BUG_DELAY);
+ ACE_OS::sleep (time);
+ h = ACE::handle_timed_complete (new_stream.get_handle (),
+ tv);
+ if (h == ACE_INVALID_HANDLE)
+ {
+#endif /* ACE_WIN32 */
// Save/restore errno.
ACE_Errno_Guard error (errno);
new_stream.close ();
return -1;
+#if defined (ACE_WIN32)
+ }
+#endif /* ACE_WIN32 */
}
- else if (remote_sap != 0)
+
+ if (remote_sap != 0)
{
int len = remote_sap->get_size ();
sockaddr *addr = ACE_reinterpret_cast (sockaddr *,
diff --git a/ace/config-win32-common.h b/ace/config-win32-common.h
index afad57f010f..298243cde78 100644
--- a/ace/config-win32-common.h
+++ b/ace/config-win32-common.h
@@ -298,9 +298,6 @@ typedef unsigned long long ACE_UINT64;
#define ACE_LACKS_KEY_T
-// Platform support for non-blocking connects is broken
-#define ACE_HAS_BROKEN_NON_BLOCKING_CONNECTS
-
// No system support for replacing any previous mappings.
#define ACE_LACKS_AUTO_MMAP_REPLACEMENT