comparison src/stream/ngx_stream_proxy_module.c @ 7441:8acaa1161783

Stream: do not split datagrams when limiting proxy rate. Previously, when using proxy_upload_rate and proxy_download_rate, the buffer size for reading from a socket could be reduced as a result of rate limiting. For connection-oriented protocols this behavior is normal since unread data will normally be read at the next iteration. But for datagram-oriented protocols this is not the case, and unread part of the datagram is lost. Now buffer size is not limited for datagrams. Rate limiting still works in this case by delaying the next reading event.
author Roman Arutyunyan <arut@nginx.com>
date Thu, 27 Dec 2018 19:37:34 +0300
parents 6d4bc025c5a7
children 8981dbb12254
comparison
equal deleted inserted replaced
7440:6d4bc025c5a7 7441:8acaa1161783
1591 delay = (ngx_msec_t) (- limit * 1000 / limit_rate + 1); 1591 delay = (ngx_msec_t) (- limit * 1000 / limit_rate + 1);
1592 ngx_add_timer(src->read, delay); 1592 ngx_add_timer(src->read, delay);
1593 break; 1593 break;
1594 } 1594 }
1595 1595
1596 if ((off_t) size > limit) { 1596 if (c->type == SOCK_STREAM && (off_t) size > limit) {
1597 size = (size_t) limit; 1597 size = (size_t) limit;
1598 } 1598 }
1599 } 1599 }
1600 1600
1601 c->log->action = recv_action; 1601 c->log->action = recv_action;