Mercurial > hg > nginx
comparison src/http/modules/ngx_http_grpc_module.c @ 7387:6afba58cd5a3 stable-1.14
gRPC: limited allocations due to ping and settings frames.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 06 Nov 2018 16:29:59 +0300 |
parents | 070c972336c4 |
children | ed5b3c4c1284 |
comparison
equal
deleted
inserted
replaced
7386:9200b41db765 | 7387:6afba58cd5a3 |
---|---|
75 ngx_chain_t *busy; | 75 ngx_chain_t *busy; |
76 | 76 |
77 ngx_http_grpc_conn_t *connection; | 77 ngx_http_grpc_conn_t *connection; |
78 | 78 |
79 ngx_uint_t id; | 79 ngx_uint_t id; |
80 | |
81 ngx_uint_t pings; | |
82 ngx_uint_t settings; | |
80 | 83 |
81 ssize_t send_window; | 84 ssize_t send_window; |
82 size_t recv_window; | 85 size_t recv_window; |
83 | 86 |
84 size_t rest; | 87 size_t rest; |
3529 "upstream sent settings frame " | 3532 "upstream sent settings frame " |
3530 "with invalid length: %uz", | 3533 "with invalid length: %uz", |
3531 ctx->rest); | 3534 ctx->rest); |
3532 return NGX_ERROR; | 3535 return NGX_ERROR; |
3533 } | 3536 } |
3537 | |
3538 if (ctx->free == NULL && ctx->settings++ > 1000) { | |
3539 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
3540 "upstream sent too many settings frames"); | |
3541 return NGX_ERROR; | |
3542 } | |
3534 } | 3543 } |
3535 | 3544 |
3536 for (p = b->pos; p < last; p++) { | 3545 for (p = b->pos; p < last; p++) { |
3537 ch = *p; | 3546 ch = *p; |
3538 | 3547 |
3679 } | 3688 } |
3680 | 3689 |
3681 if (ctx->flags & NGX_HTTP_V2_ACK_FLAG) { | 3690 if (ctx->flags & NGX_HTTP_V2_ACK_FLAG) { |
3682 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | 3691 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
3683 "upstream sent ping frame with ack flag"); | 3692 "upstream sent ping frame with ack flag"); |
3693 return NGX_ERROR; | |
3694 } | |
3695 | |
3696 if (ctx->free == NULL && ctx->pings++ > 1000) { | |
3697 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
3698 "upstream sent too many ping frames"); | |
3684 return NGX_ERROR; | 3699 return NGX_ERROR; |
3685 } | 3700 } |
3686 } | 3701 } |
3687 | 3702 |
3688 for (p = b->pos; p < last; p++) { | 3703 for (p = b->pos; p < last; p++) { |