- cache FQDN in kvp_daemon to avoid timeouts

OBS-URL: https://build.opensuse.org/package/show/Virtualization/hyper-v?expand=0&rev=67
This commit is contained in:
Olaf Hering 2013-08-07 17:12:54 +00:00 committed by Git OBS Bridge
parent 18c1b296af
commit f4e9f3f425
2 changed files with 14 additions and 8 deletions

View File

@ -1,6 +1,7 @@
-------------------------------------------------------------------
Wed Aug 7 15:54:19 CEST 2013 - ohering@suse.de
Wed Aug 7 19:04:35 CEST 2013 - ohering@suse.de
- cache FQDN in kvp_daemon to avoid timeouts
- use full nlmsghdr in netlink_send
- correct payload size in netlink_send
- use single send+recv buffer

View File

@ -89,6 +89,7 @@ static char *processor_arch;
static char *os_build;
static char *os_version;
static char *lic_version = "Unknown version";
static char full_domain_name[HV_KVP_EXCHANGE_MAX_VALUE_SIZE];
static struct utsname uts_buf;
/*
@ -1368,7 +1369,7 @@ setval_error:
}
static int
static void
kvp_get_domain_name(char *buffer, int length)
{
struct addrinfo hints, *info ;
@ -1382,12 +1383,12 @@ kvp_get_domain_name(char *buffer, int length)
error = getaddrinfo(buffer, NULL, &hints, &info);
if (error != 0) {
strcpy(buffer, "getaddrinfo failed\n");
return error;
snprintf(buffer, length, "getaddrinfo failed: 0x%x %s",
error, gai_strerror(error));
return;
}
strcpy(buffer, info->ai_canonname);
snprintf(buffer, length, "%s", info->ai_canonname);
freeaddrinfo(info);
return error;
}
static int
@ -1452,6 +1453,11 @@ int main(void)
* Retrieve OS release information.
*/
kvp_get_os_info();
/*
* Cache Fully Qualified Domain Name because getaddrinfo takes an
* unpredicatable amount of time to finish.
*/
kvp_get_domain_name(full_domain_name, sizeof(full_domain_name));
if (kvp_file_init()) {
syslog(LOG_ERR, "Failed to initialize the pools");
@ -1670,8 +1676,7 @@ int main(void)
switch (hv_msg->body.kvp_enum_data.index) {
case FullyQualifiedDomainName:
kvp_get_domain_name(key_value,
HV_KVP_EXCHANGE_MAX_VALUE_SIZE);
strcpy(key_value, full_domain_name);
strcpy(key_name, "FullyQualifiedDomainName");
break;
case IntegrationServicesVersion: