datastax/python-driver — pull request #127 by ccstolley (2014-05-23 01:16:07+00:00)
Title: Fix race condition during connect().

For https://datastax-oss.atlassian.net/browse/PYTHON-68

On python3, we occasionally see connection failures because the socket
is closed before the connect() is attempted. This is caused by the
asyncore event loop thread closing the socket prematurely. I suspect
this bug exists on python2 as well, but happens more often on python3
because of its more responsive thread scheduler. This patch causes the
the socket to be watched by the event loop only after the connect()
completes successfully.