Change minumum DNS cache time to 1 sec

This commit is contained in:
Vladimir Dubrovin 2021-10-30 13:43:20 +03:00
parent 6c1b711fc9
commit 70b14394b0

View File

@ -1334,7 +1334,8 @@ unsigned long udpresolve(int af, unsigned char * name, unsigned char * value, un
} }
ttl = ntohl(*(unsigned long *)(buf + k + 6)); ttl = ntohl(*(unsigned long *)(buf + k + 6));
memcpy(value, buf + k + 12, af == AF_INET6? 16:4); memcpy(value, buf + k + 12, af == AF_INET6? 16:4);
if(ttl < 60 || ttl > (3600*12)) ttl = 300; if(ttl < 0 || ttl > (3600*12)) ttl = 3600*12;
if(!ttl) ttl = 1;
hashadd(af == AF_INET6?&dns6_table:&dns_table, name, value, conf.time+ttl); hashadd(af == AF_INET6?&dns6_table:&dns_table, name, value, conf.time+ttl);
if(retttl) *retttl = ttl; if(retttl) *retttl = ttl;
return 1; return 1;