static struct namecache_s
{
lhnetaddress_t address;
+ double expirationtime;
char name[64];
}
namecache[MAX_NAMECACHE];
for (i = 0;i < MAX_NAMECACHE;i++)
if (!strcmp(namecache[i].name, name))
break;
- if (i < MAX_NAMECACHE)
+ if (i < MAX_NAMECACHE && Sys_DoubleTime() < namecache[i].expirationtime)
{
*address = namecache[i].address;
if (address->addresstype == LHNETADDRESSTYPE_INET6)
for (i = 0;i < (int)sizeof(namecache[namecacheposition].name)-1 && name[i];i++)
namecache[namecacheposition].name[i] = name[i];
namecache[namecacheposition].name[i] = 0;
+ namecache[namecacheposition].expirationtime = Sys_DoubleTime() + 300;
namecache[namecacheposition].address = *address;
namecacheposition = (namecacheposition + 1) % MAX_NAMECACHE;
#ifdef STANDALONETEST
for (i = 0;i < (int)sizeof(namecache[namecacheposition].name)-1 && name[i];i++)
namecache[namecacheposition].name[i] = name[i];
namecache[namecacheposition].name[i] = 0;
+ namecache[namecacheposition].expirationtime = Sys_DoubleTime() + 300;
namecache[namecacheposition].address = *address;
namecacheposition = (namecacheposition + 1) % MAX_NAMECACHE;
#ifdef STANDALONETEST
for (i = 0;i < (int)sizeof(namecache[namecacheposition].name)-1 && name[i];i++)
namecache[namecacheposition].name[i] = name[i];
namecache[namecacheposition].name[i] = 0;
+ namecache[namecacheposition].expirationtime = Sys_DoubleTime() + 300;
namecache[namecacheposition].address.addresstype = LHNETADDRESSTYPE_NONE;
namecacheposition = (namecacheposition + 1) % MAX_NAMECACHE;
return 0;