Fixed some signalling problems. 1) Always OR the current state bits into the socket for the handler to see 2) Remove special case for SEL_CONNECT | SEL_FIN in the signalled handler. Now it's much cleaner. Modified: trunk/reactos/drivers/lib/ip/transport/tcp/event.c Modified: trunk/reactos/drivers/lib/ip/transport/tcp/tcp.c _____
Modified: trunk/reactos/drivers/lib/ip/transport/tcp/event.c --- trunk/reactos/drivers/lib/ip/transport/tcp/event.c 2005-02-05 01:44:05 UTC (rev 13414) +++ trunk/reactos/drivers/lib/ip/transport/tcp/event.c 2005-02-05 04:56:04 UTC (rev 13415) @@ -41,9 +41,10 @@
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 ); }
_____
Modified: trunk/reactos/drivers/lib/ip/transport/tcp/tcp.c --- trunk/reactos/drivers/lib/ip/transport/tcp/tcp.c 2005-02-05 01:44:05 UTC (rev 13414) +++ trunk/reactos/drivers/lib/ip/transport/tcp/tcp.c 2005-02-05 04:56:04 UTC (rev 13415) @@ -34,24 +34,31 @@
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 @@ }
/* 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 @@ } } } + if( NewState & SEL_FIN ) { TI_DbgPrint(DEBUG_TCP, ("EOF From socket\n"));