- Fix for nonblocking sockets using WSAEventSelect() (patch from Ove

Kaaven).
- Changed WSAEnumNetworkEvents() so it only returns events that the
  application is looking for.
- Changed sock_poll_event() to interpret a POLLIN event with zero
  bytes waiting to be read as a POLLHUP.
oldstable
Daniel Walker 2001-08-23 23:25:33 +00:00 committed by Alexandre Julliard
parent ffb0d94e3d
commit c86517fcb6
2 changed files with 16 additions and 8 deletions

View File

@ -2603,7 +2603,7 @@ int WINAPI WSAEnumNetworkEvents(SOCKET s, WSAEVENT hEvent, LPWSANETWORKEVENTS lp
req->c_event = hEvent;
if (!(ret = SERVER_CALL()))
{
lpEvent->lNetworkEvents = req->pmask;
lpEvent->lNetworkEvents = req->pmask & req->mask;
memcpy(lpEvent->iErrorCode, server_data_ptr(req), server_data_size(req) );
}
}

View File

@ -84,7 +84,7 @@ static void sock_reselect( struct sock *sock )
if (sock->obj.select == -1) {
/* previously unconnected socket, is this reselect supposed to connect it? */
if (!sock->state) return;
if (!(sock->state & ~WS_FD_NONBLOCKING)) return;
/* ok, it is, attach it to the wineserver's main poll loop */
add_select_user( &sock->obj );
}
@ -161,12 +161,20 @@ static void sock_poll_event( struct object *obj, int event )
/* normal data flow */
if (event & POLLIN)
{
/* incoming data */
sock->pmask |= FD_READ;
sock->hmask |= FD_READ;
sock->errors[FD_READ_BIT] = 0;
if (debug_level)
fprintf(stderr, "socket %d is readable\n", sock->obj.fd );
char dummy;
/* Linux 2.4 doesn't report POLLHUP if only one side of the socket
* has been closed, so we need to check for it explicitly here */
if (!recv( sock->obj.fd, &dummy, 1, MSG_PEEK )) event = POLLHUP;
else
{
/* incoming data */
sock->pmask |= FD_READ;
sock->hmask |= FD_READ;
sock->errors[FD_READ_BIT] = 0;
if (debug_level)
fprintf(stderr, "socket %d is readable\n", sock->obj.fd );
}
}
if (event & POLLOUT)
{