Skip to content

Commit

Permalink
NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Maciej Rabeda <[email protected]>
Reviewed-by: Gerd Hoffmann <[email protected]>
  • Loading branch information
osteffenrh authored and mergify[bot] committed Apr 11, 2022
1 parent 35a4b63 commit 38a9afd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions NetworkPkg/HttpDxe/HttpProto.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 38a9afd

Please sign in to comment.