Add test to check that max stream uni id limit is enforced
@@ -2333,6 +2333,29 @@ void test_ngtcp2_conn_recv_stream_data(void) {
ngtcp2_conn_del(conn);
+ /* Receive an unidirectional stream which is beyond the limit. */
+ setup_default_server(&conn);
+ conn->callbacks.recv_stream_data = recv_stream_data;
+ conn->max_remote_stream_id_uni = 0;
+ conn->user_data = &ud;
+
+ fr.type = NGTCP2_FRAME_STREAM;
+ fr.stream.stream_id = 2;
+ fr.stream.fin = 0;
+ fr.stream.offset = 0;
+ fr.stream.datalen = 911;
+ fr.stream.data = null_data;
+
+ pktlen = write_single_frame_pkt(conn, buf, sizeof(buf), conn->conn_id,
+ ++pkt_num, &fr);
+
+ memset(&ud, 0, sizeof(ud));
+ rv = ngtcp2_conn_recv(conn, buf, pktlen, ++t);
+
+ CU_ASSERT(NGTCP2_ERR_STREAM_ID == rv);
+
+ ngtcp2_conn_del(conn);
+
/* Receiving nonzero payload in an local unidirectional stream is an
error */
setup_default_client(&conn);
