BUG/MINOR: unix: fix connect's polling in case no data are scheduled

There's a test after a successful synchronous connect() consisting
in waking the data layer up asap if there's no more handshake.
Unfortunately this test is run before setting the CO_FL_SEND_PROXY
flag and before the transport layer adds its own flags, so it can
indicate a willingness to send data while it's not the case and it
will have to be handled later.

This has no visible effect except a useless call to a function in
case of health checks making use of the proxy protocol for example.

Additionally a corner case where EALREADY was returned and considered
equivalent to EISCONN was fixed so that it's considered equivalent to
EINPROGRESS given that the connection is not complete yet. But this
code should never return on the first call anyway so it's mostly a
cleanup.

This fix should be backported to 1.7 and 1.6 at least to avoid
headaches during some debugging.
1 file changed