* fhandler_socket.cc: Revert misguided attempt to handle FD_CLOSE error

conditions in evaluate_events.
	(search_wsa_event_slot): Move wrongly placed memset in
	fhandler_socket::init_events here.
	(fhandler_socket::init_events): Initially set FD_WRITE event for
	connectionless sockets.
	* poll.cc (poll): Don't add sockets always to except_fds since select
	is now supposed to do it right.
	* select.cc (set_bits): Set connection state correctly for failed
	af_local_connect on local sockets.  Remove socket special handling
	for except_selected descriptors.
	(peek_socket): Try to set the read/write/exception bits actually
	correctly.
This commit is contained in:
Corinna Vinschen
2006-07-27 13:58:54 +00:00
parent 883861544a
commit fd5879c110
4 changed files with 50 additions and 44 deletions

View File

@ -1,6 +1,6 @@
/* poll.cc. Implements poll(2) via usage of select(2) call.
Copyright 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc.
Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc.
This file is part of Cygwin.
@ -63,9 +63,7 @@ poll (struct pollfd *fds, unsigned int nfds, int timeout)
FD_SET(fds[i].fd, read_fds);
if (fds[i].events & POLLOUT)
FD_SET(fds[i].fd, write_fds);
/* On sockets, except_fds is needed to catch failed connects. */
if ((fds[i].events & POLLPRI)
|| cygheap->fdtab[fds[i].fd]->is_socket ())
if (fds[i].events & POLLPRI)
FD_SET(fds[i].fd, except_fds);
}
else if (fds[i].fd >= 0)
@ -127,7 +125,6 @@ poll (struct pollfd *fds, unsigned int nfds, int timeout)
}
/* Handle failed connect. */
if (FD_ISSET(fds[i].fd, write_fds)
&& FD_ISSET(fds[i].fd, except_fds)
&& (sock = cygheap->fdtab[fds[i].fd]->is_socket ())
&& sock->connect_state () == connect_failed)
fds[i].revents |= (POLLIN | POLLERR);