From 1ec63537334e8765cd2d8e43dbca35340aa68777 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Thu, 14 Nov 2019 16:39:48 +0300 Subject: Introduced event engine memory buffers. --- src/nxt_buf.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/nxt_buf.c') diff --git a/src/nxt_buf.c b/src/nxt_buf.c index 91846e4d..2d52efca 100644 --- a/src/nxt_buf.c +++ b/src/nxt_buf.c @@ -207,6 +207,13 @@ nxt_buf_completion(nxt_task_t *task, void *obj, void *data) mp = b->data; nxt_mp_free(mp, b); + nxt_buf_parent_completion(task, parent); +} + + +void +nxt_buf_parent_completion(nxt_task_t *task, nxt_buf_t *parent) +{ if (parent != NULL) { nxt_debug(task, "parent retain:%uD", parent->retain); @@ -272,17 +279,7 @@ nxt_buf_ts_completion(nxt_task_t *task, void *obj, void *data) nxt_mp_free(mp, b); nxt_mp_release(mp); - if (parent != NULL) { - nxt_debug(task, "parent retain:%uD", parent->retain); - - parent->retain--; - - if (parent->retain == 0) { - parent->mem.pos = parent->mem.free; - - parent->completion_handler(task, parent, parent->parent); - } - } + nxt_buf_parent_completion(task, parent); } -- cgit From 57e326b4119863f737d8677adc69dc53c7e4ed27 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Thu, 14 Nov 2019 16:39:48 +0300 Subject: Introduced chained buffer completion handlers. --- src/nxt_buf.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'src/nxt_buf.c') diff --git a/src/nxt_buf.c b/src/nxt_buf.c index 2d52efca..af3f1243 100644 --- a/src/nxt_buf.c +++ b/src/nxt_buf.c @@ -195,7 +195,7 @@ static void nxt_buf_completion(nxt_task_t *task, void *obj, void *data) { nxt_mp_t *mp; - nxt_buf_t *b, *parent; + nxt_buf_t *b, *next, *parent; b = obj; parent = data; @@ -204,10 +204,17 @@ nxt_buf_completion(nxt_task_t *task, void *obj, void *data) nxt_assert(data == b->parent); - mp = b->data; - nxt_mp_free(mp, b); + do { + next = b->next; + parent = b->parent; + mp = b->data; - nxt_buf_parent_completion(task, parent); + nxt_mp_free(mp, b); + + nxt_buf_parent_completion(task, parent); + + b = next; + } while (b != NULL); } @@ -262,7 +269,7 @@ static void nxt_buf_ts_completion(nxt_task_t *task, void *obj, void *data) { nxt_mp_t *mp; - nxt_buf_t *b, *parent; + nxt_buf_t *b, *next, *parent; b = obj; parent = data; @@ -275,11 +282,18 @@ nxt_buf_ts_completion(nxt_task_t *task, void *obj, void *data) nxt_assert(data == b->parent); - mp = b->data; - nxt_mp_free(mp, b); - nxt_mp_release(mp); + do { + next = b->next; + parent = b->parent; + mp = b->data; + + nxt_mp_free(mp, b); + nxt_mp_release(mp); + + nxt_buf_parent_completion(task, parent); - nxt_buf_parent_completion(task, parent); + b = next; + } while (b != NULL); } -- cgit From 02e197e9782ca19bd668c37c11f529f802823868 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Thu, 14 Nov 2019 16:40:02 +0300 Subject: Processing inconsistent proxied response length. Keepalive connection is disabled if upstream response length differs from specified in the "Content-Length" field value. --- src/nxt_buf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/nxt_buf.c') diff --git a/src/nxt_buf.c b/src/nxt_buf.c index af3f1243..83be0fac 100644 --- a/src/nxt_buf.c +++ b/src/nxt_buf.c @@ -183,7 +183,10 @@ nxt_buf_chain_length(nxt_buf_t *b) length = 0; while (b != NULL) { - length += b->mem.free - b->mem.pos; + if (!nxt_buf_is_sync(b)) { + length += b->mem.free - b->mem.pos; + } + b = b->next; } -- cgit