Author: cgutman
Date: Fri Aug 14 02:09:59 2009
New Revision: 42661
URL:
http://svn.reactos.org/svn/reactos?rev=42661&view=rev
Log:
- Fix several bugs so select() will now recognize when a connection gets closed
Modified:
trunk/reactos/dll/win32/msafd/misc/dllmain.c
trunk/reactos/dll/win32/msafd/misc/event.c
trunk/reactos/drivers/network/afd/afd/main.c
trunk/reactos/drivers/network/afd/afd/select.c
Modified: trunk/reactos/dll/win32/msafd/misc/dllmain.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msafd/misc/dllma…
==============================================================================
--- trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] Fri Aug 14 02:09:59 2009
@@ -777,6 +777,7 @@
PollInfo->Handles[j].Events = AFD_EVENT_RECEIVE |
AFD_EVENT_DISCONNECT |
AFD_EVENT_ABORT |
+ AFD_EVENT_CLOSE |
AFD_EVENT_ACCEPT;
}
}
@@ -2397,7 +2398,7 @@
if (lNetworkEvents & FD_CLOSE)
{
- AsyncData->AsyncSelectInfo.Handles[0].Events |= AFD_EVENT_DISCONNECT |
AFD_EVENT_ABORT;
+ AsyncData->AsyncSelectInfo.Handles[0].Events |= AFD_EVENT_DISCONNECT |
AFD_EVENT_ABORT | AFD_EVENT_CLOSE;
}
if (lNetworkEvents & FD_QOS)
Modified: trunk/reactos/dll/win32/msafd/misc/event.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msafd/misc/event…
==============================================================================
--- trunk/reactos/dll/win32/msafd/misc/event.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msafd/misc/event.c [iso-8859-1] Fri Aug 14 02:09:59 2009
@@ -76,7 +76,7 @@
}
if (lNetworkEvents & FD_CLOSE) {
- EventSelectInfo.Events |= AFD_EVENT_DISCONNECT | AFD_EVENT_ABORT;
+ EventSelectInfo.Events |= AFD_EVENT_DISCONNECT | AFD_EVENT_ABORT | AFD_EVENT_CLOSE;
}
if (lNetworkEvents & FD_QOS) {
@@ -206,7 +206,7 @@
}
if (EnumReq.PollEvents &
- (AFD_EVENT_DISCONNECT | AFD_EVENT_ABORT)) {
+ (AFD_EVENT_DISCONNECT | AFD_EVENT_ABORT | AFD_EVENT_CLOSE)) {
lpNetworkEvents->lNetworkEvents |= FD_CLOSE;
}
Modified: trunk/reactos/drivers/network/afd/afd/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/ma…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/main.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/main.c [iso-8859-1] Fri Aug 14 02:09:59 2009
@@ -184,6 +184,8 @@
if( !SocketAcquireStateLock( FCB ) ) return STATUS_FILE_CLOSED;
FCB->State = SOCKET_STATE_CLOSED;
+ FCB->PollState = AFD_EVENT_CLOSE;
+ PollReeval( FCB->DeviceExt, FCB->FileObject );
InFlightRequest[0] = &FCB->ListenIrp;
InFlightRequest[1] = &FCB->ReceiveIrp;
Modified: trunk/reactos/drivers/network/afd/afd/select.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/se…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/select.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/select.c [iso-8859-1] Fri Aug 14 02:09:59 2009
@@ -145,7 +145,7 @@
if( (PVOID)HandleArray[i].Handle == FileObject &&
(!OnlyExclusive || (OnlyExclusive && Poll->Exclusive)) ) {
ZeroEvents( PollReq->Handles, PollReq->HandleCount );
- SignalSocket( Poll, NULL, PollReq, STATUS_SUCCESS );
+ SignalSocket( Poll, NULL, PollReq, STATUS_CANCELLED );
}
}
}
@@ -353,20 +353,11 @@
FileObject = (PFILE_OBJECT)AFD_HANDLES(PollReq)[i].Handle;
FCB = FileObject->FsContext;
- if( (FCB->PollState & AFD_EVENT_CLOSE) ||
- (PollReq->Handles[i].Status & AFD_EVENT_CLOSE) ) {
- AFD_HANDLES(PollReq)[i].Handle = 0;
- PollReq->Handles[i].Events = 0;
- PollReq->Handles[i].Status = AFD_EVENT_CLOSE;
+ PollReq->Handles[i].Status = PollReq->Handles[i].Events & FCB->PollState;
+ if( PollReq->Handles[i].Status ) {
+ AFD_DbgPrint(MID_TRACE,("Signalling %x with %x\n",
+ FCB, FCB->PollState));
Signalled++;
- } else {
- PollReq->Handles[i].Status =
- PollReq->Handles[i].Events & FCB->PollState;
- if( PollReq->Handles[i].Status ) {
- AFD_DbgPrint(MID_TRACE,("Signalling %x with %x\n",
- FCB, FCB->PollState));
- Signalled++;
- }
}
}