Author: cgutman
Date: Thu Jun 30 06:04:09 2011
New Revision: 52492
URL:
http://svn.reactos.org/svn/reactos?rev=52492&view=rev
Log:
[AFD]
- Fix several bugs related to the FD_WRITE event
- We would not set the sendable poll state if the socket had data waiting to be sent even
if there was buffer space
- We did not set the poll state after performing a send
- We did not clear the sendable poll state if we ran out of buffer space
Modified:
trunk/reactos/drivers/network/afd/afd/write.c
Modified: trunk/reactos/drivers/network/afd/afd/write.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/wr…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/write.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/write.c [iso-8859-1] Thu Jun 30 06:04:09 2011
@@ -156,11 +156,21 @@
else
break;
}
+
+ if (FCB->Send.Size - FCB->Send.BytesUsed != 0)
+ {
+ FCB->PollState |= AFD_EVENT_SEND;
+ FCB->PollStatus[FD_WRITE_BIT] = STATUS_SUCCESS;
+ PollReeval( FCB->DeviceExt, FCB->FileObject );
+ }
+ else
+ {
+ FCB->PollState &= ~AFD_EVENT_SEND;
+ }
/* Some data is still waiting */
- if( FCB->Send.BytesUsed ) {
- FCB->PollState &= ~AFD_EVENT_SEND;
-
+ if( FCB->Send.BytesUsed )
+ {
Status = TdiSend( &FCB->SendIrp.InFlightRequest,
FCB->Connection.Object,
0,
@@ -171,10 +181,6 @@
FCB );
RetryDisconnectCompletion(FCB);
- } else {
- FCB->PollState |= AFD_EVENT_SEND;
- FCB->PollStatus[FD_WRITE_BIT] = STATUS_SUCCESS;
- PollReeval( FCB->DeviceExt, FCB->FileObject );
}
SocketStateUnlock( FCB );
@@ -388,6 +394,7 @@
}
else
{
+ FCB->PollState &= ~AFD_EVENT_SEND;
if( SendReq->AfdFlags & AFD_IMMEDIATE ) {
AFD_DbgPrint(MID_TRACE,("Nonblocking\n"));
UnlockBuffers( SendReq->BufferArray, SendReq->BufferCount, FALSE );
@@ -415,6 +422,17 @@
AFD_DbgPrint(MID_TRACE,("Dismissing request: %x (%d)\n",
Status, TotalBytesCopied));
+ }
+
+ if (SpaceAvail)
+ {
+ FCB->PollState |= AFD_EVENT_SEND;
+ FCB->PollStatus[FD_WRITE_BIT] = STATUS_SUCCESS;
+ PollReeval( FCB->DeviceExt, FCB->FileObject );
+ }
+ else
+ {
+ FCB->PollState &= ~AFD_EVENT_SEND;
}
RetryDisconnectCompletion(FCB);