Author: cgutman
Date: Sun Apr 5 11:23:25 2009
New Revision: 40367
URL:
http://svn.reactos.org/svn/reactos?rev=40367&view=rev
Log:
- Distinguish between cleanup and close properly
- On cleanup, we cancel all requests
- On close, we remove the address file from the list, free the port and listener (if
present), then free the address file itself
Modified:
trunk/reactos/drivers/network/tcpip/tcpip/fileobjs.c
Modified: trunk/reactos/drivers/network/tcpip/tcpip/fileobjs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/tcpip/fileobjs.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/tcpip/fileobjs.c [iso-8859-1] Sun Apr 5 11:23:25
2009
@@ -139,11 +139,11 @@
}
-VOID DeleteAddress(PADDRESS_FILE AddrFile)
-/*
- * FUNCTION: Deletes an address file object
- * ARGUMENTS:
- * AddrFile = Pointer to address file object to delete
+NTSTATUS FileCloseAddress(PTDI_REQUEST Request)
+/*
+ * FUNCTION: Closes an address file object
+ * ARGUMENTS:
+ * AddrFile = Pointer to address file object to close
*/
{
KIRQL OldIrql;
@@ -151,15 +151,15 @@
PLIST_ENTRY NextEntry;
PDATAGRAM_SEND_REQUEST SendRequest;
PDATAGRAM_RECEIVE_REQUEST ReceiveRequest;
+ PADDRESS_FILE AddrFile = Request->Handle.AddressHandle;
TI_DbgPrint(MID_TRACE, ("Called.\n"));
- /* Remove address file from the global list */
- TcpipAcquireSpinLock(&AddressFileListLock, &OldIrql);
- RemoveEntryList(&AddrFile->ListEntry);
- TcpipReleaseSpinLock(&AddressFileListLock, OldIrql);
-
TcpipAcquireSpinLock(&AddrFile->Lock, &OldIrql);
+
+ /* Set address file object exclusive to us */
+ AF_SET_BUSY(AddrFile);
+ AF_CLR_VALID(AddrFile);
/* FIXME: Kill TCP connections on this address file object */
@@ -197,9 +197,9 @@
TcpipReleaseSpinLock(&AddrFile->Lock, OldIrql);
- (*AddrFile->Free)(AddrFile);
-
- TI_DbgPrint(MAX_TRACE, ("Leaving.\n"));
+ TI_DbgPrint(MAX_TRACE, ("Leaving.\n"));
+
+ return STATUS_SUCCESS;
}
@@ -339,7 +339,7 @@
* RETURNS:
* Status of operation
*/
-NTSTATUS FileCloseAddress(
+NTSTATUS FileFreeAddress(
PTDI_REQUEST Request)
{
KIRQL OldIrql;
@@ -350,13 +350,10 @@
AddrFile = Request->Handle.AddressHandle;
- TcpipAcquireSpinLock(&AddrFile->Lock, &OldIrql);
-
- /* Set address file object exclusive to us */
- AF_SET_BUSY(AddrFile);
- AF_CLR_VALID(AddrFile);
-
- TcpipReleaseSpinLock(&AddrFile->Lock, OldIrql);
+ /* Remove address file from the global list */
+ TcpipAcquireSpinLock(&AddressFileListLock, &OldIrql);
+ RemoveEntryList(&AddrFile->ListEntry);
+ TcpipReleaseSpinLock(&AddressFileListLock, OldIrql);
/* Protocol specific handling */
switch (AddrFile->Protocol) {
@@ -372,33 +369,9 @@
UDPFreePort( AddrFile->Port );
break;
}
-
- TI_DbgPrint(MAX_TRACE, ("Leaving.\n"));
-
- return Status;
-}
-
-
-/*
- * FUNCTION: Closes an address file object
- * ARGUMENTS:
- * Request = Pointer to TDI request structure for this request
- * RETURNS:
- * Status of operation
- */
-NTSTATUS FileFreeAddress(
- PTDI_REQUEST Request)
-{
- PADDRESS_FILE AddrFile;
- NTSTATUS Status = STATUS_SUCCESS;
-
- AddrFile = Request->Handle.AddressHandle;
-
- TI_DbgPrint(MID_TRACE, ("Called.\n"));
-
- DeleteAddress(AddrFile);
-
- TI_DbgPrint(MAX_TRACE, ("Leaving.\n"));
+ TI_DbgPrint(MAX_TRACE, ("Leaving.\n"));
+
+ (*AddrFile->Free)(AddrFile);
return Status;
}