diff options
author | Jason Rumney <jasonr@gnu.org> | 2002-11-25 23:30:19 +0000 |
---|---|---|
committer | Jason Rumney <jasonr@gnu.org> | 2002-11-25 23:30:19 +0000 |
commit | 30a32e0ea1598711765e1b4fda938b4ea07d6ea7 (patch) | |
tree | f5eb58fd2cc91990d4fa47d5d80db8f5b98d141f /src/w32.c | |
parent | 8cc0371672faea8c6e740c189004ee2dc5e3cf4e (diff) | |
download | emacs-30a32e0ea1598711765e1b4fda938b4ea07d6ea7.tar.gz |
(sys_write): Avoid non-blocking mode, which is not fully
supported.
Diffstat (limited to 'src/w32.c')
-rw-r--r-- | src/w32.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/w32.c b/src/w32.c index c80c4232bc6..c7537ec7194 100644 --- a/src/w32.c +++ b/src/w32.c @@ -3709,8 +3709,24 @@ sys_write (int fd, const void * buffer, unsigned int count) #ifdef HAVE_SOCKETS if (fd_info[fd].flags & FILE_SOCKET) { + unsigned long nblock = 0; if (winsock_lib == NULL) abort (); + + /* TODO: implement select() properly so non-blocking I/O works. */ + /* For now, make sure the write blocks. */ + if (fd_info[fd].flags & FILE_NDELAY) + pfn_ioctlsocket (SOCK_HANDLE (fd), FIONBIO, &nblock); + nchars = pfn_send (SOCK_HANDLE (fd), buffer, count, 0); + + /* Set the socket back to non-blocking if it was before, + for other operations that support it. */ + if (fd_info[fd].flags & FILE_NDELAY) + { + nblock = 1; + pfn_ioctlsocket (SOCK_HANDLE (fd), FIONBIO, &nblock); + } + if (nchars == SOCKET_ERROR) { DebPrint(("sys_read.send failed with error %d on socket %ld\n", |