- Don't try to close the connection again if it has already been terminated by the remote peer

svn path=/trunk/; revision=47007
This commit is contained in:
Cameron Gutman 2010-04-24 22:37:45 +00:00
parent d35aa96218
commit 740cd5ef90

View file

@ -735,9 +735,11 @@ NTSTATUS TCPClose
Socket = Connection->SocketContext; Socket = Connection->SocketContext;
Connection->SocketContext = NULL; Connection->SocketContext = NULL;
/* 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 /* We need to close here otherwise oskit will never indicate
* SEL_FIN and we will never fully close the connection * SEL_FIN and we will never fully close the connection */
*/
Status = TCPTranslateError( OskitTCPClose( Socket ) ); Status = TCPTranslateError( OskitTCPClose( Socket ) );
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
@ -746,6 +748,12 @@ NTSTATUS TCPClose
UnlockObject(Connection, OldIrql); UnlockObject(Connection, OldIrql);
return Status; return Status;
} }
}
else
{
/* We are already closed by the other end so return success */
Status = STATUS_SUCCESS;
}
if (Connection->AddressFile) if (Connection->AddressFile)
DereferenceObject(Connection->AddressFile); DereferenceObject(Connection->AddressFile);