Cygwin: encapsulate Winsock based fhandler_socket classes
Insert another class fhandler_socket_wsock between fhandler_socket and fhandler_socket_inet/fhandler_socket_local. Also, add a new method fhandler::is_wsock_socket to allow asking for sockets in general (is_socket) vs. Winsock-based sockets (is_wsock_socket). This allows to develop a new handler_socket_unix class as derived class from fhandler_socket without any trace of wsock code left in fhandler_socket. While this is basically a temporary measure at this time, it may prove useful for later interoperability with the upcoming Windows 10 AF_UNIX implementation at one point. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
@@ -94,12 +94,12 @@ poll (struct pollfd *fds, nfds_t nfds, int timeout)
|
||||
{
|
||||
if (fds[i].fd >= 0 && fds[i].revents != POLLNVAL)
|
||||
{
|
||||
fhandler_socket *sock;
|
||||
fhandler_socket_wsock *sock;
|
||||
|
||||
/* Check if the descriptor has been closed, or if shutdown for the
|
||||
read side has been called on a socket. */
|
||||
if (cygheap->fdtab.not_open (fds[i].fd)
|
||||
|| ((sock = cygheap->fdtab[fds[i].fd]->is_socket ())
|
||||
|| ((sock = cygheap->fdtab[fds[i].fd]->is_wsock_socket ())
|
||||
&& sock->saw_shutdown_read ()))
|
||||
fds[i].revents = POLLHUP;
|
||||
else
|
||||
@@ -117,7 +117,7 @@ poll (struct pollfd *fds, nfds_t nfds, int timeout)
|
||||
/* Handle failed connect. A failed connect implicitly sets
|
||||
POLLOUT, if requested, but it doesn't set POLLIN. */
|
||||
if ((fds[i].events & POLLIN)
|
||||
&& (sock = cygheap->fdtab[fds[i].fd]->is_socket ())
|
||||
&& (sock = cygheap->fdtab[fds[i].fd]->is_wsock_socket ())
|
||||
&& sock->connect_state () == connect_failed)
|
||||
fds[i].revents |= (POLLIN | POLLERR);
|
||||
else
|
||||
|
Reference in New Issue
Block a user