Mercurial > hg > nginx-quic
annotate src/core/ngx_write_chain.c @ 134:d57c6835225c
nginx-0.0.1-2003-09-26-09:45:21 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 26 Sep 2003 05:45:21 +0000 |
parents | 36d2c25cc9bb |
children |
rev | line source |
---|---|
62
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
1 |
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
2 #include <ngx_config.h> |
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
3 |
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
4 #include <ngx_core.h> |
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
5 #include <ngx_types.h> |
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
6 #include <ngx_alloc.h> |
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
7 #include <ngx_array.h> |
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 #include <ngx_hunk.h> |
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
9 #include <ngx_connection.h> |
63
36d2c25cc9bb
nginx-0.0.1-2003-02-26-23:21:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
62
diff
changeset
|
10 |
62
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
11 |
63
36d2c25cc9bb
nginx-0.0.1-2003-02-26-23:21:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
62
diff
changeset
|
12 ngx_chain_t *(*ngx_write_chain_proc)(ngx_connection_t *c, ngx_chain_t *in); |
62
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
13 |
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
14 |
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
15 ngx_chain_t *ngx_write_chain(ngx_connection_t *c, ngx_chain_t *in, off_t flush) |
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
16 { |
63
36d2c25cc9bb
nginx-0.0.1-2003-02-26-23:21:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
62
diff
changeset
|
17 #if (NGX_EVENT) |
36d2c25cc9bb
nginx-0.0.1-2003-02-26-23:21:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
62
diff
changeset
|
18 |
36d2c25cc9bb
nginx-0.0.1-2003-02-26-23:21:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
62
diff
changeset
|
19 return (*ngx_write_chain_proc)(c, in); |
36d2c25cc9bb
nginx-0.0.1-2003-02-26-23:21:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
62
diff
changeset
|
20 |
36d2c25cc9bb
nginx-0.0.1-2003-02-26-23:21:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
62
diff
changeset
|
21 #elif (NGX_EVENT_THREAD) |
36d2c25cc9bb
nginx-0.0.1-2003-02-26-23:21:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
62
diff
changeset
|
22 |
62
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
23 off_t sent; |
63
36d2c25cc9bb
nginx-0.0.1-2003-02-26-23:21:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
62
diff
changeset
|
24 ngx_chain_t *rc; |
62
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
25 |
63
36d2c25cc9bb
nginx-0.0.1-2003-02-26-23:21:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
62
diff
changeset
|
26 sent = flush - c->sent; |
62
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
27 |
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
28 do { |
63
36d2c25cc9bb
nginx-0.0.1-2003-02-26-23:21:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
62
diff
changeset
|
29 rc = (*ngx_write_chain_proc)(c, in); |
62
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
30 |
63
36d2c25cc9bb
nginx-0.0.1-2003-02-26-23:21:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
62
diff
changeset
|
31 if (rc == NGX_CHAIN_ERROR && rc == NULL) { |
36d2c25cc9bb
nginx-0.0.1-2003-02-26-23:21:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
62
diff
changeset
|
32 return rc; |
62
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
33 } |
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
34 |
63
36d2c25cc9bb
nginx-0.0.1-2003-02-26-23:21:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
62
diff
changeset
|
35 } while (c->thread && flush > c->sent - sent); |
62
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
36 |
63
36d2c25cc9bb
nginx-0.0.1-2003-02-26-23:21:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
62
diff
changeset
|
37 #else |
62
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
38 |
63
36d2c25cc9bb
nginx-0.0.1-2003-02-26-23:21:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
62
diff
changeset
|
39 ngx_chain_t *rc; |
62
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
40 |
63
36d2c25cc9bb
nginx-0.0.1-2003-02-26-23:21:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
62
diff
changeset
|
41 do { |
62
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
42 |
63
36d2c25cc9bb
nginx-0.0.1-2003-02-26-23:21:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
62
diff
changeset
|
43 rc = (*ngx_write_chain_proc)(c, in); |
62
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
44 |
63
36d2c25cc9bb
nginx-0.0.1-2003-02-26-23:21:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
62
diff
changeset
|
45 } while (rc != NGX_CHAIN_ERROR && rc != NULL); |
62
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
46 |
63
36d2c25cc9bb
nginx-0.0.1-2003-02-26-23:21:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
62
diff
changeset
|
47 return rc; |
62
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
48 |
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
49 #endif |
8ccba41a678e
nginx-0.0.1-2003-02-12-09:55:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
50 } |