Windows: io cancellation often fails and causes crashes, so remove it.
[fio.git] / engines / net.c
index b728df1f7385f751d86ed63e526be0c71782745a..3e03bc9c8742954049ba6246315ad6364222c49d 100644 (file)
@@ -92,12 +92,14 @@ static struct fio_option options[] = {
                          },
                },
        },
+#ifdef CONFIG_TCP_NODELAY
        {
                .name   = "nodelay",
                .type   = FIO_OPT_BOOL,
                .off1   = offsetof(struct netio_options, nodelay),
                .help   = "Use TCP_NODELAY on TCP connections",
        },
+#endif
        {
                .name   = "listen",
                .type   = FIO_OPT_STR_SET,
@@ -479,13 +481,15 @@ static int fio_netio_connect(struct thread_data *td, struct fio_file *f)
                return 1;
        }
 
+#ifdef CONFIG_TCP_NODELAY
        if (o->nodelay && o->proto == FIO_TYPE_TCP) {
                optval = 1;
-               if (setsockopt(f->fd, IPPROTO_TCP, TCP_NODELAY, &optval, sizeof(int)) < 0) {
+               if (setsockopt(f->fd, IPPROTO_TCP, TCP_NODELAY, (void *) &optval, sizeof(int)) < 0) {
                        log_err("fio: cannot set TCP_NODELAY option on socket (%s), disable with 'nodelay=0'\n", strerror(errno));
                        return 1;
                }
        }
+#endif
 
        if (o->proto == FIO_TYPE_UDP)
                return 0;
@@ -539,13 +543,15 @@ static int fio_netio_accept(struct thread_data *td, struct fio_file *f)
                goto err;
        }
 
+#ifdef CONFIG_TCP_NODELAY
        if (o->nodelay && o->proto == FIO_TYPE_TCP) {
                optval = 1;
-               if (setsockopt(f->fd, IPPROTO_TCP, TCP_NODELAY, &optval, sizeof(int)) < 0) {
+               if (setsockopt(f->fd, IPPROTO_TCP, TCP_NODELAY, (void *) &optval, sizeof(int)) < 0) {
                        log_err("fio: cannot set TCP_NODELAY option on socket (%s), disable with 'nodelay=0'\n", strerror(errno));
                        return 1;
                }
        }
+#endif
 
        reset_all_stats(td);
        td_set_runstate(td, state);
@@ -767,12 +773,12 @@ static int fio_netio_setup_listen_inet(struct thread_data *td, short port)
        }
 
        opt = 1;
-       if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void*)&opt, sizeof(opt)) < 0) {
+       if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void *) &opt, sizeof(opt)) < 0) {
                td_verror(td, errno, "setsockopt");
                return 1;
        }
 #ifdef SO_REUSEPORT
-       if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &opt, sizeof(opt)) < 0) {
+       if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, (void *) &opt, sizeof(opt)) < 0) {
                td_verror(td, errno, "setsockopt");
                return 1;
        }