From 97d6fbe737caa5f48140b00a289622c357d8efc0 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 2 Nov 2009 20:26:29 +0000 Subject: [PATCH] - Fix some confusion between SignalState and State which resulted in queued IRPs being lost on socket closure - Call HandleSignalledConnection directly because the connection may not be in the signalled connections list - Remove State from CONNECTION_ENDPOINT to prevent this from happening again svn path=/trunk/; revision=43922 --- .../drivers/network/tcpip/include/titypes.h | 2 -- reactos/lib/drivers/ip/transport/tcp/event.c | 2 +- reactos/lib/drivers/ip/transport/tcp/tcp.c | 22 ++----------------- 3 files changed, 3 insertions(+), 23 deletions(-) diff --git a/reactos/drivers/network/tcpip/include/titypes.h b/reactos/drivers/network/tcpip/include/titypes.h index ef985775088..fa637d35ea8 100644 --- a/reactos/drivers/network/tcpip/include/titypes.h +++ b/reactos/drivers/network/tcpip/include/titypes.h @@ -299,8 +299,6 @@ typedef struct _CONNECTION_ENDPOINT { PADDRESS_FILE AddressFile; /* Associated address file object (NULL if none) */ PVOID SocketContext; /* Context for lower layer */ - UINT State; /* Socket state W.R.T. oskit */ - /* Requests */ LIST_ENTRY ConnectRequest; /* Queued connect rqueusts */ LIST_ENTRY ListenRequest; /* Queued listen requests */ diff --git a/reactos/lib/drivers/ip/transport/tcp/event.c b/reactos/lib/drivers/ip/transport/tcp/event.c index 81cdbbb0ffd..0a13afff877 100644 --- a/reactos/lib/drivers/ip/transport/tcp/event.c +++ b/reactos/lib/drivers/ip/transport/tcp/event.c @@ -26,7 +26,7 @@ int TCPSocketState(void *ClientData, TI_DbgPrint(DEBUG_TCP,("Called: NewState %x (Conn %x) (Change %x)\n", NewState, Connection, - Connection ? Connection->State ^ NewState : + Connection ? Connection->SignalState ^ NewState : NewState)); if( !Connection ) { diff --git a/reactos/lib/drivers/ip/transport/tcp/tcp.c b/reactos/lib/drivers/ip/transport/tcp/tcp.c index e61035968d4..5995ea4134f 100644 --- a/reactos/lib/drivers/ip/transport/tcp/tcp.c +++ b/reactos/lib/drivers/ip/transport/tcp/tcp.c @@ -601,11 +601,6 @@ NTSTATUS TCPConnect return STATUS_NETWORK_UNREACHABLE; } - if (Connection->State & SEL_FIN) - { - return STATUS_REMOTE_DISCONNECT; - } - /* Freed in TCPSocketState */ TI_DbgPrint(DEBUG_TCP, ("Connecting to address %x:%x\n", @@ -683,8 +678,8 @@ NTSTATUS TCPClose ASSERT_LOCKED(&TCPLock); /* Make our code remove all pending IRPs */ - Connection->State |= SEL_FIN; - DrainSignals(); + Connection->SignalState |= SEL_FIN; + HandleSignalledConnection(Connection); Status = TCPTranslateError( OskitTCPClose( Connection->SocketContext ) ); if (Status == STATUS_SUCCESS) @@ -715,13 +710,6 @@ NTSTATUS TCPReceiveData ASSERT_KM_POINTER(Connection->SocketContext); - /* Closing */ - if (Connection->State & SEL_FIN) - { - *BytesReceived = 0; - return STATUS_REMOTE_DISCONNECT; - } - NdisQueryBuffer( Buffer, &DataBuffer, &DataLen ); TI_DbgPrint(DEBUG_TCP,("TCP>|< Got an MDL %x (%x:%d)\n", Buffer, DataBuffer, DataLen)); @@ -786,12 +774,6 @@ NTSTATUS TCPSendData TI_DbgPrint(DEBUG_TCP,("Connection->SocketContext = %x\n", Connection->SocketContext)); - /* Closing */ - if (Connection->State & SEL_FIN) - { - *BytesSent = 0; - return STATUS_REMOTE_DISCONNECT; - } Status = TCPTranslateError ( OskitTCPSend( Connection->SocketContext, -- 2.17.1