Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2014-08-13 15:11:45 +0400
committerValentin Bartenev <vbart@nginx.com>2014-08-13 15:11:45 +0400
commit4aac91049f8909e928580f9fb8b752ba748f4167 (patch)
tree3100acd79e0cf9e317878113207b0e942705a88c /src/core/ngx_buf.c
parent8b6f1c7bb064aa87ab83fbf3d8ed9f9e80e1b06b (diff)
Moved the code for adjusting sent buffers in a separate function.
Diffstat (limited to 'src/core/ngx_buf.c')
-rw-r--r--src/core/ngx_buf.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/core/ngx_buf.c b/src/core/ngx_buf.c
index 835c76ced..94a3d3f10 100644
--- a/src/core/ngx_buf.c
+++ b/src/core/ngx_buf.c
@@ -218,3 +218,49 @@ ngx_chain_update_chains(ngx_pool_t *p, ngx_chain_t **free, ngx_chain_t **busy,
*free = cl;
}
}
+
+
+ngx_chain_t *
+ngx_handle_sent_chain(ngx_chain_t *in, off_t sent)
+{
+ off_t size;
+
+ for ( /* void */ ; in; in = in->next) {
+
+ if (ngx_buf_special(in->buf)) {
+ continue;
+ }
+
+ if (sent == 0) {
+ break;
+ }
+
+ size = ngx_buf_size(in->buf);
+
+ if (sent >= size) {
+ sent -= size;
+
+ if (ngx_buf_in_memory(in->buf)) {
+ in->buf->pos = in->buf->last;
+ }
+
+ if (in->buf->in_file) {
+ in->buf->file_pos = in->buf->file_last;
+ }
+
+ continue;
+ }
+
+ if (ngx_buf_in_memory(in->buf)) {
+ in->buf->pos += (size_t) sent;
+ }
+
+ if (in->buf->in_file) {
+ in->buf->file_pos += sent;
+ }
+
+ break;
+ }
+
+ return in;
+}