From cbeac4750eb66845d67af86aa5145a7dabc5c009 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 14 Jun 2011 02:18:20 +0000 Subject: [PATCH] [AFD] - Only indicate that receive is possible if there are no pending receive IRPs waiting for data - Don't attempt to receive on a connection which has been closed in the receive direction svn path=/trunk/; revision=52224 --- reactos/drivers/network/afd/afd/read.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/reactos/drivers/network/afd/afd/read.c b/reactos/drivers/network/afd/afd/read.c index 728b72434e1..142ce309089 100644 --- a/reactos/drivers/network/afd/afd/read.c +++ b/reactos/drivers/network/afd/afd/read.c @@ -49,7 +49,8 @@ static BOOLEAN CantReadMore( PAFD_FCB FCB ) { static VOID RefillSocketBuffer( PAFD_FCB FCB ) { NTSTATUS Status; - if( !FCB->ReceiveIrp.InFlightRequest ) { + if( !FCB->ReceiveIrp.InFlightRequest && + !(FCB->PollState & (AFD_EVENT_CLOSE | AFD_EVENT_ABORT)) ) { AFD_DbgPrint(MID_TRACE,("Replenishing buffer\n")); Status = TdiReceive( &FCB->ReceiveIrp.InFlightRequest, @@ -216,7 +217,8 @@ static NTSTATUS ReceiveActivity( PAFD_FCB FCB, PIRP Irp ) { } } - if( FCB->Recv.Content - FCB->Recv.BytesUsed ) { + if( FCB->Recv.Content - FCB->Recv.BytesUsed && + IsListEmpty(&FCB->PendingIrpList[FUNCTION_RECV]) ) { FCB->PollState |= AFD_EVENT_RECEIVE; FCB->PollStatus[FD_READ_BIT] = STATUS_SUCCESS; PollReeval( FCB->DeviceExt, FCB->FileObject ); @@ -576,7 +578,7 @@ PacketSocketRecvComplete( } } - if( !IsListEmpty( &FCB->DatagramList ) ) { + if( !IsListEmpty( &FCB->DatagramList ) && IsListEmpty(&FCB->PendingIrpList[FUNCTION_RECV]) ) { AFD_DbgPrint(MID_TRACE,("Signalling\n")); FCB->PollState |= AFD_EVENT_RECEIVE; FCB->PollStatus[FD_READ_BIT] = STATUS_SUCCESS;