X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=engines%2Fnet.c;h=a70e56e6d5095b01455a6f2ca234448dbe7635f0;hp=12f49a2a67ca2f1d7241b42efdc45543b77fd868;hb=8ea39c32d29428b17bfe9c806fc33f0c8adfe118;hpb=6a5c4d92ce70a05d2fee981b6f133373c0ef62f8 diff --git a/engines/net.c b/engines/net.c index 12f49a2a..a70e56e6 100644 --- a/engines/net.c +++ b/engines/net.c @@ -466,7 +466,7 @@ static int fio_netio_connect(struct thread_data *td, struct fio_file *f) { struct netio_data *nd = td->io_ops->data; struct netio_options *o = td->eo; - int type, domain, optval; + int type, domain; if (o->proto == FIO_TYPE_TCP) { domain = AF_INET; @@ -491,7 +491,8 @@ static int fio_netio_connect(struct thread_data *td, struct fio_file *f) #ifdef CONFIG_TCP_NODELAY if (o->nodelay && o->proto == FIO_TYPE_TCP) { - optval = 1; + int optval = 1; + 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; @@ -530,7 +531,7 @@ static int fio_netio_accept(struct thread_data *td, struct fio_file *f) struct netio_data *nd = td->io_ops->data; struct netio_options *o = td->eo; socklen_t socklen = sizeof(nd->addr); - int state, optval; + int state; if (o->proto == FIO_TYPE_UDP) { f->fd = nd->listenfd; @@ -553,7 +554,8 @@ static int fio_netio_accept(struct thread_data *td, struct fio_file *f) #ifdef CONFIG_TCP_NODELAY if (o->nodelay && o->proto == FIO_TYPE_TCP) { - optval = 1; + int optval = 1; + 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;