This project is an experimental implementation of a TCP connector which attempts to make multiple simultaneous connections to the target host (one per A/AAAA record).
The first connection to succeed is returned, while others are closed.
Normally, if your domain name resolves to multiple A records, you see something like this:
$ host google.com google.com has address 18.104.22.168 google.com has address 22.214.171.124 google.com has address 126.96.36.199 google.com has address 188.8.131.52 google.com has address 184.108.40.206 google.com has address 220.127.116.11 google.com has address 18.104.22.168 google.com has address 22.214.171.124 google.com has address 126.96.36.199 google.com has address 188.8.131.52 google.com has address 184.108.40.206 google.com has IPv6 address 2607:f8b0:4002:802::1004 ...
The order of addresses is typically randomized by your libc resolver.
When you try to download http://google.com/, your browser or HTTP client will grab the first address and try to connect to it. If the connection fails, it will try the next one, but this happens after a long timeout.
In an attempt to speed this up, Connie's implementation tries to connect to all the addresses at once, and then uses an epoll() call to determine which connection succeeded. It then closes all other connections and continues talking to the address that responded first.
There are several results that stem from this scheme. First, if one of the servers is down it will never be blindly selected as before. Second, we can bet that the server to complete the TCP handshake first is likely also geographically closer and faster than the rest.
Included with the project are two benchmark files which can be used to measure the effect of using the connie connect implementations against the built-in connect implementation.
This code is prototype-only. For one, you'll run out of file descriptors much more quickly with a scheme like this. For another, none of this has been tested in production. In other words, feel free to use it for fun, but proceed with caution when using for profit.