Mercurial > hg > nginx
comparison src/event/ngx_event_quic.c @ 8212:e3c0b19a3a8a quic
Implemented ngx_quic_stream_send_chain() method.
- just call send in a loop
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Fri, 13 Mar 2020 15:56:10 +0300 |
parents | 6bc18966b8c1 |
children | 33a22e74101e |
comparison
equal
deleted
inserted
replaced
8211:6bc18966b8c1 | 8212:e3c0b19a3a8a |
---|---|
1981 | 1981 |
1982 static ngx_chain_t * | 1982 static ngx_chain_t * |
1983 ngx_quic_stream_send_chain(ngx_connection_t *c, ngx_chain_t *in, | 1983 ngx_quic_stream_send_chain(ngx_connection_t *c, ngx_chain_t *in, |
1984 off_t limit) | 1984 off_t limit) |
1985 { | 1985 { |
1986 // TODO | 1986 size_t len; |
1987 ssize_t n; | |
1988 ngx_buf_t *b; | |
1989 | |
1990 while (in) { | |
1991 b = in->buf; | |
1992 | |
1993 if (!ngx_buf_in_memory(b)) { | |
1994 continue; | |
1995 } | |
1996 | |
1997 if (ngx_buf_size(b) == 0) { | |
1998 continue; | |
1999 } | |
2000 | |
2001 len = b->last - b->pos; | |
2002 | |
2003 n = ngx_quic_stream_send(c, b->pos, len); | |
2004 | |
2005 if (n == NGX_ERROR) { | |
2006 return NGX_CHAIN_ERROR; | |
2007 } | |
2008 | |
2009 if (n == NGX_AGAIN) { | |
2010 return in; | |
2011 } | |
2012 | |
2013 if (n != (ssize_t) len) { | |
2014 b->pos += n; | |
2015 return in; | |
2016 } | |
2017 | |
2018 in = in->next; | |
2019 } | |
2020 | |
1987 return NULL; | 2021 return NULL; |
1988 } | 2022 } |
1989 | 2023 |
1990 | 2024 |
1991 /* process all payload from the current packet and generate ack if required */ | 2025 /* process all payload from the current packet and generate ack if required */ |