summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2020-03-13 15:56:10 +0300
committerRoman Arutyunyan <arut@nginx.com>2020-03-13 15:56:10 +0300
commitdcb6aab4609f440940d1aac1fb55cf211c760c62 (patch)
tree7ebd37a4522e3960f3a98fe758fa2c47205b30fe /src
parent05d1464c68a269e2f6ed08b5559edb90dfd3ab1f (diff)
downloadnginx-dcb6aab4609f440940d1aac1fb55cf211c760c62.tar.gz
nginx-dcb6aab4609f440940d1aac1fb55cf211c760c62.tar.bz2
Implemented ngx_quic_stream_send_chain() method.
- just call send in a loop
Diffstat (limited to 'src')
-rw-r--r--src/event/ngx_event_quic.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/event/ngx_event_quic.c b/src/event/ngx_event_quic.c
index ee77d9153..e4d4f88e9 100644
--- a/src/event/ngx_event_quic.c
+++ b/src/event/ngx_event_quic.c
@@ -1983,7 +1983,41 @@ static ngx_chain_t *
ngx_quic_stream_send_chain(ngx_connection_t *c, ngx_chain_t *in,
off_t limit)
{
- // TODO
+ size_t len;
+ ssize_t n;
+ ngx_buf_t *b;
+
+ while (in) {
+ b = in->buf;
+
+ if (!ngx_buf_in_memory(b)) {
+ continue;
+ }
+
+ if (ngx_buf_size(b) == 0) {
+ continue;
+ }
+
+ len = b->last - b->pos;
+
+ n = ngx_quic_stream_send(c, b->pos, len);
+
+ if (n == NGX_ERROR) {
+ return NGX_CHAIN_ERROR;
+ }
+
+ if (n == NGX_AGAIN) {
+ return in;
+ }
+
+ if (n != (ssize_t) len) {
+ b->pos += n;
+ return in;
+ }
+
+ in = in->next;
+ }
+
return NULL;
}