From 38a9afd0fb0eda06a4fb9c3efd5bd2d191fe87b1 Mon Sep 17 00:00:00 2001 From: Oliver Steffen Date: Tue, 22 Mar 2022 14:30:04 +0100 Subject: NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720 Check if the state of the HTTP instance is HTTP_STATE_TCP_CONNECTED, or HTTP_STATE_TCP_CLOSED and de-configure the Tcp4 instance before configuring it again. Signed-off-by: Oliver Steffen Reviewed-by: Maciej Rabeda Reviewed-by: Gerd Hoffmann --- NetworkPkg/HttpDxe/HttpProto.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'NetworkPkg') diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.c index 9457dd2623..cd54c57404 100644 --- a/NetworkPkg/HttpDxe/HttpProto.c +++ b/NetworkPkg/HttpDxe/HttpProto.c @@ -1086,6 +1086,18 @@ HttpConfigureTcp4 ( Tcp4Option->EnableNagle = TRUE; Tcp4CfgData->ControlOption = Tcp4Option; + if ((HttpInstance->State == HTTP_STATE_TCP_CONNECTED) || + (HttpInstance->State == HTTP_STATE_TCP_CLOSED)) + { + Status = HttpInstance->Tcp4->Configure (HttpInstance->Tcp4, NULL); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "HttpConfigureTcp4(NULL) - %r\n", Status)); + return Status; + } + + HttpInstance->State = HTTP_STATE_TCP_UNCONFIGED; + } + Status = HttpInstance->Tcp4->Configure (HttpInstance->Tcp4, Tcp4CfgData); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "HttpConfigureTcp4 - %r\n", Status)); -- cgit v1.2.3