quiche_conn_stream_send returns QUICHE_ERR_INVALID_STREAM_STATE (-7)
dbaldassi opened this issue Ā· comments
I get the -7 error when trying to send in a new stream.
I started from the example c client. When I send a first request with the id 4, it works, but then I want to send data in concurrent stream, so I increment the stream id, and it fails with -7 error. Sometimes, it works for specific stream id, but mostly fails.
Here is my code:
if (int err = quiche_conn_stream_send(_conn, _stream_id, (const uint8_t*)buffer, len, true); err < 0) {
fmt::print("failed to send HTTP request {}\n", err);
}
else {
fmt::print("successfully sent id\n\n");
flush_egress(_loop, conn_io);
}
_stream_id++;
And my config :
quiche_config_set_max_recv_udp_payload_size(_config, MAX_DATAGRAM_SIZE);
quiche_config_set_max_send_udp_payload_size(_config, MAX_DATAGRAM_SIZE);
quiche_config_set_initial_max_data(_config, 10000000);
quiche_config_set_initial_max_stream_data_bidi_local(_config, 1000000);
quiche_config_set_initial_max_stream_data_bidi_remote(_config, 1000000);
quiche_config_set_initial_max_streams_bidi(_config, 100);
quiche_config_set_initial_max_streams_uni(_config, 100);
quiche_config_set_cc_algorithm(_config, QUICHE_CC_RENO);
Is there a specific way to create or initialise a stream ? From what i understood, it should be created automatically when sending.
I tried to get the next id available with quiche_conn_stream_writable
but it returns me -1
Look like you're misusing stream IDs by doing ++
. Request streams must be of type client-initiated bidirectional; see https://datatracker.ietf.org/doc/html/rfc9000#section-2.1
It was indeed the issue, thank you
uint64_t id = (_stream_id << 2) | 0x02;
quiche_conn_stream_send(_conn, id, (const uint8_t*)buffer, len, true);
flush_egress(_loop, conn_io);
++_stream_id;