[IP]
authorCameron Gutman <aicommander@gmail.com>
Thu, 19 Aug 2010 02:41:54 +0000 (02:41 +0000)
committerCameron Gutman <aicommander@gmail.com>
Thu, 19 Aug 2010 02:41:54 +0000 (02:41 +0000)
- Fix a major bug in socket closure. Prior to this, a socket with pending IRPs that could not be satisfied when the socket was closed would be destroyed without completing the pending requests. Now, we check all of our IRP queues if we get a SEL_FIN signal and kill all the requests that cannot be satisfied immediately.
- Maybe it's just me but Firefox 2 seems much more responsive after this fix (like actually usable!)

svn path=/trunk/; revision=48561

reactos/lib/drivers/ip/transport/tcp/tcp.c

index e8ea9bb..b432ab8 100644 (file)
@@ -35,20 +35,20 @@ VOID HandleSignalledConnection(PCONNECTION_ENDPOINT Connection)
                                Connection, Connection->SocketContext));
 
         /* Things that can happen when we try the initial connection */
-        if( Connection->SignalState & SEL_CONNECT ) {
+        if( Connection->SignalState & (SEL_CONNECT | SEL_FIN) ) {
             while (!IsListEmpty(&Connection->ConnectRequest)) {
                Entry = RemoveHeadList( &Connection->ConnectRequest );
 
                Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry );
 
-               Bucket->Status = STATUS_SUCCESS;
+               Bucket->Status = (Connection->SignalState & SEL_CONNECT) ? STATUS_SUCCESS : STATUS_CANCELLED;
                Bucket->Information = 0;
 
                InsertTailList(&Connection->CompletionQueue, &Bucket->Entry);
            }
        }
 
-       if( Connection->SignalState & SEL_ACCEPT ) {
+       if( Connection->SignalState & (SEL_ACCEPT | SEL_FIN) ) {
            /* Handle readable on a listening socket --
             * TODO: Implement filtering
             */
@@ -90,7 +90,7 @@ VOID HandleSignalledConnection(PCONNECTION_ENDPOINT Connection)
       }
 
       /* Things that happen after we're connected */
-      if( Connection->SignalState & SEL_READ ) {
+      if( Connection->SignalState & (SEL_READ | SEL_FIN) ) {
           TI_DbgPrint(DEBUG_TCP,("Readable: irp list %s\n",
                                  IsListEmpty(&Connection->ReceiveRequest) ?
                                  "empty" : "nonempty"));
@@ -145,7 +145,7 @@ VOID HandleSignalledConnection(PCONNECTION_ENDPOINT Connection)
                }
            }
        }
-       if( Connection->SignalState & SEL_WRITE ) {
+       if( Connection->SignalState & (SEL_WRITE | SEL_FIN) ) {
            TI_DbgPrint(DEBUG_TCP,("Writeable: irp list %s\n",
                                   IsListEmpty(&Connection->SendRequest) ?
                                   "empty" : "nonempty"));