[edk2] [Patch] MdeModulePkg/TcpIoLib: Cancel TCP token if connect/accept is timeout.

Fu Siyuan posted 1 patch 6 years, 4 months ago
Failed in applying to current master (apply log)
MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
[edk2] [Patch] MdeModulePkg/TcpIoLib: Cancel TCP token if connect/accept is timeout.
Posted by Fu Siyuan 6 years, 4 months ago
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
---
 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.<BR>
+Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>
 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<BR>
@@ -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

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] MdeModulePkg/TcpIoLib: Cancel TCP token if connect/accept is timeout.
Posted by Wu, Jiaxin 6 years, 4 months ago
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>


> -----Original Message-----
> From: Fu Siyuan [mailto:siyuan.fu@intel.com]
> Sent: Tuesday, December 5, 2017 2:34 PM
> To: edk2-devel@lists.01.org
> Cc: Wu, Jiaxin <jiaxin.wu@intel.com>; Ye, Ting <ting.ye@intel.com>
> Subject: [Patch] MdeModulePkg/TcpIoLib: Cancel TCP token if
> connect/accept is timeout.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
> Cc: Wu Jiaxin <jiaxin.wu@intel.com>
> Cc: Ye Ting <ting.ye@intel.com>
> ---
>  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.<BR>
> +Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>
>  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<BR>
> @@ -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

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] MdeModulePkg/TcpIoLib: Cancel TCP token if connect/accept is timeout.
Posted by Ye, Ting 6 years, 4 months ago
Hi Siyuan,

You might need write a log message for this patch, what do you think? Others are good to me.

Reviewed-by: Ye Ting <ting.ye@intel.com>

Best Regards,
Ting

-----Original Message-----
From: Fu Siyuan [mailto:siyuan.fu@intel.com] 
Sent: Tuesday, December 5, 2017 2:34 PM
To: edk2-devel@lists.01.org
Cc: Wu, Jiaxin <jiaxin.wu@intel.com>; Ye, Ting <ting.ye@intel.com>
Subject: [Patch] MdeModulePkg/TcpIoLib: Cancel TCP token if connect/accept is timeout.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
---
 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.<BR>
+Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>
 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<BR> @@ -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

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel