Yubico/yubico-c-client — pull request #17 by arr2036 (2013-04-11 22:45:29+00:00)
Title: Lovin on the yubico-c-client tranche 2

OK so not as bad as the first one.

Real world testing threw up a few issues that the test suite didn't catch. Seems timing is actually pretty important with libcurl, and if you jump out of processing the request early before all servers have responded it will close the underlying TCP connection.

I modified our server pool code to have a special connection selection mode where it will use the connection that has been idle the longest, and only perform cleanup when it's about to make a new request.

That, combined with the fixes in this pull request, get connection re-use up to 100% with non of the nasty hard resets you got in the original code.

![Screen Shot 2013-04-11 at 18 44 18](https://f.cloud.github.com/assets/791758/370606/70b3de7c-a2f9-11e2-99ab-c1a1c7e31690.png)

![Screen Shot 2013-04-11 at 18 44 32](https://f.cloud.github.com/assets/791758/370607/741af096-a2f9-11e2-8365-99e078b072b4.png)