Author: cgutman
Date: Sun Apr 25 00:37:45 2010
New Revision: 47007
URL:
http://svn.reactos.org/svn/reactos?rev=47007&view=rev
Log:
[IP]
- Don't try to close the connection again if it has already been terminated by the
remote peer
Modified:
trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c
Modified: trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/transport/t…
==============================================================================
--- trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] Sun Apr 25 00:37:45
2010
@@ -735,16 +735,24 @@
Socket = Connection->SocketContext;
Connection->SocketContext = NULL;
- /* We need to close here otherwise oskit will never indicate
- * SEL_FIN and we will never fully close the connection
- */
- Status = TCPTranslateError( OskitTCPClose( Socket ) );
-
- if (!NT_SUCCESS(Status))
+ /* Don't try to close again if the other side closed us already */
+ if (Connection->SignalState != SEL_FIN)
{
- Connection->SocketContext = Socket;
- UnlockObject(Connection, OldIrql);
- return Status;
+ /* We need to close here otherwise oskit will never indicate
+ * SEL_FIN and we will never fully close the connection */
+ Status = TCPTranslateError( OskitTCPClose( Socket ) );
+
+ if (!NT_SUCCESS(Status))
+ {
+ Connection->SocketContext = Socket;
+ UnlockObject(Connection, OldIrql);
+ return Status;
+ }
+ }
+ else
+ {
+ /* We are already closed by the other end so return success */
+ Status = STATUS_SUCCESS;
}
if (Connection->AddressFile)