Mercurial > hg > nginx
comparison src/http/modules/ngx_http_grpc_module.c @ 7379:57463f4e2fcd
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 | 8b68d50090e4 |
children | 8981dbb12254 |
comparison
equal
deleted
inserted
replaced
7378:e7f19d268c72 | 7379:57463f4e2fcd |
---|---|
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; |
3582 "upstream sent settings frame " | 3585 "upstream sent settings frame " |
3583 "with invalid length: %uz", | 3586 "with invalid length: %uz", |
3584 ctx->rest); | 3587 ctx->rest); |
3585 return NGX_ERROR; | 3588 return NGX_ERROR; |
3586 } | 3589 } |
3590 | |
3591 if (ctx->free == NULL && ctx->settings++ > 1000) { | |
3592 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
3593 "upstream sent too many settings frames"); | |
3594 return NGX_ERROR; | |
3595 } | |
3587 } | 3596 } |
3588 | 3597 |
3589 for (p = b->pos; p < last; p++) { | 3598 for (p = b->pos; p < last; p++) { |
3590 ch = *p; | 3599 ch = *p; |
3591 | 3600 |
3732 } | 3741 } |
3733 | 3742 |
3734 if (ctx->flags & NGX_HTTP_V2_ACK_FLAG) { | 3743 if (ctx->flags & NGX_HTTP_V2_ACK_FLAG) { |
3735 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | 3744 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
3736 "upstream sent ping frame with ack flag"); | 3745 "upstream sent ping frame with ack flag"); |
3746 return NGX_ERROR; | |
3747 } | |
3748 | |
3749 if (ctx->free == NULL && ctx->pings++ > 1000) { | |
3750 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
3751 "upstream sent too many ping frames"); | |
3737 return NGX_ERROR; | 3752 return NGX_ERROR; |
3738 } | 3753 } |
3739 } | 3754 } |
3740 | 3755 |
3741 for (p = b->pos; p < last; p++) { | 3756 for (p = b->pos; p < last; p++) { |