* fhandler.h (struct wsa_event): Define here.

(class fhandler_socket): Make wsock_evt private again.
	(fhandler_socket::wsock_event): New read accessor for wsock_evt.
	(fhandler_socket::serial_number): New read accessor to get the
	socket's serial number.
	(fhandler_socket::ready_for_read): Just return true.
	* fhandler_socket.cc (struct wsa_event): Move definition to fhandler.h.
	* select.cc (struct socketinf): Add serial number vector.
	(start_thread_socket): Identify duplicate sockets by their serial
	number, not (wrongly) by their wsock_evt.
This commit is contained in:
Corinna Vinschen
2006-07-28 08:50:46 +00:00
parent bc31293a0d
commit 8f713b6b08
4 changed files with 35 additions and 15 deletions

View File

@@ -1286,6 +1286,7 @@ struct socketinf
{
cygthread *thread;
int num_w4;
LONG ser_num[MAXIMUM_WAIT_OBJECTS];
HANDLE w4[MAXIMUM_WAIT_OBJECTS];
select_record *start;
};
@@ -1344,13 +1345,18 @@ start_thread_socket (select_record *me, select_stuff *stuff)
while ((s = s->next))
if (s->startup == start_thread_socket)
{
HANDLE evt = ((fhandler_socket *) me->fh)->wsock_evt;
/* No event/socket should show up multiple times. */
/* No event/socket should show up multiple times. Every socket
is uniquely identified by its serial number in the global
wsock_events record. */
const LONG ser_num = ((fhandler_socket *) me->fh)->serial_number ();
for (int i = 1; i < si->num_w4; ++i)
if (si->w4[i] == evt)
if (si->ser_num[i] == ser_num)
goto continue_outer_loop;
if (si->num_w4 < MAXIMUM_WAIT_OBJECTS)
si->w4[si->num_w4++] = evt;
{
si->ser_num[si->num_w4] = ser_num;
si->w4[si->num_w4++] = ((fhandler_socket *) me->fh)->wsock_event ();
}
else /* for now */
goto err;
continue_outer_loop: