On 2016-01-04, Luke Small <thinkitdoitd...@gmail.com> wrote: > What I meant is, if a program sends a handful of pings to each mirror, > would it think it is being spammed and shutdown any further connections. I > didn't mean to say that I want to connect the pkg_ping program to a of > anchor. I tried an initial localhost pinging, pkg_ping program in > virtualbox using 32 MB RAM and it worked; while it froze trying to open > pico in the console. It wouldn't need to use much resources and would use > kqueue, which isn't available in any other language other than C, in the > base as far as I'm aware. I use kqueue to easily store a custom struct with > the pipe() values, list pointers and such in *udata. It intermittently > reads from pipes from all the spawned ping threads to conserve memory, > reads the individual lantency output and stores the ping time value in a > single linked list to be transferred to an array to be sorted by qsort so > that the median value is determined by its position in the sorted array. It > actually doesn't directly call any sockets or anything that hasn't been > audited in the base it just reads individual characters from pipes until > EOF so far.
ping doesn't tell you which is the best mirror. Some mirrors are on OS which rate-limit icmp by default. Some might prioritise pings over real traffic, or be overloaded and dropping packets rather than having high pings (which you can't distinguish from the "rate-limited icmp" case). And, unless you do some pre-selection (from a geolocation database or similar) to cut the list down, you're going to generate useless traffic to mirrors around the world, some of which have good regional bandwidth but very limited international bandwidth and don't really want unrelated ping traffic from someone who is never going to use that mirror anyway..