anetTcpGenericConnect() code improved + 1 bug fix.
anetTcpGenericConnect() code improved + 1 bug fix.

Now the socket is closed if anetNonBlock() fails, and in general the
code structure makes it harder to introduce this kind of bugs in the
future.

Reference: pull request #1059.

JackieXie168/redis,JackieXie168/redis,JackieXie168/redis,JackieXie168/redis