diff options
author | Eli Zaretskii <eliz@gnu.org> | 2015-03-27 12:44:31 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2015-03-27 12:44:31 +0300 |
commit | d133cf839421462280ac0bfd9bd84c591f0e0249 (patch) | |
tree | d964223f8da827058aece69ed66ca25ba82ebbf4 /nt | |
parent | 792d44b3c31d2a682607ab8b79ae7d26b7402f41 (diff) |
Support non-blocking connect on MS-Windows (Bug#20207)
Based on ideas from Kim F. Storm <storm@cua.dk>, see
http://lists.gnu.org/archive/html/emacs-devel/2006-12/msg00873.html.
src/w32proc.c (reader_thread): If the FILE_CONNECT flag is set, call
'_sys_wait_connect'. If it returns STATUS_CONNECT_FAILED, exit
the thread with code 2.
(sys_select): Support 'wfds' in addition to 'rfds'. If a
descriptor in 'wfds' has its bit set, but the corresponding
fd_info member doesn't have its FILE_CONNECT flag set, ignore the
descriptor. Otherwise, acknowledge a successful non-blocking
connect by resetting the FILE_CONNECT flag and setting cp->status
to STATUS_READ_ACKNOWLEDGED.
src/w32.h (STATUS_CONNECT_FAILED): New enumeration value.
(struct _child_process): New member 'errcode'.
(FILE_CONNECT): New flag.
(_sys_wait_connect): Add prototype.
src/w32.c (pfn_WSAEnumNetworkEvents): New function pointer.
(init_winsock): Load WSAEnumNetworkEvents from winsock DLL.
(set_errno): Map WSAEWOULDBLOCK and WSAENOTCONN.
(sys_connect): Support non-blocking 'connect' calls by setting the
FILE_CONNECT flag in the fd_info member and returning EINPROGRESS.
(_sys_read_ahead): Add debug message if this function is called
for a descriptor that waits for a non-blocking connect to complete.
(_sys_wait_connect): New function.
(sys_read): Support STATUS_CONNECT_FAILED. Return the error code
recorded by _sys_wait_connect when the non-blocking connect
failed. Don't call WSAGetLastError before a call to set_errno had
a chance to use its value, since WSAGetLastError clears the last
error.
nt/inc/ms-w32.h (BROKEN_NON_BLOCKING_CONNECT): Don't define.
Diffstat (limited to 'nt')
-rw-r--r-- | nt/ChangeLog | 5 | ||||
-rw-r--r-- | nt/inc/ms-w32.h | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/nt/ChangeLog b/nt/ChangeLog index 9d954d5647..da79681094 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,3 +1,8 @@ +2015-03-27 Eli Zaretskii <eliz@gnu.org> + + * inc/ms-w32.h (BROKEN_NON_BLOCKING_CONNECT): Don't define. + (Bug#20207) + 2015-03-09 Eli Zaretskii <eliz@gnu.org> * INSTALL: Add some more installation instructions for mingw-get diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h index c06ed58881..da772906dd 100644 --- a/nt/inc/ms-w32.h +++ b/nt/inc/ms-w32.h @@ -58,10 +58,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ Look in <sys/time.h> for a timeval structure. */ #define HAVE_TIMEVAL 1 -/* But our select implementation doesn't allow us to make non-blocking - connects. So until that is fixed, this is necessary: */ -#define BROKEN_NON_BLOCKING_CONNECT 1 - /* And the select implementation does 1-byte read-ahead waiting for received packets, so datagrams are broken too. */ #define BROKEN_DATAGRAM_SOCKETS 1 |