osx: fix non-blocking tcp connect

I need some guidance here. TCP connection fails on OSX unless I apply this workaround.
Seems that OSX doesn't like writing to socket before poll() says it is ready.

What is the meaning of timeout=-1?