Revert my patch from yesterday. Need to take more time to work on it.
[reactos.git] / reactos / drivers / net / tcpip / tcpip / fileobjs.c
index 1f6bcc0..546df6f 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "precomp.h"
 
+
 /* List of all address file objects managed by this driver */
 LIST_ENTRY AddressFileListHead;
 KSPIN_LOCK AddressFileListLock;
@@ -351,7 +352,6 @@ NTSTATUS FileCloseAddress(
   KIRQL OldIrql;
   PADDRESS_FILE AddrFile;
   NTSTATUS Status = STATUS_SUCCESS;
-  PCANCEL_REQUEST CancelReq;
 
   TI_DbgPrint(MID_TRACE, ("Called.\n"));
 
@@ -369,16 +369,8 @@ NTSTATUS FileCloseAddress(
   switch (AddrFile->Protocol) {
   case IPPROTO_TCP:
     TCPFreePort( AddrFile->Port );
-    if( AddrFile->Listener ) {
-       CancelReq = ExAllocatePoolWithTag
-           ( sizeof(CANCEL_REQUEST), NonPagedPool, FOURCC('T','c','l','s') );
-       if( CancelReq ) {
-           CancelReq->Type = TCP_CANCEL_CLOSE;
-           CancelReq->Context = AddrFile->Listener;
-           AddrFile->Listener = NULL;
-           ExQueueWorkItem( &CancelQueueWork, CriticalWorkQueue );
-       }
-    }
+    if( AddrFile->Listener )
+       TCPClose( AddrFile->Listener );
     break;
 
   case IPPROTO_UDP:
@@ -474,19 +466,15 @@ NTSTATUS FileCloseConnection(
 {
   PCONNECTION_ENDPOINT Connection;
   NTSTATUS Status = STATUS_SUCCESS;
-  PCANCEL_REQUEST CancelReq;
 
   TI_DbgPrint(MID_TRACE, ("Called.\n"));
 
   Connection = Request->Handle.ConnectionContext;
 
-  CancelReq = ExAllocatePoolWithTag
-      ( sizeof(CANCEL_REQUEST), NonPagedPool, FOURCC('T','c','l','s') );
-  if( CancelReq ) {
-      CancelReq->Type = TCP_CANCEL_CLOSE;
-      CancelReq->Context = Connection;
-      ExQueueWorkItem( &CancelQueueWork, CriticalWorkQueue );
-  }
+  TcpipRecursiveMutexEnter( &TCPLock, TRUE );
+  TCPClose(Connection);
+  DeleteConnectionEndpoint(Connection);
+  TcpipRecursiveMutexLeave( &TCPLock );
 
   TI_DbgPrint(MAX_TRACE, ("Leaving.\n"));