diff --git a/src/wrk.c b/src/wrk.c index 2ddcdf3..8eff169 100644 --- a/src/wrk.c +++ b/src/wrk.c @@ -464,8 +464,12 @@ static void socket_writeable(aeEventLoop *loop, int fd, void *data, int mask) { connection *c = data; thread *thread = c->thread; - if (!c->written && cfg.dynamic) { - script_request(thread->L, &c->request, &c->length); + if (!c->written) { + if (cfg.dynamic) { + script_request(thread->L, &c->request, &c->length); + } + c->start = time_us(); + c->pending = cfg.pipeline; } char *buf = c->request + c->written; @@ -478,11 +482,6 @@ static void socket_writeable(aeEventLoop *loop, int fd, void *data, int mask) { case RETRY: return; } - if (!c->written) { - c->start = time_us(); - c->pending = cfg.pipeline; - } - c->written += n; if (c->written == c->length) { c->written = 0; diff --git a/src/wrk.h b/src/wrk.h index 97a4de6..4ee683f 100644 --- a/src/wrk.h +++ b/src/wrk.h @@ -14,7 +14,7 @@ #include "script.h" #include "http_parser.h" -#define VERSION "3.1.1" +#define VERSION "3.1.2" #define RECVBUF 8192 #define SAMPLES 100000000