3rd-Eden/jackpot — pull request #9 by ianshward (2013-07-31 15:53:31+00:00)
Title: handle timeout while trying to connect

Without this, the callack fn in allocate will never be called if timeout is hit while trying to connect. I looked at their the timeout() function I add could be handled in either(), but it seems like that would require something like:

```javascript
function either(err) {
this.removeListener('error', either);
this.removeListener('connect', either);
this.removeListener('timeout', either);

if (!err && !this.writable)
err = new Error('Socket is not writable'); // Problem is whether there's a way to tell the socket timed out when trying to connect, or, is not writable for some other reason... Jackpot.listen will destroy the socket on timeout, which will make it not writable, but, directly calling a separate timeout function as in the pull request seems safer, since it is the higher level interface to know the socket timed out.

// Add to the pool
if (!err) self.pool.push(this);
self.pending--;

fn(err, this);
}
```