summaryrefslogtreecommitdiff
path: root/NetworkPkg/HttpDxe/HttpProto.c
diff options
context:
space:
mode:
Diffstat (limited to 'NetworkPkg/HttpDxe/HttpProto.c')
-rw-r--r--NetworkPkg/HttpDxe/HttpProto.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.c
index 39837a3c82..999695125e 100644
--- a/NetworkPkg/HttpDxe/HttpProto.c
+++ b/NetworkPkg/HttpDxe/HttpProto.c
@@ -1179,7 +1179,7 @@ HttpConnectTcp4 (
EFI_TCP4_CONNECTION_STATE Tcp4State;
- if (HttpInstance->State != HTTP_STATE_TCP_CONFIGED || HttpInstance->Tcp4 == NULL) {
+ if (HttpInstance->State < HTTP_STATE_TCP_CONFIGED || HttpInstance->Tcp4 == NULL) {
return EFI_NOT_READY;
}
@@ -1196,9 +1196,11 @@ HttpConnectTcp4 (
return Status;
}
- if (Tcp4State > Tcp4StateEstablished) {
+ if (Tcp4State == Tcp4StateEstablished) {
+ return EFI_SUCCESS;
+ } else if (Tcp4State > Tcp4StateEstablished ) {
HttpCloseConnection(HttpInstance);
- }
+ }
return HttpCreateConnection (HttpInstance);
}
@@ -1221,7 +1223,7 @@ HttpConnectTcp6 (
EFI_STATUS Status;
EFI_TCP6_CONNECTION_STATE Tcp6State;
- if (HttpInstance->State != HTTP_STATE_TCP_CONFIGED || HttpInstance->Tcp6 == NULL) {
+ if (HttpInstance->State < HTTP_STATE_TCP_CONFIGED || HttpInstance->Tcp6 == NULL) {
return EFI_NOT_READY;
}
@@ -1239,8 +1241,10 @@ HttpConnectTcp6 (
return Status;
}
- if (Tcp6State > Tcp6StateEstablished) {
- HttpCloseConnection (HttpInstance);
+ if (Tcp6State == Tcp6StateEstablished) {
+ return EFI_SUCCESS;
+ } else if (Tcp6State > Tcp6StateEstablished ) {
+ HttpCloseConnection(HttpInstance);
}
return HttpCreateConnection (HttpInstance);
@@ -1251,6 +1255,7 @@ HttpConnectTcp6 (
@param[in] HttpInstance The HTTP instance private data.
@param[in] Wrap The HTTP token's wrap data.
+ @param[in] Configure The Flag indicates whether the first time to initialize Tcp.
@retval EFI_SUCCESS The initialization of TCP instance is done.
@retval Others Other error as indicated.
@@ -1259,7 +1264,8 @@ HttpConnectTcp6 (
EFI_STATUS
HttpInitTcp (
IN HTTP_PROTOCOL *HttpInstance,
- IN HTTP_TOKEN_WRAP *Wrap
+ IN HTTP_TOKEN_WRAP *Wrap,
+ IN BOOLEAN Configure
)
{
EFI_STATUS Status;
@@ -1269,10 +1275,13 @@ HttpInitTcp (
//
// Configure TCP instance.
//
- Status = HttpConfigureTcp4 (HttpInstance, Wrap);
- if (EFI_ERROR (Status)) {
- return Status;
+ if (Configure) {
+ Status = HttpConfigureTcp4 (HttpInstance, Wrap);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
}
+
//
// Connect TCP.
//
@@ -1284,10 +1293,13 @@ HttpInitTcp (
//
// Configure TCP instance.
//
- Status = HttpConfigureTcp6 (HttpInstance, Wrap);
- if (EFI_ERROR (Status)) {
- return Status;
+ if (Configure) {
+ Status = HttpConfigureTcp6 (HttpInstance, Wrap);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
}
+
//
// Connect TCP.
//