Debugging output at the same time in case of asynchronous handling.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ DBG("Asynchronous connect for sock %d, performing polling with"
+ " timeout: %lums", sock->fd, timeout);
/*
* Perform poll loop following EINPROGRESS recommendation from
* connect(2) man page.
/*
* Perform poll loop following EINPROGRESS recommendation from
* connect(2) man page.
ret = getsockopt(sock->fd, SOL_SOCKET,
SO_ERROR, &optval, &optval_len);
if (ret) {
ret = getsockopt(sock->fd, SOL_SOCKET,
SO_ERROR, &optval, &optval_len);
if (ret) {
goto error;
}
if (!optval) {
connect_ret = 0;
goto success;
} else {
goto error;
}
if (!optval) {
connect_ret = 0;
goto success;
} else {
+ /* Get actual connect() errno from opt_val */
+ errno = optval;
+ DBG("Asynchronous connect for sock %d, performing polling with"
+ " timeout: %lums", sock->fd, timeout);
+
/*
* Perform poll loop following EINPROGRESS recommendation from
* connect(2) man page.
/*
* Perform poll loop following EINPROGRESS recommendation from
* connect(2) man page.
ret = getsockopt(sock->fd, SOL_SOCKET,
SO_ERROR, &optval, &optval_len);
if (ret) {
ret = getsockopt(sock->fd, SOL_SOCKET,
SO_ERROR, &optval, &optval_len);
if (ret) {
goto error;
}
if (!optval) {
connect_ret = 0;
goto success;
} else {
goto error;
}
if (!optval) {
connect_ret = 0;
goto success;
} else {
+ /* Get actual connect() errno from opt_val */
+ errno = optval;