]> granicus.if.org Git - pdns/commit
rec: Sort NS addresses by speed, remove old ones
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 30 Oct 2017 13:52:13 +0000 (14:52 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 30 Oct 2017 14:17:18 +0000 (15:17 +0100)
commit0e4675a9fb1dd125320c02e8d157ec02f5aca70c
treef42f401ef77b149e7b306c7d482df1f63778bff6
parent4e7fea16f8774e7d9b8abe84f8c70efc39877340
rec: Sort NS addresses by speed, remove old ones

We used to not sort the different addresses we had for a given NS
by speed, only taking care of placing the first one in front.
However we also didn't remove existing entries for a given NS,
meaning that if a given IP stopped being advertised it would stay
in our NS speeds map and keep being used to determine the fastest
NS, even if we would only send queries to the new IPs after the
selection. Since we didn't send any query to the old IP anymore,
its latency would only keep decaying meaning the computed latency
of the corresponding NS would only keep decreasing, completely
uncorrelated from its real latency.

This commit removes old entries from the NS speeds map if they are
no longer present when we refresh the addresses of a given NS.
In addition, it orders all NS IPs by decaying latency, meaning new
ones will have a fair chance of being picked up.
pdns/syncres.cc
pdns/syncres.hh