X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=NetworkPkg%2FDnsDxe%2FDnsProtocol.c;fp=NetworkPkg%2FDnsDxe%2FDnsProtocol.c;h=df737dcbeb418e4c3576035a5f8dff6e1c169c0c;hp=743560702841ec47d1fb8fd67fc618091b945427;hb=cd2a6240714749be3cb788a915684533540913ca;hpb=1b59de8444ac70ec1d4876ec8d6e7d957d5b6ed1 diff --git a/NetworkPkg/DnsDxe/DnsProtocol.c b/NetworkPkg/DnsDxe/DnsProtocol.c index 7435607028..df737dcbeb 100644 --- a/NetworkPkg/DnsDxe/DnsProtocol.c +++ b/NetworkPkg/DnsDxe/DnsProtocol.c @@ -223,8 +223,6 @@ Dns4Configure ( Dns4InstanceCancelToken(Instance, NULL); } - Instance->MaxRetry = 0; - if (Instance->UdpIo != NULL){ UdpIoCleanIo (Instance->UdpIo); } @@ -377,24 +375,30 @@ Dns4HostNameToIp ( ConfigData = &(Instance->Dns4CfgData); - Instance->MaxRetry = ConfigData->RetryCount; - - Token->Status = EFI_NOT_READY; - Token->RetryCount = 0; - Token->RetryInterval = ConfigData->RetryInterval; - if (Instance->State != DNS_STATE_CONFIGED) { Status = EFI_NOT_STARTED; goto ON_EXIT; } + Token->Status = EFI_NOT_READY; + // - // Check the MaxRetry and RetryInterval values. + // If zero, use the parameter configured through Dns.Configure() interface. // - if (Instance->MaxRetry == 0) { - Instance->MaxRetry = DNS_DEFAULT_RETRY; + if (Token->RetryCount == 0) { + Token->RetryCount = ConfigData->RetryCount; } + // + // If zero, use the parameter configured through Dns.Configure() interface. + // + if (Token->RetryInterval == 0) { + Token->RetryInterval = ConfigData->RetryInterval; + } + + // + // Minimum interval of retry is 2 second. If the retry interval is less than 2 second, then use the 2 second. + // if (Token->RetryInterval < DNS_DEFAULT_TIMEOUT) { Token->RetryInterval = DNS_DEFAULT_TIMEOUT; } @@ -620,25 +624,31 @@ Dns4GeneralLookUp ( Instance = DNS_INSTANCE_FROM_THIS_PROTOCOL4 (This); ConfigData = &(Instance->Dns4CfgData); - - Instance->MaxRetry = ConfigData->RetryCount; - - Token->Status = EFI_NOT_READY; - Token->RetryCount = 0; - Token->RetryInterval = ConfigData->RetryInterval; if (Instance->State != DNS_STATE_CONFIGED) { Status = EFI_NOT_STARTED; goto ON_EXIT; } + Token->Status = EFI_NOT_READY; + + // + // If zero, use the parameter configured through Dns.Configure() interface. // - // Check the MaxRetry and RetryInterval values. + if (Token->RetryCount == 0) { + Token->RetryCount = ConfigData->RetryCount; + } + + // + // If zero, use the parameter configured through Dns.Configure() interface. // - if (Instance->MaxRetry == 0) { - Instance->MaxRetry = DNS_DEFAULT_RETRY; + if (Token->RetryInterval == 0) { + Token->RetryInterval = ConfigData->RetryInterval; } + // + // Minimum interval of retry is 2 second. If the retry interval is less than 2 second, then use the 2 second. + // if (Token->RetryInterval < DNS_DEFAULT_TIMEOUT) { Token->RetryInterval = DNS_DEFAULT_TIMEOUT; } @@ -1052,8 +1062,6 @@ Dns6Configure ( Dns6InstanceCancelToken(Instance, NULL); } - Instance->MaxRetry = 0; - if (Instance->UdpIo != NULL){ UdpIoCleanIo (Instance->UdpIo); } @@ -1203,28 +1211,34 @@ Dns6HostNameToIp ( Instance = DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This); ConfigData = &(Instance->Dns6CfgData); - - Instance->MaxRetry = ConfigData->RetryCount; - - Token->Status = EFI_NOT_READY; - Token->RetryCount = 0; - Token->RetryInterval = ConfigData->RetryInterval; if (Instance->State != DNS_STATE_CONFIGED) { Status = EFI_NOT_STARTED; goto ON_EXIT; } + Token->Status = EFI_NOT_READY; + // - // Check the MaxRetry and RetryInterval values. + // If zero, use the parameter configured through Dns.Configure() interface. // - if (Instance->MaxRetry == 0) { - Instance->MaxRetry = DNS_DEFAULT_RETRY; + if (Token->RetryCount == 0) { + Token->RetryCount = ConfigData->RetryCount; } + // + // If zero, use the parameter configured through Dns.Configure() interface. + // + if (Token->RetryInterval == 0) { + Token->RetryInterval = ConfigData->RetryInterval; + } + + // + // Minimum interval of retry is 2 second. If the retry interval is less than 2 second, then use the 2 second. + // if (Token->RetryInterval < DNS_DEFAULT_TIMEOUT) { Token->RetryInterval = DNS_DEFAULT_TIMEOUT; - } + } // // Check cache @@ -1451,25 +1465,31 @@ Dns6GeneralLookUp ( Instance = DNS_INSTANCE_FROM_THIS_PROTOCOL6 (This); ConfigData = &(Instance->Dns6CfgData); - - Instance->MaxRetry = ConfigData->RetryCount; - - Token->Status = EFI_NOT_READY; - Token->RetryCount = 0; - Token->RetryInterval = ConfigData->RetryInterval; if (Instance->State != DNS_STATE_CONFIGED) { Status = EFI_NOT_STARTED; goto ON_EXIT; } + Token->Status = EFI_NOT_READY; + // - // Check the MaxRetry and RetryInterval values. + // If zero, use the parameter configured through Dns.Configure() interface. // - if (Instance->MaxRetry == 0) { - Instance->MaxRetry = DNS_DEFAULT_RETRY; + if (Token->RetryCount == 0) { + Token->RetryCount = ConfigData->RetryCount; + } + + // + // If zero, use the parameter configured through Dns.Configure() interface. + // + if (Token->RetryInterval == 0) { + Token->RetryInterval = ConfigData->RetryInterval; } + // + // Minimum interval of retry is 2 second. If the retry interval is less than 2 second, then use the 2 second. + // if (Token->RetryInterval < DNS_DEFAULT_TIMEOUT) { Token->RetryInterval = DNS_DEFAULT_TIMEOUT; }