Solved a 'bug' in GSocket_Select (a bug in the user side, I'd say)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5997 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Guillermo Rodriguez Garcia 2000-02-13 19:04:55 +00:00
parent c9a586dbe4
commit 5330a86957

View File

@ -767,15 +767,18 @@ int GSocket_Write(GSocket *socket, const char *buffer, int size)
GSocketEventFlags GSocket_Select(GSocket *socket, GSocketEventFlags flags)
{
GSocketEventFlags result = 0;
char c;
assert(socket != NULL);
result = flags & socket->m_detected;
if ((flags & GSOCK_INPUT_FLAG) &&
(recv(socket->m_fd, &c, 1, MSG_PEEK) > 0))
/* Explicitly check for input events */
if ((flags & GSOCK_INPUT_FLAG) && (socket->m_fd != INVALID_SOCKET))
{
u_long arg = 0;
int ret = ioctlsocket(socket->m_fd, FIONREAD, (u_long FAR *) &arg);
if ((ret == 0) && (arg > 0))
result |= GSOCK_INPUT_FLAG;
}
@ -1041,8 +1044,6 @@ GSocketError _GSocket_Connect_Timeout(GSocket *socket)
fd_set writefds;
fd_set exceptfds;
if (!socket->m_non_blocking)
{
FD_ZERO(&writefds);
FD_ZERO(&exceptfds);
FD_SET(socket->m_fd, &writefds);
@ -1052,7 +1053,6 @@ GSocketError _GSocket_Connect_Timeout(GSocket *socket)
socket->m_error = GSOCK_TIMEDOUT;
return GSOCK_TIMEDOUT;
}
}
if (!FD_ISSET(socket->m_fd, &writefds))
{
socket->m_error = GSOCK_IOERR;