diff options
| author | Jason Rumney | 2002-11-25 23:30:19 +0000 |
|---|---|---|
| committer | Jason Rumney | 2002-11-25 23:30:19 +0000 |
| commit | 30a32e0ea1598711765e1b4fda938b4ea07d6ea7 (patch) | |
| tree | f5eb58fd2cc91990d4fa47d5d80db8f5b98d141f | |
| parent | 8cc0371672faea8c6e740c189004ee2dc5e3cf4e (diff) | |
| download | emacs-30a32e0ea1598711765e1b4fda938b4ea07d6ea7.tar.gz emacs-30a32e0ea1598711765e1b4fda938b4ea07d6ea7.zip | |
(sys_write): Avoid non-blocking mode, which is not fully
supported.
| -rw-r--r-- | src/w32.c | 16 |
1 files changed, 16 insertions, 0 deletions
| @@ -3709,8 +3709,24 @@ sys_write (int fd, const void * buffer, unsigned int count) | |||
| 3709 | #ifdef HAVE_SOCKETS | 3709 | #ifdef HAVE_SOCKETS |
| 3710 | if (fd_info[fd].flags & FILE_SOCKET) | 3710 | if (fd_info[fd].flags & FILE_SOCKET) |
| 3711 | { | 3711 | { |
| 3712 | unsigned long nblock = 0; | ||
| 3712 | if (winsock_lib == NULL) abort (); | 3713 | if (winsock_lib == NULL) abort (); |
| 3714 | |||
| 3715 | /* TODO: implement select() properly so non-blocking I/O works. */ | ||
| 3716 | /* For now, make sure the write blocks. */ | ||
| 3717 | if (fd_info[fd].flags & FILE_NDELAY) | ||
| 3718 | pfn_ioctlsocket (SOCK_HANDLE (fd), FIONBIO, &nblock); | ||
| 3719 | |||
| 3713 | nchars = pfn_send (SOCK_HANDLE (fd), buffer, count, 0); | 3720 | nchars = pfn_send (SOCK_HANDLE (fd), buffer, count, 0); |
| 3721 | |||
| 3722 | /* Set the socket back to non-blocking if it was before, | ||
| 3723 | for other operations that support it. */ | ||
| 3724 | if (fd_info[fd].flags & FILE_NDELAY) | ||
| 3725 | { | ||
| 3726 | nblock = 1; | ||
| 3727 | pfn_ioctlsocket (SOCK_HANDLE (fd), FIONBIO, &nblock); | ||
| 3728 | } | ||
| 3729 | |||
| 3714 | if (nchars == SOCKET_ERROR) | 3730 | if (nchars == SOCKET_ERROR) |
| 3715 | { | 3731 | { |
| 3716 | DebPrint(("sys_read.send failed with error %d on socket %ld\n", | 3732 | DebPrint(("sys_read.send failed with error %d on socket %ld\n", |