redis/hiredis — pull request #264 by mmaxim (2014-08-15 17:22:43+00:00)
Title: Add support for enabling SO_REUSEADDR when connecting to the Redis server using bind

On machines with a large number of outgoing TCP connections, sometimes it becomes necessary to enable `SO_REUSEADDR` on sockets before calling `bind` in order to avoid getting `EADDRINUSE`. This delays any errors until `connect` which will trigger `EADDRNOTAVAIL` if there is a conflict on both the source and destination addresses. A framework can retry the `bind`/`connect` flow to try and get a different source port a set number of times.

The following patch allows a client of hiredis to specify they want to the `SO_REUSEADDR` flag when attempting to connect to the Redis server. I tried to make the style as close to what is already here, but obviously if something seems off then it is all changeable.

Thanks!