+static int already_connected(int fd, struct io_plan *plan)
+{
+ return io_debug_io(1);
+}
+
+static int do_connect(int fd, struct io_plan *plan)
+{
+ int err, ret;
+ socklen_t len = sizeof(err);
+
+ /* Has async connect finished? */
+ ret = getsockopt(fd, SOL_SOCKET, SO_ERROR, &err, &len);
+ if (ret < 0)
+ return -1;
+
+ if (err == 0) {
+ /* Restore blocking if it was initially. */
+ fcntl(fd, F_SETFD, plan->u1.s);
+ return 1;
+ }
+ return 0;
+}
+
+struct io_plan io_connect_(int fd, const struct addrinfo *addr,
+ struct io_plan (*cb)(struct io_conn*, void *),
+ void *arg)