From: Jens Axboe Date: Thu, 29 Nov 2012 19:02:50 +0000 (+0100) Subject: net: set runstate to SETTING_UP while waiting for a connection X-Git-Tag: fio-2.0.12~42 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=859088d3939ce6eccfc59a0d5559922e29e58a47;p=fio.git net: set runstate to SETTING_UP while waiting for a connection Otherwise the status print thinks it's running, and displays bad stats. Signed-off-by: Jens Axboe --- diff --git a/engines/net.c b/engines/net.c index 419508e4..373821b2 100644 --- a/engines/net.c +++ b/engines/net.c @@ -475,24 +475,32 @@ 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; fio_socklen_t socklen = sizeof(nd->addr); + int state; if (o->proto == FIO_TYPE_UDP) { f->fd = nd->listenfd; return 0; } + state = td->runstate; + td_set_runstate(td, TD_SETTING_UP); + log_info("fio: waiting for connection\n"); if (poll_wait(td, nd->listenfd, POLLIN) < 0) - return 1; + goto err; f->fd = accept(nd->listenfd, (struct sockaddr *) &nd->addr, &socklen); if (f->fd < 0) { td_verror(td, errno, "accept"); - return 1; + goto err; } + td_set_runstate(td, state); return 0; +err: + td_set_runstate(td, state); + return 1; } static int fio_netio_open_file(struct thread_data *td, struct fio_file *f)