summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/net.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/net.cc')
-rw-r--r--winsup/cygwin/net.cc51
1 files changed, 1 insertions, 50 deletions
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index 91ee74a20..eccf0635f 100644
--- a/winsup/cygwin/net.cc
+++ b/winsup/cygwin/net.cc
@@ -775,56 +775,7 @@ cygwin_connect (int fd, const struct sockaddr *name, int namelen)
if (efault.faulted (EFAULT) || !fh)
res = -1;
else
- {
- bool was_blocking = false;
- if (!fh->is_nonblocking ())
- {
- int nonblocking = 1;
- fh->ioctl (FIONBIO, &nonblocking);
- was_blocking = true;
- }
- res = fh->connect (name, namelen);
- if (was_blocking)
- {
- if (res == -1 && get_errno () == EINPROGRESS)
- {
- size_t fds_size = howmany (fd + 1, NFDBITS) * sizeof (fd_mask);
- fd_set *write_fds = (fd_set *) alloca (fds_size);
- fd_set *except_fds = (fd_set *) alloca (fds_size);
- memset (write_fds, 0, fds_size);
- memset (except_fds, 0, fds_size);
- FD_SET (fd, write_fds);
- FD_SET (fd, except_fds);
- res = cygwin_select (fd + 1, NULL, write_fds, except_fds, NULL);
- if (res > 0 && FD_ISSET (fd, except_fds))
- {
- res = -1;
- for (;;)
- {
- int err;
- int len = sizeof err;
- cygwin_getsockopt (fd, SOL_SOCKET, SO_ERROR,
- (void *) &err, &len);
- if (err)
- {
- set_errno (err);
- break;
- }
- low_priority_sleep (0);
- }
- }
- else if (res > 0)
- res = 0;
- else
- {
- WSASetLastError (WSAEINPROGRESS);
- set_winsock_errno ();
- }
- }
- int nonblocking = 0;
- fh->ioctl (FIONBIO, &nonblocking);
- }
- }
+ res = fh->connect (name, namelen);
syscall_printf ("%d = connect (%d, %p, %d)", res, fd, name, namelen);