summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx.manpages@gmail.com>2022-09-02 21:57:13 +0200
committerAlejandro Colomar <alx.manpages@gmail.com>2022-09-02 21:57:13 +0200
commit9ec01ef250f523ed46a30f6d92676b44883f2dd8 (patch)
tree06c88e91764c8d7488cf49fea63ef7a845bbf9ae
parent245bc9c437e8e66a012733eedf37101a47ee9ca7 (diff)
loop 1000 timesfront
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-rw-r--r--src/nxt_unit_app_test.c74
1 files changed, 38 insertions, 36 deletions
diff --git a/src/nxt_unit_app_test.c b/src/nxt_unit_app_test.c
index 51df731..4d3a624 100644
--- a/src/nxt_unit_app_test.c
+++ b/src/nxt_unit_app_test.c
@@ -169,44 +169,46 @@ greeting_app_request_handler(nxt_unit_request_info_t *req)
rc = NXT_UNIT_ERROR;
- warnx("ALX: socket()");
- sfd = socket(AF_UNIX, SOCK_STREAM, 0);
- if (nxt_slow_path(sfd == -1)) {
- warn("ALX: fail");
- goto fail;
- }
+ for (int i = 0; i < 1000; i++) {
+ warnx("ALX: socket()");
+ sfd = socket(AF_UNIX, SOCK_STREAM, 0);
+ if (nxt_slow_path(sfd == -1)) {
+ warn("ALX: fail");
+ goto fail;
+ }
- sun.sun_family = AF_UNIX;
- warnx("ALX: memset()");
- memcpy(sun.sun_path, "\0back", 6);
- warnx("ALX: connect()");
- if (nxt_slow_path(connect(sfd, (struct sockaddr *)&sun,
- offsetof(struct sockaddr_un, sun_path) + 5)))
- {
- warn("ALX: fail");
- goto fail;
- }
- char get[] = "GET / HTTP/1.0\n\n";
- fprintf(stderr, "ALX: write(): ");
- wr = write(sfd, get, sizeof(get));
- fprintf(stderr, "%zd(%zu)\n", wr, sizeof(get));
- if (nxt_slow_path(wr != sizeof(get))) {
- warn("ALX: fail");
- goto fail;
- }
- fprintf(stderr, "ALX: read(): ");
- rd = read(sfd, buff, 12);
- fprintf(stderr, "%zd\n", rd);
- if (nxt_slow_path(rd < 12)) {
- warn("ALX: fail");
- goto fail;
- }
- warnx("ALX: close()");
- if (nxt_slow_path(close(sfd) == -1)) {
- warn("ALX: fail");
- goto fail;
+ sun.sun_family = AF_UNIX;
+ warnx("ALX: memset()");
+ memcpy(sun.sun_path, "\0back", 6);
+ warnx("ALX: connect()");
+ if (nxt_slow_path(connect(sfd, (struct sockaddr *)&sun,
+ offsetof(struct sockaddr_un, sun_path) + 5)))
+ {
+ warn("ALX: fail");
+ goto fail;
+ }
+ char get[] = "GET / HTTP/1.0\n\n";
+ fprintf(stderr, "ALX: write(): ");
+ wr = write(sfd, get, sizeof(get));
+ fprintf(stderr, "%zd(%zu)\n", wr, sizeof(get));
+ if (nxt_slow_path(wr != sizeof(get))) {
+ warn("ALX: fail");
+ goto fail;
+ }
+ fprintf(stderr, "ALX: read(): ");
+ rd = read(sfd, buff, 12);
+ fprintf(stderr, "%zd\n", rd);
+ if (nxt_slow_path(rd < 12)) {
+ warn("ALX: fail");
+ goto fail;
+ }
+ warnx("ALX: close()");
+ if (nxt_slow_path(close(sfd) == -1)) {
+ warn("ALX: fail");
+ goto fail;
+ }
+ warn("ALX:");
}
- warn("ALX:");
rc = nxt_unit_response_init(req, 200 /* Status code. */,
1 /* Number of response headers. */,