- Fix some confusion between SignalState and State which resulted in queued IRPs...
authorCameron Gutman <aicommander@gmail.com>
Mon, 2 Nov 2009 20:26:29 +0000 (20:26 +0000)
committerCameron Gutman <aicommander@gmail.com>
Mon, 2 Nov 2009 20:26:29 +0000 (20:26 +0000)
 - Call HandleSignalledConnection directly because the connection may not be in the signalled connections list
 - Remove State from CONNECTION_ENDPOINT to prevent this from happening again

svn path=/trunk/; revision=43922

reactos/drivers/network/tcpip/include/titypes.h
reactos/lib/drivers/ip/transport/tcp/event.c
reactos/lib/drivers/ip/transport/tcp/tcp.c

index ef98577..fa637d3 100644 (file)
@@ -299,8 +299,6 @@ typedef struct _CONNECTION_ENDPOINT {
     PADDRESS_FILE AddressFile;  /* Associated address file object (NULL if none) */
     PVOID SocketContext;        /* Context for lower layer */
 
-    UINT State;                 /* Socket state W.R.T. oskit */
-
     /* Requests */
     LIST_ENTRY ConnectRequest; /* Queued connect rqueusts */
     LIST_ENTRY ListenRequest;  /* Queued listen requests */
index 81cdbbb..0a13aff 100644 (file)
@@ -26,7 +26,7 @@ int TCPSocketState(void *ClientData,
 
     TI_DbgPrint(DEBUG_TCP,("Called: NewState %x (Conn %x) (Change %x)\n",
                NewState, Connection,
-               Connection ? Connection->State ^ NewState :
+               Connection ? Connection->SignalState ^ NewState :
                NewState));
 
     if( !Connection ) {
index e610359..5995ea4 100644 (file)
@@ -601,11 +601,6 @@ NTSTATUS TCPConnect
         return STATUS_NETWORK_UNREACHABLE;
     }
 
-    if (Connection->State & SEL_FIN)
-    {
-        return STATUS_REMOTE_DISCONNECT;
-    }
-
     /* Freed in TCPSocketState */
     TI_DbgPrint(DEBUG_TCP,
                 ("Connecting to address %x:%x\n",
@@ -683,8 +678,8 @@ NTSTATUS TCPClose
     ASSERT_LOCKED(&TCPLock);
 
     /* Make our code remove all pending IRPs */
-    Connection->State |= SEL_FIN;
-    DrainSignals();
+    Connection->SignalState |= SEL_FIN;
+    HandleSignalledConnection(Connection);
 
     Status = TCPTranslateError( OskitTCPClose( Connection->SocketContext ) );
     if (Status == STATUS_SUCCESS)
@@ -715,13 +710,6 @@ NTSTATUS TCPReceiveData
 
     ASSERT_KM_POINTER(Connection->SocketContext);
 
-    /* Closing */
-    if (Connection->State & SEL_FIN)
-    {
-        *BytesReceived = 0;
-        return STATUS_REMOTE_DISCONNECT;
-    }
-
     NdisQueryBuffer( Buffer, &DataBuffer, &DataLen );
 
     TI_DbgPrint(DEBUG_TCP,("TCP>|< Got an MDL %x (%x:%d)\n", Buffer, DataBuffer, DataLen));
@@ -786,12 +774,6 @@ NTSTATUS TCPSendData
     TI_DbgPrint(DEBUG_TCP,("Connection->SocketContext = %x\n",
                            Connection->SocketContext));
 
-    /* Closing */
-    if (Connection->State & SEL_FIN)
-    {
-        *BytesSent = 0;
-        return STATUS_REMOTE_DISCONNECT;
-    }
 
     Status = TCPTranslateError
         ( OskitTCPSend( Connection->SocketContext,