Author: cgutman
Date: Fri May 28 05:55:50 2010
New Revision: 47377
URL:
http://svn.reactos.org/svn/reactos?rev=47377&view=rev
Log:
[MSAFD]
- Remove an incorrect change
- Create a new function called TranslateNtStatusError to translate NTSTATUS to winsock
error codes
- Call the TranslateNtStatusError in MsafdReturnWithErrno and also use it to translate
AFD's poll event error codes
[AFD]
- Track the status for each poll event in our FCB and copy it back when we get an
IOCTL_AFD_ENUM_NETWORK_EVENTS IRP
- Remove some useless PollReeval calls
Modified:
trunk/reactos/dll/win32/msafd/misc/dllmain.c
trunk/reactos/dll/win32/msafd/misc/event.c
trunk/reactos/dll/win32/msafd/msafd.h
trunk/reactos/drivers/network/afd/afd/connect.c
trunk/reactos/drivers/network/afd/afd/listen.c
trunk/reactos/drivers/network/afd/afd/main.c
trunk/reactos/drivers/network/afd/afd/read.c
trunk/reactos/drivers/network/afd/afd/select.c
trunk/reactos/drivers/network/afd/afd/write.c
trunk/reactos/drivers/network/afd/include/afd.h
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 May 28 05:55:50 2010
@@ -318,79 +318,86 @@
return INVALID_SOCKET;
}
+INT
+TranslateNtStatusError(NTSTATUS Status)
+{
+ switch (Status)
+ {
+ case STATUS_CANT_WAIT:
+ return WSAEWOULDBLOCK;
+
+ case STATUS_TIMEOUT:
+ return WSAETIMEDOUT;
+
+ case STATUS_SUCCESS:
+ return NO_ERROR;
+
+ case STATUS_FILE_CLOSED:
+ case STATUS_END_OF_FILE:
+ return WSAESHUTDOWN;
+
+ case STATUS_PENDING:
+ return WSA_IO_PENDING;
+
+ case STATUS_BUFFER_TOO_SMALL:
+ case STATUS_BUFFER_OVERFLOW:
+ DbgPrint("MSAFD: STATUS_BUFFER_TOO_SMALL/STATUS_BUFFER_OVERFLOW\n");
+ return WSAEMSGSIZE;
+
+ case STATUS_NO_MEMORY:
+ case STATUS_INSUFFICIENT_RESOURCES:
+ DbgPrint("MSAFD: STATUS_NO_MEMORY/STATUS_INSUFFICIENT_RESOURCES\n");
+ return WSAENOBUFS;
+
+ case STATUS_INVALID_CONNECTION:
+ DbgPrint("MSAFD: STATUS_INVALID_CONNECTION\n");
+ return WSAEAFNOSUPPORT;
+
+ case STATUS_INVALID_ADDRESS:
+ DbgPrint("MSAFD: STATUS_INVALID_ADDRESS\n");
+ return WSAEADDRNOTAVAIL;
+
+ case STATUS_REMOTE_NOT_LISTENING:
+ DbgPrint("MSAFD: STATUS_REMOTE_NOT_LISTENING\n");
+ return WSAECONNREFUSED;
+
+ case STATUS_NETWORK_UNREACHABLE:
+ DbgPrint("MSAFD: STATUS_NETWORK_UNREACHABLE\n");
+ return WSAENETUNREACH;
+
+ case STATUS_INVALID_PARAMETER:
+ DbgPrint("MSAFD: STATUS_INVALID_PARAMETER\n");
+ return WSAEINVAL;
+
+ case STATUS_CANCELLED:
+ DbgPrint("MSAFD: STATUS_CANCELLED\n");
+ return WSA_OPERATION_ABORTED;
+
+ default:
+ DbgPrint("MSAFD: Unhandled NTSTATUS value: 0x%x\n", Status);
+ return WSAENETDOWN;
+ }
+}
DWORD MsafdReturnWithErrno(NTSTATUS Status,
LPINT Errno,
DWORD Received,
LPDWORD ReturnedBytes)
{
- if( ReturnedBytes )
- *ReturnedBytes = 0;
- if( Errno )
- {
- switch (Status)
- {
- case STATUS_CANT_WAIT:
- *Errno = WSAEWOULDBLOCK;
- break;
- case STATUS_TIMEOUT:
- *Errno = WSAETIMEDOUT;
- break;
- case STATUS_SUCCESS:
- /* Return Number of bytes Read */
- if( ReturnedBytes )
+ if (Errno)
+ {
+ *Errno = TranslateNtStatusError(Status);
+
+ if (ReturnedBytes)
+ {
+ if (!*Errno)
*ReturnedBytes = Received;
- break;
- case STATUS_FILE_CLOSED:
- case STATUS_END_OF_FILE:
- *Errno = WSAESHUTDOWN;
- break;
- case STATUS_PENDING:
- *Errno = WSA_IO_PENDING;
- break;
- case STATUS_BUFFER_TOO_SMALL:
- case STATUS_BUFFER_OVERFLOW:
- DbgPrint("MSAFD:
STATUS_BUFFER_TOO_SMALL/STATUS_BUFFER_OVERFLOW\n");
- *Errno = WSAEMSGSIZE;
- break;
- case STATUS_NO_MEMORY: /* Fall through to STATUS_INSUFFICIENT_RESOURCES */
- case STATUS_INSUFFICIENT_RESOURCES:
- DbgPrint("MSAFD:
STATUS_NO_MEMORY/STATUS_INSUFFICIENT_RESOURCES\n");
- *Errno = WSAENOBUFS;
- break;
- case STATUS_INVALID_CONNECTION:
- DbgPrint("MSAFD: STATUS_INVALID_CONNECTION\n");
- *Errno = WSAEAFNOSUPPORT;
- break;
- case STATUS_INVALID_ADDRESS:
- DbgPrint("MSAFD: STATUS_INVALID_ADDRESS\n");
- *Errno = WSAEADDRNOTAVAIL;
- break;
- case STATUS_REMOTE_NOT_LISTENING:
- DbgPrint("MSAFD: STATUS_REMOTE_NOT_LISTENING\n");
- *Errno = WSAECONNREFUSED;
- break;
- case STATUS_NETWORK_UNREACHABLE:
- DbgPrint("MSAFD: STATUS_NETWORK_UNREACHABLE\n");
- *Errno = WSAENETUNREACH;
- break;
- case STATUS_INVALID_PARAMETER:
- DbgPrint("MSAFD: STATUS_INVALID_PARAMETER\n");
- *Errno = WSAEINVAL;
- break;
- case STATUS_CANCELLED:
- DbgPrint("MSAFD: STATUS_CANCELLED\n");
- *Errno = WSA_OPERATION_ABORTED;
- break;
- default:
- DbgPrint("MSAFD: Error %x is unknown\n", Status);
- *Errno = WSAEINVAL;
- break;
- }
- }
-
- /* Success */
- return Status == STATUS_SUCCESS ? 0 : SOCKET_ERROR;
+ else
+ *ReturnedBytes = 0;
+ }
+ }
+
+ return Status ? SOCKET_ERROR : 0;
}
/*
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 May 28 05:55:50 2010
@@ -179,51 +179,51 @@
AFD_DbgPrint(MID_TRACE,("About to touch struct at %x (%d)\n",
lpNetworkEvents, sizeof(*lpNetworkEvents)));
- RtlZeroMemory(lpNetworkEvents, sizeof(*lpNetworkEvents));
+ lpNetworkEvents->lNetworkEvents = 0;
AFD_DbgPrint(MID_TRACE,("Zeroed struct\n"));
/* Set Events to wait for */
if (EnumReq.PollEvents & AFD_EVENT_RECEIVE) {
lpNetworkEvents->lNetworkEvents |= FD_READ;
- lpNetworkEvents->iErrorCode[FD_READ_BIT] = EnumReq.EventStatus[FD_READ_BIT];
+ lpNetworkEvents->iErrorCode[FD_READ_BIT] =
TranslateNtStatusError(EnumReq.EventStatus[FD_READ_BIT]);
}
if (EnumReq.PollEvents & AFD_EVENT_SEND) {
lpNetworkEvents->lNetworkEvents |= FD_WRITE;
- lpNetworkEvents->iErrorCode[FD_WRITE_BIT] = EnumReq.EventStatus[FD_WRITE_BIT];
+ lpNetworkEvents->iErrorCode[FD_WRITE_BIT] =
TranslateNtStatusError(EnumReq.EventStatus[FD_WRITE_BIT]);
}
if (EnumReq.PollEvents & AFD_EVENT_OOB_RECEIVE) {
lpNetworkEvents->lNetworkEvents |= FD_OOB;
- lpNetworkEvents->iErrorCode[FD_OOB_BIT] = EnumReq.EventStatus[FD_OOB_BIT];
+ lpNetworkEvents->iErrorCode[FD_OOB_BIT] =
TranslateNtStatusError(EnumReq.EventStatus[FD_OOB_BIT]);
}
if (EnumReq.PollEvents & AFD_EVENT_ACCEPT) {
lpNetworkEvents->lNetworkEvents |= FD_ACCEPT;
- lpNetworkEvents->iErrorCode[FD_ACCEPT_BIT] = EnumReq.EventStatus[FD_ACCEPT_BIT];
+ lpNetworkEvents->iErrorCode[FD_ACCEPT_BIT] =
TranslateNtStatusError(EnumReq.EventStatus[FD_ACCEPT_BIT]);
}
if (EnumReq.PollEvents &
(AFD_EVENT_CONNECT | AFD_EVENT_CONNECT_FAIL)) {
lpNetworkEvents->lNetworkEvents |= FD_CONNECT;
- lpNetworkEvents->iErrorCode[FD_CONNECT_BIT] = EnumReq.EventStatus[FD_CONNECT_BIT];
+ lpNetworkEvents->iErrorCode[FD_CONNECT_BIT] =
TranslateNtStatusError(EnumReq.EventStatus[FD_CONNECT_BIT]);
}
if (EnumReq.PollEvents &
(AFD_EVENT_DISCONNECT | AFD_EVENT_ABORT | AFD_EVENT_CLOSE)) {
lpNetworkEvents->lNetworkEvents |= FD_CLOSE;
- lpNetworkEvents->iErrorCode[FD_CLOSE_BIT] = EnumReq.EventStatus[FD_CLOSE_BIT];
+ lpNetworkEvents->iErrorCode[FD_CLOSE_BIT] =
TranslateNtStatusError(EnumReq.EventStatus[FD_CLOSE_BIT]);
}
if (EnumReq.PollEvents & AFD_EVENT_QOS) {
lpNetworkEvents->lNetworkEvents |= FD_QOS;
- lpNetworkEvents->iErrorCode[FD_QOS_BIT] = EnumReq.EventStatus[FD_QOS_BIT];
+ lpNetworkEvents->iErrorCode[FD_QOS_BIT] =
TranslateNtStatusError(EnumReq.EventStatus[FD_QOS_BIT]);
}
if (EnumReq.PollEvents & AFD_EVENT_GROUP_QOS) {
lpNetworkEvents->lNetworkEvents |= FD_GROUP_QOS;
- lpNetworkEvents->iErrorCode[FD_GROUP_QOS_BIT] =
EnumReq.EventStatus[FD_GROUP_QOS_BIT];
+ lpNetworkEvents->iErrorCode[FD_GROUP_QOS_BIT] =
TranslateNtStatusError(EnumReq.EventStatus[FD_GROUP_QOS_BIT]);
}
if( NT_SUCCESS(Status) ) *lpErrno = 0;
Modified: trunk/reactos/dll/win32/msafd/msafd.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msafd/msafd.h?re…
==============================================================================
--- trunk/reactos/dll/win32/msafd/msafd.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msafd/msafd.h [iso-8859-1] Fri May 28 05:55:50 2010
@@ -409,6 +409,8 @@
SOCKET Handle
);
+INT TranslateNtStatusError( NTSTATUS Status );
+
VOID DeleteSocketStructure( SOCKET Handle );
int GetSocketInformation(
Modified: trunk/reactos/drivers/network/afd/afd/connect.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/co…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/connect.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/connect.c [iso-8859-1] Fri May 28 05:55:50 2010
@@ -247,6 +247,8 @@
if( Status == STATUS_PENDING ) Status = STATUS_SUCCESS;
FCB->PollState |= AFD_EVENT_CONNECT | AFD_EVENT_SEND;
+ FCB->PollStatus[FD_CONNECT_BIT] = STATUS_SUCCESS;
+ FCB->PollStatus[FD_WRITE_BIT] = STATUS_SUCCESS;
PollReeval( FCB->DeviceExt, FCB->FileObject );
return Status;
@@ -291,6 +293,7 @@
if( !NT_SUCCESS(Irp->IoStatus.Status) ) {
FCB->PollState |= AFD_EVENT_CONNECT_FAIL;
+ FCB->PollStatus[FD_CONNECT_BIT] = Irp->IoStatus.Status;
AFD_DbgPrint(MID_TRACE,("Going to bound state\n"));
FCB->State = SOCKET_STATE_BOUND;
PollReeval( FCB->DeviceExt, FCB->FileObject );
Modified: trunk/reactos/drivers/network/afd/afd/listen.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/li…
==============================================================================
--- trunk/reactos/drivers/network/afd/afd/listen.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/afd/listen.c [iso-8859-1] Fri May 28 05:55:50 2010
@@ -193,11 +193,10 @@
/* Trigger a select return if appropriate */
if( !IsListEmpty( &FCB->PendingConnections ) ) {
FCB->PollState |= AFD_EVENT_ACCEPT;
- } else {
- FCB->PollState &= ~AFD_EVENT_ACCEPT;
- }
-
- PollReeval( FCB->DeviceExt, FCB->FileObject );
+ FCB->PollStatus[FD_ACCEPT_BIT] = STATUS_SUCCESS;
+ PollReeval( FCB->DeviceExt, FCB->FileObject );
+ } else
+ FCB->PollState &= ~AFD_EVENT_ACCEPT;
SocketStateUnlock( FCB );
@@ -293,12 +292,13 @@
AFD_DbgPrint(MID_TRACE,("Completed a wait for accept\n"));
- if ( IsListEmpty( &FCB->PendingConnections ) )
+ if ( !IsListEmpty( &FCB->PendingConnections ) )
+ {
+ FCB->PollState |= AFD_EVENT_ACCEPT;
+ FCB->PollStatus[FD_ACCEPT_BIT] = STATUS_SUCCESS;
+ PollReeval( FCB->DeviceExt, FCB->FileObject );
+ } else
FCB->PollState &= ~AFD_EVENT_ACCEPT;
- else
- FCB->PollState |= AFD_EVENT_ACCEPT;
-
- PollReeval( FCB->DeviceExt, FCB->FileObject );
SocketStateUnlock( FCB );
return Status;
@@ -402,13 +402,12 @@
ExFreePool( PendingConnObj );
- if( IsListEmpty( &FCB->PendingConnections ) ) {
- FCB->PollState &= ~AFD_EVENT_ACCEPT;
- } else {
+ if( !IsListEmpty( &FCB->PendingConnections ) ) {
FCB->PollState |= AFD_EVENT_ACCEPT;
- }
-
- PollReeval( FCB->DeviceExt, FCB->FileObject );
+ FCB->PollStatus[FD_ACCEPT_BIT] = STATUS_SUCCESS;
+ PollReeval( FCB->DeviceExt, FCB->FileObject );
+ } else
+ FCB->PollState &= ~AFD_EVENT_ACCEPT;
SocketStateUnlock( FCB );
return Status;
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 May 28 05:55:50 2010
@@ -314,6 +314,7 @@
/* A datagram socket is always sendable */
FCB->PollState |= AFD_EVENT_SEND;
+ FCB->PollStatus[FD_WRITE_BIT] = STATUS_SUCCESS;
PollReeval( FCB->DeviceExt, FCB->FileObject );
}
@@ -377,6 +378,7 @@
FCB->State = SOCKET_STATE_CLOSED;
FCB->PollState = AFD_EVENT_CLOSE;
+ FCB->PollStatus[FD_CLOSE_BIT] = STATUS_SUCCESS; //I think we can return success
here
PollReeval( FCB->DeviceExt, FCB->FileObject );
InFlightRequest[0] = &FCB->ListenIrp;
@@ -542,6 +544,7 @@
ExFreePool( ConnectionReturnInfo );
FCB->PollState |= AFD_EVENT_DISCONNECT;
+ FCB->PollStatus[FD_CLOSE_BIT] = STATUS_SUCCESS;
PollReeval( FCB->DeviceExt, FCB->FileObject );
} else
Status = STATUS_INVALID_PARAMETER;
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] Fri May 28 05:55:50 2010
@@ -46,6 +46,7 @@
{
/* The socket has been closed */
FCB->PollState |= AFD_EVENT_DISCONNECT;
+ FCB->PollStatus[FD_CLOSE_BIT] = Status;
FCB->Overread = TRUE;
Status = STATUS_FILE_CLOSED;
}
@@ -53,6 +54,7 @@
{
FCB->Recv.Content = FCB->ReceiveIrp.Iosb.Information;
FCB->PollState |= AFD_EVENT_RECEIVE;
+ FCB->PollStatus[FD_READ_BIT] = STATUS_SUCCESS;
}
PollReeval( FCB->DeviceExt, FCB->FileObject );
}
@@ -189,10 +191,10 @@
if( FCB->Recv.Content ) {
FCB->PollState |= AFD_EVENT_RECEIVE;
+ FCB->PollStatus[FD_READ_BIT] = STATUS_SUCCESS;
+ PollReeval( FCB->DeviceExt, FCB->FileObject );
} else
- FCB->PollState &= ~AFD_EVENT_RECEIVE;
-
- PollReeval( FCB->DeviceExt, FCB->FileObject );
+ FCB->PollState &= ~AFD_EVENT_RECEIVE;
AFD_DbgPrint(MID_TRACE,("RetStatus for irp %x is %x\n", Irp, RetStatus));
@@ -538,10 +540,10 @@
if( !IsListEmpty( &FCB->DatagramList ) ) {
AFD_DbgPrint(MID_TRACE,("Signalling\n"));
FCB->PollState |= AFD_EVENT_RECEIVE;
+ FCB->PollStatus[FD_READ_BIT] = STATUS_SUCCESS;
+ PollReeval( FCB->DeviceExt, FCB->FileObject );
} else
- FCB->PollState &= ~AFD_EVENT_RECEIVE;
-
- PollReeval( FCB->DeviceExt, FCB->FileObject );
+ FCB->PollState &= ~AFD_EVENT_RECEIVE;
if( NT_SUCCESS(Irp->IoStatus.Status) ) {
/* Now relaunch the datagram request */
@@ -608,12 +610,12 @@
Status = Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
Irp->IoStatus.Information = DatagramRecv->Len;
- if( IsListEmpty( &FCB->DatagramList ) )
- FCB->PollState &= ~AFD_EVENT_RECEIVE;
- else
+ if( !IsListEmpty( &FCB->DatagramList ) ) {
FCB->PollState |= AFD_EVENT_RECEIVE;
-
- PollReeval( FCB->DeviceExt, FCB->FileObject );
+ FCB->PollStatus[FD_READ_BIT] = STATUS_SUCCESS;
+ PollReeval( FCB->DeviceExt, FCB->FileObject );
+ } else
+ FCB->PollState &= ~AFD_EVENT_RECEIVE;
UnlockBuffers( RecvReq->BufferArray, RecvReq->BufferCount, TRUE );
@@ -624,12 +626,12 @@
( FCB, Irp, DatagramRecv,
(PUINT)&Irp->IoStatus.Information );
- if( IsListEmpty( &FCB->DatagramList ) )
- FCB->PollState &= ~AFD_EVENT_RECEIVE;
- else
+ if( !IsListEmpty( &FCB->DatagramList ) ) {
FCB->PollState |= AFD_EVENT_RECEIVE;
-
- PollReeval( FCB->DeviceExt, FCB->FileObject );
+ FCB->PollStatus[FD_READ_BIT] = STATUS_SUCCESS;
+ PollReeval( FCB->DeviceExt, FCB->FileObject );
+ } else
+ FCB->PollState &= ~AFD_EVENT_RECEIVE;
UnlockBuffers( RecvReq->BufferArray, RecvReq->BufferCount, TRUE );
@@ -640,12 +642,10 @@
AFD_DbgPrint(MID_TRACE,("Nonblocking\n"));
Status = STATUS_CANT_WAIT;
FCB->PollState &= ~AFD_EVENT_RECEIVE;
- PollReeval( FCB->DeviceExt, FCB->FileObject );
UnlockBuffers( RecvReq->BufferArray, RecvReq->BufferCount, TRUE );
return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
} else {
FCB->PollState &= ~AFD_EVENT_RECEIVE;
- PollReeval( FCB->DeviceExt, FCB->FileObject );
return LeaveIrpUntilLater( FCB, Irp, FUNCTION_RECV );
}
}
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 May 28 05:55:50 2010
@@ -325,7 +325,9 @@
}
EnumReq->PollEvents = FCB->PollState;
- RtlZeroMemory( EnumReq->EventStatus, sizeof(EnumReq->EventStatus) );
+ RtlCopyMemory( EnumReq->EventStatus,
+ FCB->PollStatus,
+ sizeof(EnumReq->EventStatus) );
return UnlockAndMaybeComplete( FCB, STATUS_SUCCESS, Irp,
0 );
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] Fri May 28 05:55:50 2010
@@ -142,9 +142,9 @@
FCB );
} else {
FCB->PollState |= AFD_EVENT_SEND;
- }
-
- PollReeval( FCB->DeviceExt, FCB->FileObject );
+ FCB->PollStatus[FD_WRITE_BIT] = STATUS_SUCCESS;
+ PollReeval( FCB->DeviceExt, FCB->FileObject );
+ }
if( TotalBytesCopied > 0 ) {
UnlockBuffers( SendReq->BufferArray, SendReq->BufferCount, FALSE );
@@ -186,6 +186,7 @@
/* Request is not in flight any longer */
FCB->PollState |= AFD_EVENT_SEND;
+ FCB->PollStatus[FD_WRITE_BIT] = STATUS_SUCCESS;
PollReeval( FCB->DeviceExt, FCB->FileObject );
if( FCB->State == SOCKET_STATE_CLOSED ) {
@@ -391,10 +392,6 @@
if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp );
- FCB->PollState &= ~AFD_EVENT_SEND;
-
- PollReeval( FCB->DeviceExt, FCB->FileObject );
-
/* Check that the socket is bound */
if( FCB->State != SOCKET_STATE_BOUND )
return UnlockAndMaybeComplete
@@ -425,6 +422,8 @@
/* Check the size of the Address given ... */
if( NT_SUCCESS(Status) ) {
+ FCB->PollState &= ~AFD_EVENT_SEND;
+
Status = TdiSendDatagram
( &FCB->SendIrp.InFlightRequest,
FCB->AddressFile.Object,
Modified: trunk/reactos/drivers/network/afd/include/afd.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/includ…
==============================================================================
--- trunk/reactos/drivers/network/afd/include/afd.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/afd/include/afd.h [iso-8859-1] Fri May 28 05:55:50 2010
@@ -192,6 +192,7 @@
UNICODE_STRING TdiDeviceName;
PVOID Context;
DWORD PollState;
+ NTSTATUS PollStatus[FD_MAX_EVENTS];
UINT ContextSize;
PVOID ConnectData;
UINT FilledConnectData;