mirror of
https://github.com/nginx/nginx.git
synced 2024-12-12 10:19:00 +08:00
Implemented eof in QUIC streams.
This commit is contained in:
parent
c5505648d7
commit
061a42d966
@ -1079,6 +1079,10 @@ ngx_quic_handle_stream_frame(ngx_connection_t *c,
|
|||||||
rev = sn->c->read;
|
rev = sn->c->read;
|
||||||
rev->ready = 1;
|
rev->ready = 1;
|
||||||
|
|
||||||
|
if (f->fin) {
|
||||||
|
rev->pending_eof = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (rev->active) {
|
if (rev->active) {
|
||||||
rev->handler(rev);
|
rev->handler(rev);
|
||||||
}
|
}
|
||||||
@ -1546,6 +1550,7 @@ ngx_quic_stream_recv(ngx_connection_t *c, u_char *buf, size_t size)
|
|||||||
{
|
{
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
ngx_buf_t *b;
|
ngx_buf_t *b;
|
||||||
|
ngx_event_t *rev;
|
||||||
ngx_quic_stream_t *qs;
|
ngx_quic_stream_t *qs;
|
||||||
ngx_quic_connection_t *qc;
|
ngx_quic_connection_t *qc;
|
||||||
ngx_quic_stream_node_t *sn;
|
ngx_quic_stream_node_t *sn;
|
||||||
@ -1560,12 +1565,22 @@ ngx_quic_stream_recv(ngx_connection_t *c, u_char *buf, size_t size)
|
|||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX: how to return EOF?
|
rev = c->read;
|
||||||
|
|
||||||
b = sn->b;
|
b = sn->b;
|
||||||
|
|
||||||
|
ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0,
|
||||||
|
"quic recv: eof:%d, avail:%z",
|
||||||
|
rev->pending_eof, b->last - b->pos);
|
||||||
|
|
||||||
if (b->pos == b->last) {
|
if (b->pos == b->last) {
|
||||||
c->read->ready = 0;
|
rev->ready = 0;
|
||||||
|
|
||||||
|
if (rev->pending_eof) {
|
||||||
|
rev->eof = 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, "quic recv() not ready");
|
ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, "quic recv() not ready");
|
||||||
return NGX_AGAIN;
|
return NGX_AGAIN;
|
||||||
}
|
}
|
||||||
@ -1579,10 +1594,11 @@ ngx_quic_stream_recv(ngx_connection_t *c, u_char *buf, size_t size)
|
|||||||
if (b->pos == b->last) {
|
if (b->pos == b->last) {
|
||||||
b->pos = b->start;
|
b->pos = b->start;
|
||||||
b->last = b->start;
|
b->last = b->start;
|
||||||
|
rev->ready = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0,
|
ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0,
|
||||||
"quic recv: %z of %uz", len, size);
|
"quic recv: %z of %uz", len, size);
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user