Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2001-08-15 11:49:15 +0400
committerCorinna Vinschen <corinna@vinschen.de>2001-08-15 11:49:15 +0400
commit5fd12fb0cc61778a909bdae69d8f61d644e135ba (patch)
treeca8096e1a0fb1acc80061ecca2d966269a75b802 /winsup/cygwin/net.cc
parentda3ea61edda86f0f1c3176b5b1ee30265c5ec1a3 (diff)
* fhandler.cc (fhandler_base::is_nonblocking): New method.
(fhandler_base::set_nonblocking): Ditto. * fhandler.h (fhandler_base): Declare new methods `is_nonblocking' and `set_nonblocking'. * fhandler_socket.cc (fhandler_socket::ioctl): Use `set_nonblocking'. * fhandler_tty.cc (fhandler_pty_master::process_slave_output): Use `is_nonblocking'. (fhandler_tty_slave::read): Ditto. (fhandler_tty_slave::ioctl): Use `set_nonblocking'. (fhandler_pty_master::ioctl): Ditto. * net.cc (cygwin_sendto): Fallback to winsock 1 functionality in case of nonblocking IO. (cygwin_recvfrom): Ditto. (cygwin_recv): Ditto. (cygwin_send): Ditto. * syscalls.cc (_read): Use `is_nonblocking'.
Diffstat (limited to 'winsup/cygwin/net.cc')
-rw-r--r--winsup/cygwin/net.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index be68f424c..db7a94978 100644
--- a/winsup/cygwin/net.cc
+++ b/winsup/cygwin/net.cc
@@ -25,7 +25,6 @@ details. */
#define USE_SYS_TYPES_FD_SET
#include <winsock2.h>
#include "cygerrno.h"
-#include "perprocess.h"
#include "security.h"
#include "fhandler.h"
#include "path.h"
@@ -512,7 +511,7 @@ cygwin_sendto (int fd,
if (get_inet_addr (to, tolen, &sin, &tolen) == 0)
return -1;
- if (!(ovr = wsock_evt.prepare ()))
+ if (h->is_nonblocking () || !(ovr = wsock_evt.prepare ()))
{
debug_printf ("Fallback to winsock 1 sendto call");
if ((res = sendto (h->get_socket (), (const char *) buf, len, flags,
@@ -558,7 +557,7 @@ cygwin_recvfrom (int fd,
fhandler_socket *h = (fhandler_socket *) cygheap->fdtab[fd];
sigframe thisframe (mainthread);
- if (!(ovr = wsock_evt.prepare ()))
+ if (h->is_nonblocking () ||!(ovr = wsock_evt.prepare ()))
{
debug_printf ("Fallback to winsock 1 recvfrom call");
if ((res = recvfrom (h->get_socket (), buf, len, flags, from, fromlen))
@@ -1208,7 +1207,7 @@ cygwin_recv (int fd, void *buf, int len, unsigned int flags)
fhandler_socket *h = (fhandler_socket *) cygheap->fdtab[fd];
sigframe thisframe (mainthread);
- if (!(ovr = wsock_evt.prepare ()))
+ if (h->is_nonblocking () || !(ovr = wsock_evt.prepare ()))
{
debug_printf ("Fallback to winsock 1 recv call");
if ((res = recv (h->get_socket (), (char *) buf, len, flags))
@@ -1249,7 +1248,7 @@ cygwin_send (int fd, const void *buf, int len, unsigned int flags)
fhandler_socket *h = (fhandler_socket *) cygheap->fdtab[fd];
sigframe thisframe (mainthread);
- if (!(ovr = wsock_evt.prepare ()))
+ if (h->is_nonblocking () || !(ovr = wsock_evt.prepare ()))
{
debug_printf ("Fallback to winsock 1 send call");
if ((res = send (h->get_socket (), (const char *) buf, len, flags))