From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.88; helo=mga01.intel.com; envelope-from=siyuan.fu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id CBF662035624D for ; Mon, 4 Dec 2017 22:35:28 -0800 (PST) Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Dec 2017 22:39:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,363,1508828400"; d="scan'208";a="202681" Received: from sfu5-mobl.ccr.corp.intel.com ([10.239.193.28]) by fmsmga008.fm.intel.com with ESMTP; 04 Dec 2017 22:33:54 -0800 From: Fu Siyuan To: edk2-devel@lists.01.org Cc: Wu Jiaxin , Ye Ting Date: Tue, 5 Dec 2017 14:33:52 +0800 Message-Id: <20171205063352.17476-1-siyuan.fu@intel.com> X-Mailer: git-send-email 2.13.0.windows.1 Subject: [Patch] MdeModulePkg/TcpIoLib: Cancel TCP token if connect/accept is timeout. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Dec 2017 06:35:29 -0000 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan Cc: Wu Jiaxin Cc: Ye Ting --- MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c b/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c index 17183e1a6c..2e59b680bf 100644 --- a/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c +++ b/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c @@ -2,7 +2,7 @@ This library is used to share code between UEFI network stack modules. It provides the helper routines to access TCP service. -Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at
@@ -585,6 +585,11 @@ TcpIoConnect ( } if (!TcpIo->IsConnDone) { + if (TcpIo->TcpVersion == TCP_VERSION_4) { + Tcp4->Cancel (Tcp4, &TcpIo->ConnToken.Tcp4Token.CompletionToken); + } else { + Tcp6->Cancel (Tcp6, &TcpIo->ConnToken.Tcp6Token.CompletionToken); + } Status = EFI_TIMEOUT; } else { Status = TcpIo->ConnToken.Tcp4Token.CompletionToken.Status; @@ -655,6 +660,11 @@ TcpIoAccept ( } if (!TcpIo->IsListenDone) { + if (TcpIo->TcpVersion == TCP_VERSION_4) { + Tcp4->Cancel (Tcp4, &TcpIo->ListenToken.Tcp4Token.CompletionToken); + } else { + Tcp6->Cancel (Tcp6, &TcpIo->ListenToken.Tcp6Token.CompletionToken); + } Status = EFI_TIMEOUT; } else { Status = TcpIo->ListenToken.Tcp4Token.CompletionToken.Status; -- 2.13.0.windows.1