- do {
- ret = connect(s->fd, (struct sockaddr *)&addr, sizeof(addr));
- if (ret == -1)
- ret = -(s->get_error(s));
-
- if (ret == -EINPROGRESS || ret == -EWOULDBLOCK)
- qemu_set_fd_handler2(s->fd, NULL, NULL, tcp_wait_for_connect, s);
- } while (ret == -EINTR);
-
- if (ret < 0 && ret != -EINPROGRESS && ret != -EWOULDBLOCK) {
- DPRINTF("connect failed\n");
- migrate_fd_error(s);
- } else if (ret >= 0)
- migrate_fd_connect(s);
-
- return s;
+ s->fd = inet_nonblocking_connect(host_port, tcp_wait_for_connect, s, errp);