From 5f8481f284060f309f0a77f7bf510ba8d9ba55ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9=20van=20Geldorp?= Date: Sat, 17 Sep 2005 21:22:47 +0000 Subject: [PATCH] Count each handle which has pending events only once, independent of the number of pending events. Fixes bug 779. svn path=/trunk/; revision=17902 --- reactos/lib/msafd/misc/dllmain.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/reactos/lib/msafd/misc/dllmain.c b/reactos/lib/msafd/misc/dllmain.c index 4dab2d79682..8cb8eb02a00 100644 --- a/reactos/lib/msafd/misc/dllmain.c +++ b/reactos/lib/msafd/misc/dllmain.c @@ -596,6 +596,7 @@ WSPSelect( PVOID PollBuffer; ULONG i, j = 0, x; HANDLE SockEvent; + BOOL HandleCounted; Status = NtCreateEvent( &SockEvent, GENERIC_READ | GENERIC_WRITE, NULL, 1, FALSE ); @@ -690,6 +691,7 @@ WSPSelect( /* Return in FDSET Format */ for (i = 0; i < HandleCount; i++) { + HandleCounted = FALSE; for(x = 1; x; x<<=1) { switch (PollInfo->Handles[i].Events & x) { case AFD_EVENT_RECEIVE: @@ -700,7 +702,10 @@ WSPSelect( AFD_DbgPrint(MID_TRACE,("Event %x on handle %x\n", PollInfo->Handles[i].Events, PollInfo->Handles[i].Handle)); - OutCount++; + if (! HandleCounted) { + OutCount++; + HandleCounted = TRUE; + } if( readfds ) FD_SET(PollInfo->Handles[i].Handle, readfds); break; @@ -708,7 +713,10 @@ WSPSelect( AFD_DbgPrint(MID_TRACE,("Event %x on handle %x\n", PollInfo->Handles[i].Events, PollInfo->Handles[i].Handle)); - OutCount++; + if (! HandleCounted) { + OutCount++; + HandleCounted = TRUE; + } if( writefds ) FD_SET(PollInfo->Handles[i].Handle, writefds); break; @@ -716,7 +724,10 @@ WSPSelect( AFD_DbgPrint(MID_TRACE,("Event %x on handle %x\n", PollInfo->Handles[i].Events, PollInfo->Handles[i].Handle)); - OutCount++; + if (! HandleCounted) { + OutCount++; + HandleCounted = TRUE; + } if( exceptfds ) FD_SET(PollInfo->Handles[i].Handle, exceptfds); break; }