From: Cameron Gutman Date: Sat, 24 Apr 2010 22:37:45 +0000 (+0000) Subject: [IP] X-Git-Tag: backups/header-work@57446~33^2~71 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=740cd5ef909856eaa6d3978ca4d818f37157d112;hp=d35aa9621809528df2928592fa497eef3829ad5e [IP] - Don't try to close the connection again if it has already been terminated by the remote peer svn path=/trunk/; revision=47007 --- diff --git a/reactos/lib/drivers/ip/transport/tcp/tcp.c b/reactos/lib/drivers/ip/transport/tcp/tcp.c index ae02e4a2d05..187c9a56cc7 100644 --- a/reactos/lib/drivers/ip/transport/tcp/tcp.c +++ b/reactos/lib/drivers/ip/transport/tcp/tcp.c @@ -735,16 +735,24 @@ NTSTATUS TCPClose 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 ) ); + /* Don't try to close again if the other side closed us already */ + if (Connection->SignalState != SEL_FIN) + { + /* 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)) + if (!NT_SUCCESS(Status)) + { + Connection->SocketContext = Socket; + UnlockObject(Connection, OldIrql); + return Status; + } + } + else { - Connection->SocketContext = Socket; - UnlockObject(Connection, OldIrql); - return Status; + /* We are already closed by the other end so return success */ + Status = STATUS_SUCCESS; } if (Connection->AddressFile)