diff --git a/reactos/drivers/lib/ip/transport/tcp/event.c b/reactos/drivers/lib/ip/transport/tcp/event.c index 401d4444b9c..d22ed771af8 100644 --- a/reactos/drivers/lib/ip/transport/tcp/event.c +++ b/reactos/drivers/lib/ip/transport/tcp/event.c @@ -41,9 +41,10 @@ int TCPSocketState(void *ClientData, TI_DbgPrint(MID_TRACE,("Connection signalled: %d\n", Connection->Signalled)); + + Connection->SignalState |= NewState; if( !Connection->Signalled ) { Connection->Signalled = TRUE; - Connection->SignalState = NewState; InsertTailList( &SignalledConnections, &Connection->SignalList ); } diff --git a/reactos/drivers/lib/ip/transport/tcp/tcp.c b/reactos/drivers/lib/ip/transport/tcp/tcp.c index ea0b90c2918..167add772ee 100644 --- a/reactos/drivers/lib/ip/transport/tcp/tcp.c +++ b/reactos/drivers/lib/ip/transport/tcp/tcp.c @@ -34,24 +34,31 @@ static VOID HandleSignalledConnection( PCONNECTION_ENDPOINT Connection, Connection, Connection->SocketContext)); /* Things that can happen when we try the initial connection */ - if( ((NewState & SEL_CONNECT) || (NewState & SEL_FIN)) && - !(Connection->State & (SEL_CONNECT | SEL_FIN)) ) { - + if( NewState & SEL_CONNECT ) { while( !IsListEmpty( &Connection->ConnectRequest ) ) { - Connection->State |= NewState & (SEL_CONNECT | SEL_FIN); - Entry = RemoveHeadList( &Connection->ConnectRequest ); - Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); - Complete = Bucket->Request.RequestNotifyObject; - TI_DbgPrint(DEBUG_TCP, - ("Completing Connect Request %x\n", Bucket->Request)); - if( NewState & SEL_FIN ) Status = STATUS_CONNECTION_REFUSED; - Complete( Bucket->Request.RequestContext, Status, 0 ); - /* Frees the bucket allocated in TCPConnect */ - PoolFreeBuffer( Bucket ); - } + Connection->State |= NewState; + Entry = RemoveHeadList( &Connection->ConnectRequest ); + TI_DbgPrint(DEBUG_TCP, ("Connect Event\n")); + + Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); + Complete = Bucket->Request.RequestNotifyObject; + TI_DbgPrint(DEBUG_TCP, + ("Completing Request %x\n", Bucket->Request)); + + if( (NewState & (SEL_CONNECT | SEL_FIN)) == + (SEL_CONNECT | SEL_FIN) ) + Status = STATUS_CONNECTION_REFUSED; + else + Status = STATUS_SUCCESS; + + Complete( Bucket->Request.RequestContext, Status, 0 ); + + /* Frees the bucket allocated in TCPConnect */ + PoolFreeBuffer( Bucket ); + } } - if( (NewState & SEL_ACCEPT) ) { + if( NewState & SEL_ACCEPT ) { /* Handle readable on a listening socket -- * TODO: Implement filtering */ @@ -88,7 +95,7 @@ static VOID HandleSignalledConnection( PCONNECTION_ENDPOINT Connection, } /* Things that happen after we're connected */ - if( (NewState & SEL_READ) ) { + if( NewState & SEL_READ ) { TI_DbgPrint(DEBUG_TCP,("Readable: irp list %s\n", IsListEmpty(&Connection->ReceiveRequest) ? "empty" : "nonempty")); @@ -146,6 +153,7 @@ static VOID HandleSignalledConnection( PCONNECTION_ENDPOINT Connection, } } } + if( NewState & SEL_FIN ) { TI_DbgPrint(DEBUG_TCP, ("EOF From socket\n"));