comparison src/event/quic/ngx_event_quic_streams.c @ 8890:b4c7853b0488 quic

QUIC: added shutdown support in stream proxy.
author Vladimir Homutov <vl@nginx.com>
date Thu, 23 Sep 2021 16:25:49 +0300
parents 66b4ff373dd9
children 832723a49026
comparison
equal deleted inserted replaced
8889:61d0fa67b55e 8890:b4c7853b0488
250 250
251 return NGX_OK; 251 return NGX_OK;
252 } 252 }
253 253
254 254
255 ngx_int_t
256 ngx_quic_shutdown_stream(ngx_connection_t *c, int how)
257 {
258 ngx_event_t *wev;
259 ngx_connection_t *pc;
260 ngx_quic_frame_t *frame;
261 ngx_quic_stream_t *qs;
262 ngx_quic_connection_t *qc;
263
264 if (how != NGX_WRITE_SHUTDOWN) {
265 return NGX_OK;
266 }
267
268 wev = c->write;
269
270 if (wev->error) {
271 return NGX_OK;
272 }
273
274 qs = c->quic;
275 pc = qs->parent;
276 qc = ngx_quic_get_connection(pc);
277
278 frame = ngx_quic_alloc_frame(pc);
279 if (frame == NULL) {
280 return NGX_ERROR;
281 }
282
283 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0,
284 "quic stream id:0x%xL shutdown", qs->id);
285
286 frame->level = ssl_encryption_application;
287 frame->type = NGX_QUIC_FT_STREAM;
288 frame->u.stream.off = 1;
289 frame->u.stream.len = 1;
290 frame->u.stream.fin = 1;
291
292 frame->u.stream.stream_id = qs->id;
293 frame->u.stream.offset = c->sent;
294 frame->u.stream.length = 0;
295
296 ngx_quic_queue_frame(qc, frame);
297
298 wev->ready = 1;
299 wev->error = 1;
300
301 return NGX_OK;
302 }
303
304
255 static ngx_quic_stream_t * 305 static ngx_quic_stream_t *
256 ngx_quic_create_client_stream(ngx_connection_t *c, uint64_t id) 306 ngx_quic_create_client_stream(ngx_connection_t *c, uint64_t id)
257 { 307 {
258 uint64_t min_id; 308 uint64_t min_id;
259 ngx_quic_stream_t *qs; 309 ngx_quic_stream_t *qs;