From 8f474295b55851af4bf0f5e65b64795ae64beff9 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 19 Aug 2010 02:41:54 +0000 Subject: [PATCH] [IP] - 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 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/reactos/lib/drivers/ip/transport/tcp/tcp.c b/reactos/lib/drivers/ip/transport/tcp/tcp.c index e8ea9bb290f..b432ab83f79 100644 --- a/reactos/lib/drivers/ip/transport/tcp/tcp.c +++ b/reactos/lib/drivers/ip/transport/tcp/tcp.c @@ -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")); -- 2.17.1