Skip to content

Commit 5b2fa06

Browse files
committed
cleanup & pipelining for 3.1.0 release
1 parent 4facab7 commit 5b2fa06

2 files changed

Lines changed: 23 additions & 23 deletions

File tree

src/wrk.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,26 @@ static int calibrate(aeEventLoop *loop, long long id, void *data) {
331331
return AE_NOMORE;
332332
}
333333

334+
static int check_timeouts(aeEventLoop *loop, long long id, void *data) {
335+
thread *thread = data;
336+
connection *c = thread->cs;
337+
uint64_t now = time_us();
338+
339+
uint64_t maxAge = now - (cfg.timeout * 1000);
340+
341+
for (uint64_t i = 0; i < thread->connections; i++, c++) {
342+
if (maxAge > c->start) {
343+
thread->errors.timeout++;
344+
}
345+
}
346+
347+
if (stop || now >= thread->stop_at) {
348+
aeStop(loop);
349+
}
350+
351+
return TIMEOUT_INTERVAL_MS;
352+
}
353+
334354
static int sample_rate(aeEventLoop *loop, long long id, void *data) {
335355
thread *thread = data;
336356

@@ -418,26 +438,6 @@ static int response_complete(http_parser *parser) {
418438
return 0;
419439
}
420440

421-
static int check_timeouts(aeEventLoop *loop, long long id, void *data) {
422-
thread *thread = data;
423-
connection *c = thread->cs;
424-
uint64_t now = time_us();
425-
426-
uint64_t maxAge = now - (cfg.timeout * 1000);
427-
428-
for (uint64_t i = 0; i < thread->connections; i++, c++) {
429-
if (maxAge > c->start) {
430-
thread->errors.timeout++;
431-
}
432-
}
433-
434-
if (stop || now >= thread->stop_at) {
435-
aeStop(loop);
436-
}
437-
438-
return TIMEOUT_INTERVAL_MS;
439-
}
440-
441441
static void socket_connected(aeEventLoop *loop, int fd, void *data, int mask) {
442442
connection *c = data;
443443

@@ -450,8 +450,8 @@ static void socket_connected(aeEventLoop *loop, int fd, void *data, int mask) {
450450
http_parser_init(&c->parser, HTTP_RESPONSE);
451451
c->written = 0;
452452

453-
aeCreateFileEvent(c->thread->loop, c->fd, AE_READABLE, socket_readable, c);
454-
aeCreateFileEvent(c->thread->loop, c->fd, AE_WRITABLE, socket_writeable, c);
453+
aeCreateFileEvent(c->thread->loop, fd, AE_READABLE, socket_readable, c);
454+
aeCreateFileEvent(c->thread->loop, fd, AE_WRITABLE, socket_writeable, c);
455455

456456
return;
457457

src/wrk.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include "script.h"
1515
#include "http_parser.h"
1616

17-
#define VERSION "3.0.3"
17+
#define VERSION "3.1.0"
1818
#define RECVBUF 8192
1919
#define SAMPLES 100000000
2020

0 commit comments

Comments
 (0)