Author: cgutman
Date: Mon Aug 8 22:02:55 2011
New Revision: 53145
URL: http://svn.reactos.org/svn/reactos?rev=53145&view=rev
Log:
[AFD]
- Handle canceled reads on datagram sockets
Modified:
trunk/reactos/drivers/network/afd/afd/main.c
trunk/reactos/drivers/network/afd/afd/read.c
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] Mon Aug 8 22:02:55 2011
@@ -693,23 +693,19 @@
/* Mark that we can't issue another receive request */
FCB->TdiReceiveClosed = TRUE;
- /* These are only for connection-oriented sockets */
- if (!(FCB->Flags & AFD_ENDPOINT_CONNECTIONLESS))
- {
- /* Try to cancel a pending TDI receive IRP if there was one in progress */
- if (FCB->ReceiveIrp.InFlightRequest)
- IoCancelIrp(FCB->ReceiveIrp.InFlightRequest);
-
- /* Discard any pending data */
- FCB->Recv.Content = 0;
- FCB->Recv.BytesUsed = 0;
-
- /* Mark us as overread to complete future reads with an error */
- FCB->Overread = TRUE;
-
- /* Set a successful close status to indicate a shutdown on overread */
- FCB->PollStatus[FD_CLOSE_BIT] = STATUS_SUCCESS;
- }
+ /* Try to cancel a pending TDI receive IRP if there was one in progress */
+ if (FCB->ReceiveIrp.InFlightRequest)
+ IoCancelIrp(FCB->ReceiveIrp.InFlightRequest);
+
+ /* Discard any pending data */
+ FCB->Recv.Content = 0;
+ FCB->Recv.BytesUsed = 0;
+
+ /* Mark us as overread to complete future reads with an error */
+ FCB->Overread = TRUE;
+
+ /* Set a successful close status to indicate a shutdown on overread */
+ FCB->PollStatus[FD_CLOSE_BIT] = STATUS_SUCCESS;
/* Clear the receive event */
FCB->PollState &= ~AFD_EVENT_RECEIVE;
Modified: trunk/reactos/drivers/network/afd/afd/read.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/re…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/read.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/read.c [iso-8859-1] Mon Aug 8 22:02:55 2011
@@ -588,6 +588,12 @@
return Irp->IoStatus.Status;
}
+ if (FCB->TdiReceiveClosed)
+ {
+ SocketStateUnlock(FCB);
+ return STATUS_FILE_CLOSED;
+ }
+
DatagramRecv = ExAllocatePool( NonPagedPool, DGSize );
if( DatagramRecv ) {