#include <poll.h>
#include <common/common.h>
+#include <common/time.h>
#include "inet.h"
-#define MSEC_PER_SEC 1000
-#define NSEC_PER_MSEC 1000000
#define RECONNECT_DELAY 200 /* ms */
/*
goto success;
}
+ 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.
ret = getsockopt(sock->fd, SOL_SOCKET,
SO_ERROR, &optval, &optval_len);
if (ret) {
+ PERROR("getsockopt");
goto error;
}
if (!optval) {
connect_ret = 0;
goto success;
} else {
+ /* Get actual connect() errno from opt_val */
+ errno = optval;
goto error;
}
}