From 267345ff4f309ad6d4a12b358e1746ba079092d9 Mon Sep 17 00:00:00 2001 From: Fu Siyuan Date: Tue, 5 Dec 2017 14:22:48 +0800 Subject: [PATCH] MdeModulePkg/TcpIoLib: Cancel TCP token if connect/accept is timeout. This patch updates TcpIoConnect() and TcpIoAccept() that the Tcp.Cancel() should be invoked to cancel the corresponding request when timeout occurs. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan Reviewed-by: Wu Jiaxin Reviewed-by: Ye Ting --- MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c b/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c index a7637579f2..fd85d0e787 100644 --- a/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c +++ b/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c @@ -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;