mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 07:32:57 +00:00
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. svn path=/trunk/; revision=13415
This commit is contained in:
parent
ab73f037f8
commit
c7bf3eead3
2 changed files with 26 additions and 17 deletions
|
@ -41,9 +41,10 @@ int TCPSocketState(void *ClientData,
|
||||||
|
|
||||||
TI_DbgPrint(MID_TRACE,("Connection signalled: %d\n",
|
TI_DbgPrint(MID_TRACE,("Connection signalled: %d\n",
|
||||||
Connection->Signalled));
|
Connection->Signalled));
|
||||||
|
|
||||||
|
Connection->SignalState |= NewState;
|
||||||
if( !Connection->Signalled ) {
|
if( !Connection->Signalled ) {
|
||||||
Connection->Signalled = TRUE;
|
Connection->Signalled = TRUE;
|
||||||
Connection->SignalState = NewState;
|
|
||||||
InsertTailList( &SignalledConnections, &Connection->SignalList );
|
InsertTailList( &SignalledConnections, &Connection->SignalList );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,24 +34,31 @@ static VOID HandleSignalledConnection( PCONNECTION_ENDPOINT Connection,
|
||||||
Connection, Connection->SocketContext));
|
Connection, Connection->SocketContext));
|
||||||
|
|
||||||
/* Things that can happen when we try the initial connection */
|
/* Things that can happen when we try the initial connection */
|
||||||
if( ((NewState & SEL_CONNECT) || (NewState & SEL_FIN)) &&
|
if( NewState & SEL_CONNECT ) {
|
||||||
!(Connection->State & (SEL_CONNECT | SEL_FIN)) ) {
|
|
||||||
|
|
||||||
while( !IsListEmpty( &Connection->ConnectRequest ) ) {
|
while( !IsListEmpty( &Connection->ConnectRequest ) ) {
|
||||||
Connection->State |= NewState & (SEL_CONNECT | SEL_FIN);
|
Connection->State |= NewState;
|
||||||
Entry = RemoveHeadList( &Connection->ConnectRequest );
|
Entry = RemoveHeadList( &Connection->ConnectRequest );
|
||||||
|
TI_DbgPrint(DEBUG_TCP, ("Connect Event\n"));
|
||||||
|
|
||||||
Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry );
|
Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry );
|
||||||
Complete = Bucket->Request.RequestNotifyObject;
|
Complete = Bucket->Request.RequestNotifyObject;
|
||||||
TI_DbgPrint(DEBUG_TCP,
|
TI_DbgPrint(DEBUG_TCP,
|
||||||
("Completing Connect Request %x\n", Bucket->Request));
|
("Completing Request %x\n", Bucket->Request));
|
||||||
if( NewState & SEL_FIN ) Status = STATUS_CONNECTION_REFUSED;
|
|
||||||
|
if( (NewState & (SEL_CONNECT | SEL_FIN)) ==
|
||||||
|
(SEL_CONNECT | SEL_FIN) )
|
||||||
|
Status = STATUS_CONNECTION_REFUSED;
|
||||||
|
else
|
||||||
|
Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
Complete( Bucket->Request.RequestContext, Status, 0 );
|
Complete( Bucket->Request.RequestContext, Status, 0 );
|
||||||
|
|
||||||
/* Frees the bucket allocated in TCPConnect */
|
/* Frees the bucket allocated in TCPConnect */
|
||||||
PoolFreeBuffer( Bucket );
|
PoolFreeBuffer( Bucket );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (NewState & SEL_ACCEPT) ) {
|
if( NewState & SEL_ACCEPT ) {
|
||||||
/* Handle readable on a listening socket --
|
/* Handle readable on a listening socket --
|
||||||
* TODO: Implement filtering
|
* TODO: Implement filtering
|
||||||
*/
|
*/
|
||||||
|
@ -88,7 +95,7 @@ static VOID HandleSignalledConnection( PCONNECTION_ENDPOINT Connection,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Things that happen after we're connected */
|
/* Things that happen after we're connected */
|
||||||
if( (NewState & SEL_READ) ) {
|
if( NewState & SEL_READ ) {
|
||||||
TI_DbgPrint(DEBUG_TCP,("Readable: irp list %s\n",
|
TI_DbgPrint(DEBUG_TCP,("Readable: irp list %s\n",
|
||||||
IsListEmpty(&Connection->ReceiveRequest) ?
|
IsListEmpty(&Connection->ReceiveRequest) ?
|
||||||
"empty" : "nonempty"));
|
"empty" : "nonempty"));
|
||||||
|
@ -146,6 +153,7 @@ static VOID HandleSignalledConnection( PCONNECTION_ENDPOINT Connection,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( NewState & SEL_FIN ) {
|
if( NewState & SEL_FIN ) {
|
||||||
TI_DbgPrint(DEBUG_TCP, ("EOF From socket\n"));
|
TI_DbgPrint(DEBUG_TCP, ("EOF From socket\n"));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue