From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web08.11036.1647351762260113190 for ; Tue, 15 Mar 2022 06:42:42 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JgQnMgEK; spf=pass (domain: redhat.com, ip: 170.10.129.124, mailfrom: osteffen@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647351761; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wOlujVN7iqHwA7V04kTeHlrSaZPL2CgzcGDKnOQX9Gc=; b=JgQnMgEKsCxgFnFB79BRDMHcLvkiL4T4w7NwoPfmT2gslUuQr+OaToNGDp+bop+voQ9igM ps2eJXvV/dqtTyTdqodolI1k2uzNxK2eH7EZwucMaZu7C4o/FgAYRIJthjwUk7ntDytmLv a3WmWJ2HCtiYY15eb0JyfCiAb2KQRjU= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-441-nhytyhXhPbqYDjf5Y7IYWg-1; Tue, 15 Mar 2022 09:42:38 -0400 X-MC-Unique: nhytyhXhPbqYDjf5Y7IYWg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2FADA3811F22 for ; Tue, 15 Mar 2022 13:42:38 +0000 (UTC) Received: from osteffen-laptop.fritz.box (unknown [10.39.195.87]) by smtp.corp.redhat.com (Postfix) with ESMTP id AA79D4082387; Tue, 15 Mar 2022 13:42:37 +0000 (UTC) From: "Oliver Steffen" To: devel@edk2.groups.io Cc: Oliver Steffen Subject: [PATCH v3 1/5] NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring Date: Tue, 15 Mar 2022 14:42:25 +0100 Message-Id: <20220315134229.391909-2-osteffen@redhat.com> In-Reply-To: <20220315134229.391909-1-osteffen@redhat.com> References: <20220304130403.47832-1-osteffen@redhat.com> <20220315134229.391909-1-osteffen@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=osteffen@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" 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 --- NetworkPkg/HttpDxe/HttpProto.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.c index 9457dd2623d3..cd54c574044b 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)); -- 2.35.1