comparison src/event/ngx_event.c @ 8855:9ae239d2547d quic

QUIC: separate event handling functions. The functions ngx_quic_handle_read_event() and ngx_quic_handle_write_event() are added. Previously this code was a part of ngx_handle_read_event() and ngx_handle_write_event(). The change simplifies ngx_handle_read_event() and ngx_handle_write_event() by moving QUIC-related code to a QUIC source file.
author Roman Arutyunyan <arut@nginx.com>
date Thu, 09 Sep 2021 16:55:00 +0300
parents 6674a50cbb6c
children c31d95fdaf65
comparison
equal deleted inserted replaced
8854:7416d3b2fac5 8855:9ae239d2547d
271 ngx_connection_t *c; 271 ngx_connection_t *c;
272 272
273 c = rev->data; 273 c = rev->data;
274 274
275 if (c->quic) { 275 if (c->quic) {
276 276 return ngx_quic_handle_read_event(rev, flags);
277 if (!rev->active && !rev->ready) {
278 rev->active = 1;
279
280 } else if (rev->active && (rev->ready || (flags & NGX_CLOSE_EVENT))) {
281 rev->active = 0;
282 }
283
284 return NGX_OK;
285 } 277 }
286 278
287 #endif 279 #endif
288 280
289 if (ngx_event_flags & NGX_USE_CLEAR_EVENT) { 281 if (ngx_event_flags & NGX_USE_CLEAR_EVENT) {
356 { 348 {
357 ngx_connection_t *c; 349 ngx_connection_t *c;
358 350
359 c = wev->data; 351 c = wev->data;
360 352
353 #if (NGX_QUIC)
354 if (c->quic) {
355 return ngx_quic_handle_write_event(wev, lowat);
356 }
357 #endif
358
361 if (lowat) { 359 if (lowat) {
362 if (ngx_send_lowat(c, lowat) == NGX_ERROR) { 360 if (ngx_send_lowat(c, lowat) == NGX_ERROR) {
363 return NGX_ERROR; 361 return NGX_ERROR;
364 } 362 }
365 } 363 }
366
367 #if (NGX_QUIC)
368
369 if (c->quic) {
370
371 if (!wev->active && !wev->ready) {
372 wev->active = 1;
373
374 } else if (wev->active && wev->ready) {
375 wev->active = 0;
376 }
377
378 return NGX_OK;
379 }
380
381 #endif
382 364
383 if (ngx_event_flags & NGX_USE_CLEAR_EVENT) { 365 if (ngx_event_flags & NGX_USE_CLEAR_EVENT) {
384 366
385 /* kqueue, epoll */ 367 /* kqueue, epoll */
386 368