summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_buf.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2019-11-14 16:39:48 +0300
committerIgor Sysoev <igor@sysoev.ru>2019-11-14 16:39:48 +0300
commit57e326b4119863f737d8677adc69dc53c7e4ed27 (patch)
treef80e27a6ea8ed77bbfa8d94ce5c3b98b42e5188b /src/nxt_buf.c
parent643c433f8eb72cfe7d29d4f624888df646480477 (diff)
downloadunit-57e326b4119863f737d8677adc69dc53c7e4ed27.tar.gz
unit-57e326b4119863f737d8677adc69dc53c7e4ed27.tar.bz2
Introduced chained buffer completion handlers.
Diffstat (limited to 'src/nxt_buf.c')
-rw-r--r--src/nxt_buf.c32
1 files changed, 23 insertions, 9 deletions
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);
}