c63dfc
diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c
c63dfc
index 3b7f892..0aaea47 100644
c63dfc
--- a/src/http/v2/ngx_http_v2.c
c63dfc
+++ b/src/http/v2/ngx_http_v2.c
c63dfc
@@ -275,6 +275,7 @@ ngx_http_v2_init(ngx_event_t *rev)
c63dfc
     h2scf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_v2_module);
c63dfc
 
c63dfc
     h2c->concurrent_pushes = h2scf->concurrent_pushes;
c63dfc
+    h2c->priority_limit = h2scf->concurrent_streams;
c63dfc
 
c63dfc
     h2c->pool = ngx_create_pool(h2scf->pool_size, h2c->connection->log);
c63dfc
     if (h2c->pool == NULL) {
c63dfc
@@ -1798,6 +1799,13 @@ ngx_http_v2_state_priority(ngx_http_v2_connection_t *h2c, u_char *pos,
c63dfc
         return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_SIZE_ERROR);
c63dfc
     }
c63dfc
 
c63dfc
+    if (--h2c->priority_limit == 0) {
c63dfc
+        ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0,
c63dfc
+                      "client sent too many PRIORITY frames");
c63dfc
+
c63dfc
+        return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_ENHANCE_YOUR_CALM);
c63dfc
+    }
c63dfc
+
c63dfc
     if (end - pos < NGX_HTTP_V2_PRIORITY_SIZE) {
c63dfc
         return ngx_http_v2_state_save(h2c, pos, end,
c63dfc
                                       ngx_http_v2_state_priority);
c63dfc
@@ -3112,6 +3120,8 @@ ngx_http_v2_create_stream(ngx_http_v2_connection_t *h2c, ngx_uint_t push)
c63dfc
         h2c->processing++;
c63dfc
     }
c63dfc
 
c63dfc
+    h2c->priority_limit += h2scf->concurrent_streams;
c63dfc
+
c63dfc
     return stream;
c63dfc
 }
c63dfc
 
c63dfc
diff --git a/src/http/v2/ngx_http_v2.h b/src/http/v2/ngx_http_v2.h
c63dfc
index 715b7d3..69d55d1 100644
c63dfc
--- a/src/http/v2/ngx_http_v2.h
c63dfc
+++ b/src/http/v2/ngx_http_v2.h
c63dfc
@@ -122,6 +122,7 @@ struct ngx_http_v2_connection_s {
c63dfc
     ngx_uint_t                       processing;
c63dfc
     ngx_uint_t                       frames;
c63dfc
     ngx_uint_t                       idle;
c63dfc
+    ngx_uint_t                       priority_limit;
c63dfc
 
c63dfc
     ngx_uint_t                       pushing;
c63dfc
     ngx_uint_t                       concurrent_pushes;