From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mx.groups.io with SMTP id smtpd.web10.3009.1642572769759002705 for ; Tue, 18 Jan 2022 22:12:50 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: huawei.com, ip: 45.249.212.187, mailfrom: xiewenyi2@huawei.com) Received: from kwepemi500004.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4JdwFV32LszZf9r; Wed, 19 Jan 2022 14:09:02 +0800 (CST) Received: from kwepemm600004.china.huawei.com (7.193.23.242) by kwepemi500004.china.huawei.com (7.221.188.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Wed, 19 Jan 2022 14:12:47 +0800 Received: from kwephisprg16640.huawei.com (10.247.83.252) by kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Wed, 19 Jan 2022 14:12:47 +0800 From: "wenyi,xie" To: , , CC: , Subject: [PATCH EDK2 v1 1/1] RedfishPkg/RedfishRestExDxe:Simplify status check Date: Wed, 19 Jan 2022 14:12:41 +0800 Message-ID: <20220119061241.686837-2-xiewenyi2@huawei.com> X-Mailer: git-send-email 2.18.0.huawei.25 In-Reply-To: <20220119061241.686837-1-xiewenyi2@huawei.com> References: <20220119061241.686837-1-xiewenyi2@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.247.83.252] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600004.china.huawei.com (7.193.23.242) X-CFilter-Loop: Reflected Content-Type: text/plain Remove redundant determine statements. No functional change. Cc: Abner Chang Cc: Nickle Wang Signed-off-by: Wenyi Xie --- RedfishPkg/RedfishRestExDxe/RedfishRestExImpl.c | 38 +++++++++----------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/RedfishPkg/RedfishRestExDxe/RedfishRestExImpl.c b/RedfishPkg/RedfishRestExDxe/RedfishRestExImpl.c index eb1d8b8fa236..ba0a42097b92 100644 --- a/RedfishPkg/RedfishRestExDxe/RedfishRestExImpl.c +++ b/RedfishPkg/RedfishRestExDxe/RedfishRestExImpl.c @@ -44,7 +44,7 @@ ResetHttpTslSession ( } /** - This function check + This function check Http receive status @param[in] Instance Pointer to EFI_REST_EX_PROTOCOL instance for a particular REST service. @@ -67,37 +67,33 @@ RedfishCheckHttpReceiveStatus ( if (!EFI_ERROR (HttpIoReceiveStatus)) { ReturnStatus = EFI_SUCCESS; - } else if (EFI_ERROR (HttpIoReceiveStatus) && (HttpIoReceiveStatus != EFI_CONNECTION_FIN)) { + } else if (HttpIoReceiveStatus != EFI_CONNECTION_FIN) { if ((Instance->Flags & RESTEX_INSTANCE_FLAGS_TCP_ERROR_RETRY) == 0) { DEBUG ((DEBUG_ERROR, "%a: TCP error, reset HTTP session.\n", __FUNCTION__)); Instance->Flags |= RESTEX_INSTANCE_FLAGS_TCP_ERROR_RETRY; gBS->Stall (500); Status = ResetHttpTslSession (Instance); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a: Reset HTTP instance fail.\n", __FUNCTION__)); - ReturnStatus = EFI_DEVICE_ERROR; - } else { + if (!EFI_ERROR (Status)) { return EFI_NOT_READY; } - } else { - ReturnStatus = EFI_DEVICE_ERROR; + DEBUG ((DEBUG_ERROR, "%a: Reset HTTP instance fail.\n", __FUNCTION__)); } + + ReturnStatus = EFI_DEVICE_ERROR; } else { - if (HttpIoReceiveStatus == EFI_CONNECTION_FIN) { - if ((Instance->Flags & RESTEX_INSTANCE_FLAGS_TLS_RETRY) != 0) { - DEBUG ((DEBUG_ERROR, "%a: REST_EX Send and receive fail even with a new TLS session.\n", __FUNCTION__)); - ReturnStatus = EFI_DEVICE_ERROR; - } - - Instance->Flags |= RESTEX_INSTANCE_FLAGS_TLS_RETRY; - Status = ResetHttpTslSession (Instance); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a: Reset HTTP instance fail.\n", __FUNCTION__)); - ReturnStatus = EFI_DEVICE_ERROR; - } + if ((Instance->Flags & RESTEX_INSTANCE_FLAGS_TLS_RETRY) != 0) { + DEBUG ((DEBUG_ERROR, "%a: REST_EX Send and receive fail even with a new TLS session.\n", __FUNCTION__)); + ReturnStatus = EFI_DEVICE_ERROR; + } - return EFI_NOT_READY; + Instance->Flags |= RESTEX_INSTANCE_FLAGS_TLS_RETRY; + Status = ResetHttpTslSession (Instance); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Reset HTTP instance fail.\n", __FUNCTION__)); + ReturnStatus = EFI_DEVICE_ERROR; } + + return EFI_NOT_READY; } // -- 2.20.1.windows.1