comparison src/event/quic/ngx_event_quic_migration.c @ 9146:f3412ec3b6d1

QUIC: allowed ngx_quic_frame_sendto() to return NGX_AGAIN. Previously, NGX_AGAIN returned by ngx_quic_send() was treated by ngx_quic_frame_sendto() as error, which triggered errors in its callers. However, a blocked socket is not an error. Now NGX_AGAIN is passed as is to the ngx_quic_frame_sendto() callers, which can safely ignore it.
author Roman Arutyunyan <arut@nginx.com>
date Tue, 08 Aug 2023 10:43:17 +0400
parents bba136612fe4
children 58afcd72446f
comparison
equal deleted inserted replaced
9145:93aee926d27f 9146:f3412ec3b6d1
44 44
45 /* 45 /*
46 * An endpoint MUST expand datagrams that contain a PATH_RESPONSE frame 46 * An endpoint MUST expand datagrams that contain a PATH_RESPONSE frame
47 * to at least the smallest allowed maximum datagram size of 1200 bytes. 47 * to at least the smallest allowed maximum datagram size of 1200 bytes.
48 */ 48 */
49 if (ngx_quic_frame_sendto(c, &frame, 1200, pkt->path) != NGX_OK) { 49 if (ngx_quic_frame_sendto(c, &frame, 1200, pkt->path) == NGX_ERROR) {
50 return NGX_ERROR; 50 return NGX_ERROR;
51 } 51 }
52 52
53 if (pkt->path == qc->path) { 53 if (pkt->path == qc->path) {
54 /* 54 /*
542 * unless the anti-amplification limit for the path does not permit 542 * unless the anti-amplification limit for the path does not permit
543 * sending a datagram of this size. 543 * sending a datagram of this size.
544 */ 544 */
545 545
546 /* same applies to PATH_RESPONSE frames */ 546 /* same applies to PATH_RESPONSE frames */
547 if (ngx_quic_frame_sendto(c, &frame, 1200, path) != NGX_OK) { 547 if (ngx_quic_frame_sendto(c, &frame, 1200, path) == NGX_ERROR) {
548 return NGX_ERROR; 548 return NGX_ERROR;
549 } 549 }
550 550
551 ngx_memcpy(frame.u.path_challenge.data, path->challenge2, 8); 551 ngx_memcpy(frame.u.path_challenge.data, path->challenge2, 8);
552 552
553 if (ngx_quic_frame_sendto(c, &frame, 1200, path) != NGX_OK) { 553 if (ngx_quic_frame_sendto(c, &frame, 1200, path) == NGX_ERROR) {
554 return NGX_ERROR; 554 return NGX_ERROR;
555 } 555 }
556 556
557 return NGX_OK; 557 return NGX_OK;
558 } 558 }