net: exit on WAITALL and !ret
[fio.git] / engines / net.c
index 7354d310141d2f7b4a9da29827da31ea6a319c67..419508e47a5ec037a33c2c00781973820cbdc752 100644 (file)
@@ -144,7 +144,7 @@ static int fio_netio_prep(struct thread_data *td, struct io_u *io_u)
                td_verror(td, EINVAL, "bad direction");
                return 1;
        }
-               
+
        return 0;
 }
 
@@ -360,6 +360,8 @@ static int fio_netio_recv(struct thread_data *td, struct io_u *io_u)
                }
                if (ret > 0)
                        break;
+               else if (!ret && (flags & MSG_WAITALL))
+                       break;
 
                ret = poll_wait(td, io_u->file->fd, POLLIN);
                if (ret <= 0)
@@ -543,6 +545,15 @@ static int fio_netio_setup_connect_inet(struct thread_data *td,
 {
        struct netio_data *nd = td->io_ops->data;
 
+       if (!host) {
+               log_err("fio: connect with no host to connect to.\n");
+               if (td_read(td))
+                       log_err("fio: did you forget to set 'listen'?\n");
+
+               td_verror(td, EINVAL, "no hostname= set");
+               return 1;
+       }
+
        nd->addr.sin_family = AF_INET;
        nd->addr.sin_port = htons(port);
 
@@ -687,6 +698,11 @@ static int fio_netio_init(struct thread_data *td)
        struct netio_options *o = td->eo;
        int ret;
 
+#ifdef WIN32
+       WSADATA wsd;
+       WSAStartup(MAKEWORD(2,2), &wsd);
+#endif
+
        if (td_random(td)) {
                log_err("fio: network IO can't be random\n");
                return 1;