Mercurial > hg > nginx
comparison src/event/quic/ngx_event_quic.c @ 8994:e00295b76395 quic
QUIC: revised ngx_quic_handle_datagram() error codes.
The NGX_DECLINED is replaced with NGX_DONE to match closer to return code
of ngx_quic_handle_packet() and ngx_quic_close_connection() rc argument.
The ngx_quic_close_connection() rc code is used only when quic connection
exists, thus anything goes if qc == NULL.
The ngx_quic_handle_datagram() does not return NG_OK in cases when quic
connection is not yet created.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Tue, 01 Feb 2022 14:35:31 +0300 |
parents | 55359b950132 |
children | 19251fb83187 |
comparison
equal
deleted
inserted
replaced
8993:7626aa7a2156 | 8994:e00295b76395 |
---|---|
208 | 208 |
209 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, "quic run"); | 209 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, "quic run"); |
210 | 210 |
211 rc = ngx_quic_handle_datagram(c, c->buffer, conf); | 211 rc = ngx_quic_handle_datagram(c, c->buffer, conf); |
212 if (rc != NGX_OK) { | 212 if (rc != NGX_OK) { |
213 ngx_quic_close_connection(c, rc == NGX_DECLINED ? NGX_DONE : NGX_ERROR); | 213 ngx_quic_close_connection(c, rc); |
214 return; | 214 return; |
215 } | 215 } |
216 | 216 |
217 /* quic connection is now created */ | |
217 qc = ngx_quic_get_connection(c); | 218 qc = ngx_quic_get_connection(c); |
218 | |
219 if (qc == NULL) { | |
220 ngx_quic_close_connection(c, NGX_DONE); | |
221 return; | |
222 } | |
223 | 219 |
224 ngx_add_timer(c->read, qc->tp.max_idle_timeout); | 220 ngx_add_timer(c->read, qc->tp.max_idle_timeout); |
225 ngx_quic_connstate_dbg(c); | 221 ngx_quic_connstate_dbg(c); |
226 | 222 |
227 c->read->handler = ngx_quic_input_handler; | 223 c->read->handler = ngx_quic_input_handler; |
441 if (rc == NGX_ERROR) { | 437 if (rc == NGX_ERROR) { |
442 ngx_quic_close_connection(c, NGX_ERROR); | 438 ngx_quic_close_connection(c, NGX_ERROR); |
443 return; | 439 return; |
444 } | 440 } |
445 | 441 |
446 if (rc == NGX_DECLINED) { | 442 if (rc == NGX_DONE) { |
447 return; | 443 return; |
448 } | 444 } |
449 | 445 |
450 /* rc == NGX_OK */ | 446 /* rc == NGX_OK */ |
451 | 447 |
707 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, | 703 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, |
708 "quic packet done parse failed rc:%i", rc); | 704 "quic packet done parse failed rc:%i", rc); |
709 } | 705 } |
710 #endif | 706 #endif |
711 | 707 |
712 if (rc == NGX_ERROR) { | 708 if (rc == NGX_ERROR || rc == NGX_DONE) { |
713 return NGX_ERROR; | 709 return rc; |
714 } | |
715 | |
716 if (rc == NGX_DONE) { | |
717 /* stop further processing */ | |
718 return NGX_DECLINED; | |
719 } | 710 } |
720 | 711 |
721 if (rc == NGX_OK) { | 712 if (rc == NGX_OK) { |
722 good = 1; | 713 good = 1; |
723 } | 714 } |
748 | 739 |
749 p = b->pos; | 740 p = b->pos; |
750 } | 741 } |
751 | 742 |
752 if (!good) { | 743 if (!good) { |
753 return NGX_DECLINED; | 744 return NGX_DONE; |
754 } | 745 } |
755 | 746 |
756 qc = ngx_quic_get_connection(c); | 747 qc = ngx_quic_get_connection(c); |
757 | 748 |
758 if (qc) { | 749 if (qc) { |