Author: cgutman
Date: Thu Jun 9 22:38:38 2011
New Revision: 52166
URL:
http://svn.reactos.org/svn/reactos?rev=52166&view=rev
Log:
[AFD]
- Cleanup the pending connection list before closing the FCB
- Fixes yet another socket closure bug
Modified:
trunk/reactos/drivers/network/afd/afd/listen.c
trunk/reactos/drivers/network/afd/afd/main.c
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] Thu Jun 9 22:38:38 2011
@@ -95,7 +95,7 @@
NTSTATUS Status = STATUS_SUCCESS;
PAFD_FCB FCB = (PAFD_FCB)Context;
PAFD_TDI_OBJECT_QELT Qelt;
- PLIST_ENTRY NextIrpEntry, QeltEntry;
+ PLIST_ENTRY NextIrpEntry;
PIRP NextIrp;
if( !SocketAcquireStateLock( FCB ) )
@@ -113,13 +113,6 @@
if( NextIrp->MdlAddress ) UnlockRequest( NextIrp,
IoGetCurrentIrpStackLocation( NextIrp ) );
(void)IoSetCancelRoutine(NextIrp, NULL);
IoCompleteRequest( NextIrp, IO_NETWORK_INCREMENT );
- }
-
- /* Free all pending connections */
- while( !IsListEmpty( &FCB->PendingConnections ) ) {
- QeltEntry = RemoveHeadList(&FCB->PendingConnections);
- Qelt = CONTAINING_RECORD(QeltEntry, AFD_TDI_OBJECT_QELT, ListEntry);
- ExFreePool(Qelt);
}
/* Free ConnectionReturnInfo and ConnectionCallInfo */
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] Thu Jun 9 22:38:38 2011
@@ -394,6 +394,9 @@
PAFD_FCB FCB = FileObject->FsContext;
UINT i;
PAFD_IN_FLIGHT_REQUEST InFlightRequest[IN_FLIGHT_REQUESTS];
+ PAFD_TDI_OBJECT_QELT Qelt;
+ PLIST_ENTRY QeltEntry;
+
AFD_DbgPrint(MID_TRACE,
("AfdClose(DeviceObject %p Irp %p)\n", DeviceObject, Irp));
@@ -420,6 +423,24 @@
}
KillSelectsForFCB( FCB->DeviceExt, FileObject, FALSE );
+
+ ASSERT(IsListEmpty(&FCB->PendingIrpList[FUNCTION_CONNECT]));
+ ASSERT(IsListEmpty(&FCB->PendingIrpList[FUNCTION_SEND]));
+ ASSERT(IsListEmpty(&FCB->PendingIrpList[FUNCTION_RECV]));
+ ASSERT(IsListEmpty(&FCB->PendingIrpList[FUNCTION_PREACCEPT]));
+
+ while (!IsListEmpty(&FCB->PendingConnections))
+ {
+ QeltEntry = RemoveHeadList(&FCB->PendingConnections);
+ Qelt = CONTAINING_RECORD(QeltEntry, AFD_TDI_OBJECT_QELT, ListEntry);
+
+ /* We have to close all pending connections or the listen won't get closed */
+ TdiDisassociateAddressFile(Qelt->Object.Object);
+ ObDereferenceObject(Qelt->Object.Object);
+ ZwClose(Qelt->Object.Handle);
+
+ ExFreePool(Qelt);
+ }
SocketStateUnlock( FCB );