* fhandler.h (UNCONNECTED): New define.

(CONNECT_PENDING): Ditto.
	(CONNECTED): Ditto.
	(class fhandler_socket): Add member `had_connect_or_listen'.
	Add member functions `is_unconnected', `is_connect_pending' and
	`is_connected'.
	* fhandler_socket.cc (fhandler_socket::connect): Set member
	`had_connect_or_listen' according to return code of WinSock
	call.
	(fhandler_socket::listen): Ditto.
	* net.cc (cygwin_getsockopt): Modify SO_ERROR return value in
	case of socket with pending connect().
	* select.cc (peek_socket): Only add socket to matching fd_set
	if it's not "ready".  Call WINSOCK_SELECT only if at least one
	socket is in one of the fd_sets.
	(start_thread_socket): Only add socket to matching fd_set
	if it's not "ready".
	(fhandler_socket::select_write): Set write_ready to true also
	if socket isn't connected or listening.
This commit is contained in:
Corinna Vinschen
2002-07-05 18:26:23 +00:00
parent 89ffbd66e7
commit d5591d9df6
5 changed files with 64 additions and 20 deletions

View File

@ -455,6 +455,10 @@ fhandler_socket::connect (const struct sockaddr *name, int namelen)
}
}
if (!res)
had_connect_or_listen = CONNECTED;
else if (WSAGetLastError () == WSAEINPROGRESS)
had_connect_or_listen = CONNECT_PENDING;
return res;
}
@ -464,6 +468,8 @@ fhandler_socket::listen (int backlog)
int res = ::listen (get_socket (), backlog);
if (res)
set_winsock_errno ();
else
had_connect_or_listen = CONNECTED;
return res;
}