Prefer IPv4 or IPv6 based on the number of failures
Suggested by teor at #17835 (moved):
- If the machine instantly fails IPv4 or IPv6 connections, stop those connections for a while
- When there are a lot more IPv4 than IPv6 failures, don't try IPv4 as much
- When there are a lot more IPv6 than IPv4 failures, don't try IPv6 as much
- After a while, forget old failures