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 <osteffen@redhat.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
Oliver Steffen 2022-03-22 14:30:04 +01:00 committed by mergify[bot]
parent 35a4b63247
commit 38a9afd0fb
1 changed files with 12 additions and 0 deletions

View File

@ -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));