Fixed more socket close problems.  You could get through TCPClose, unlock
the socket, have somebody else service and even, and unlink the connection
object at the same time.  Now we hold the TCP lock while removing a connection.
Modified: trunk/reactos/drivers/lib/ip/transport/tcp/event.c
Modified: trunk/reactos/drivers/net/tcpip/tcpip/fileobjs.c

Modified: trunk/reactos/drivers/lib/ip/transport/tcp/event.c
--- trunk/reactos/drivers/lib/ip/transport/tcp/event.c	2005-02-23 23:37:06 UTC (rev 13731)
+++ trunk/reactos/drivers/lib/ip/transport/tcp/event.c	2005-02-24 08:51:18 UTC (rev 13732)
@@ -10,8 +10,6 @@
 
 #include "precomp.h"
 
-extern VOID DrainSignals();
-
 int TCPSocketState(void *ClientData,
 		   void *WhichSocket, 
 		   void *WhichConnection,
@@ -32,10 +30,9 @@
     if( !Connection ) {
 	TI_DbgPrint(DEBUG_TCP,("Socket closing.\n"));
 	Connection = FileFindConnectionByContext( WhichSocket );
-	if( !Connection ) {
-	    TcpipRecursiveMutexLeave( &TCPLock );
+	if( !Connection )
 	    return 0;
-	} else 
+	else 
 	    TI_DbgPrint(DEBUG_TCP,("Found socket %x\n", Connection));
     }
 

Modified: trunk/reactos/drivers/net/tcpip/tcpip/fileobjs.c
--- trunk/reactos/drivers/net/tcpip/tcpip/fileobjs.c	2005-02-23 23:37:06 UTC (rev 13731)
+++ trunk/reactos/drivers/net/tcpip/tcpip/fileobjs.c	2005-02-24 08:51:18 UTC (rev 13732)
@@ -471,8 +471,10 @@
 
   Connection = Request->Handle.ConnectionContext;
 
+  TcpipRecursiveMutexEnter( &TCPLock, TRUE );
   TCPClose(Connection);
   DeleteConnectionEndpoint(Connection);
+  TcpipRecursiveMutexLeave( &TCPLock );
 
   TI_DbgPrint(MAX_TRACE, ("Leaving.\n"));