gRPC: limited allocations due to ping and settings frames.
Maxim Dounin
3 years ago
76 | 76 | ngx_http_grpc_conn_t *connection; |
77 | 77 | |
78 | 78 | ngx_uint_t id; |
79 | ||
80 | ngx_uint_t pings; | |
81 | ngx_uint_t settings; | |
79 | 82 | |
80 | 83 | ssize_t send_window; |
81 | 84 | size_t recv_window; |
3530 | 3533 | ctx->rest); |
3531 | 3534 | return NGX_ERROR; |
3532 | 3535 | } |
3536 | ||
3537 | if (ctx->free == NULL && ctx->settings++ > 1000) { | |
3538 | ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
3539 | "upstream sent too many settings frames"); | |
3540 | return NGX_ERROR; | |
3541 | } | |
3533 | 3542 | } |
3534 | 3543 | |
3535 | 3544 | for (p = b->pos; p < last; p++) { |
3680 | 3689 | if (ctx->flags & NGX_HTTP_V2_ACK_FLAG) { |
3681 | 3690 | ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, |
3682 | 3691 | "upstream sent ping frame with ack flag"); |
3692 | return NGX_ERROR; | |
3693 | } | |
3694 | ||
3695 | if (ctx->free == NULL && ctx->pings++ > 1000) { | |
3696 | ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
3697 | "upstream sent too many ping frames"); | |
3683 | 3698 | return NGX_ERROR; |
3684 | 3699 | } |
3685 | 3700 | } |