mirror of
https://github.com/reactos/reactos.git
synced 2024-09-10 12:54:51 +00:00
- 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 svn path=/trunk/; revision=40367
This commit is contained in:
parent
a2e1f4928f
commit
4c4d83fa6e
|
@ -139,11 +139,11 @@ VOID ControlChannelFree(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID DeleteAddress(PADDRESS_FILE AddrFile)
|
NTSTATUS FileCloseAddress(PTDI_REQUEST Request)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Deletes an address file object
|
* FUNCTION: Closes an address file object
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
* AddrFile = Pointer to address file object to delete
|
* AddrFile = Pointer to address file object to close
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
|
@ -151,16 +151,16 @@ VOID DeleteAddress(PADDRESS_FILE AddrFile)
|
||||||
PLIST_ENTRY NextEntry;
|
PLIST_ENTRY NextEntry;
|
||||||
PDATAGRAM_SEND_REQUEST SendRequest;
|
PDATAGRAM_SEND_REQUEST SendRequest;
|
||||||
PDATAGRAM_RECEIVE_REQUEST ReceiveRequest;
|
PDATAGRAM_RECEIVE_REQUEST ReceiveRequest;
|
||||||
|
PADDRESS_FILE AddrFile = Request->Handle.AddressHandle;
|
||||||
|
|
||||||
TI_DbgPrint(MID_TRACE, ("Called.\n"));
|
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);
|
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 */
|
/* FIXME: Kill TCP connections on this address file object */
|
||||||
|
|
||||||
/* Return pending requests with error */
|
/* Return pending requests with error */
|
||||||
|
@ -197,9 +197,9 @@ VOID DeleteAddress(PADDRESS_FILE AddrFile)
|
||||||
|
|
||||||
TcpipReleaseSpinLock(&AddrFile->Lock, OldIrql);
|
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 @@ NTSTATUS FileOpenAddress(
|
||||||
* RETURNS:
|
* RETURNS:
|
||||||
* Status of operation
|
* Status of operation
|
||||||
*/
|
*/
|
||||||
NTSTATUS FileCloseAddress(
|
NTSTATUS FileFreeAddress(
|
||||||
PTDI_REQUEST Request)
|
PTDI_REQUEST Request)
|
||||||
{
|
{
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
|
@ -350,13 +350,10 @@ NTSTATUS FileCloseAddress(
|
||||||
|
|
||||||
AddrFile = Request->Handle.AddressHandle;
|
AddrFile = Request->Handle.AddressHandle;
|
||||||
|
|
||||||
TcpipAcquireSpinLock(&AddrFile->Lock, &OldIrql);
|
/* Remove address file from the global list */
|
||||||
|
TcpipAcquireSpinLock(&AddressFileListLock, &OldIrql);
|
||||||
/* Set address file object exclusive to us */
|
RemoveEntryList(&AddrFile->ListEntry);
|
||||||
AF_SET_BUSY(AddrFile);
|
TcpipReleaseSpinLock(&AddressFileListLock, OldIrql);
|
||||||
AF_CLR_VALID(AddrFile);
|
|
||||||
|
|
||||||
TcpipReleaseSpinLock(&AddrFile->Lock, OldIrql);
|
|
||||||
|
|
||||||
/* Protocol specific handling */
|
/* Protocol specific handling */
|
||||||
switch (AddrFile->Protocol) {
|
switch (AddrFile->Protocol) {
|
||||||
|
@ -372,33 +369,9 @@ NTSTATUS FileCloseAddress(
|
||||||
UDPFreePort( AddrFile->Port );
|
UDPFreePort( AddrFile->Port );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
TI_DbgPrint(MAX_TRACE, ("Leaving.\n"));
|
TI_DbgPrint(MAX_TRACE, ("Leaving.\n"));
|
||||||
|
|
||||||
return Status;
|
(*AddrFile->Free)(AddrFile);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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"));
|
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue