Release 2.14.3

- [BUGFIX] gQUIC: pass correct stream to hsi_create_header_set() callback.
- [BUGFIX] Use ls-hpack 2.1.1
- Improve stream code readability.
- Use ls-qpack 2.0.5
This commit is contained in:
Dmitri Tikhonov 2020-04-15 09:30:40 -04:00
parent 7ae4a10d41
commit 08c45823bc
14 changed files with 297 additions and 49 deletions

@ -1 +1 @@
Subproject commit 5b9001252447c26f861f4b1979c677272c7b541c
Subproject commit 451bbc6c710e058e1a409efb7bf45beac6767030

View file

@ -156,6 +156,10 @@ struct conn_iface
int
(*ci_is_push_enabled) (struct lsquic_conn *);
/* Optional: only used by gQUIC frames reader */
struct lsquic_stream *
(*ci_get_stream_by_id) (struct lsquic_conn *, lsquic_stream_id_t stream_id);
struct lsquic_engine *
(*ci_get_engine) (struct lsquic_conn *);

View file

@ -509,6 +509,21 @@ skip_headers_padding (struct lsquic_frame_reader *fr)
}
static struct lsquic_stream *
find_target_stream (const struct lsquic_frame_reader *fr)
{
lsquic_stream_id_t stream_id;
struct lsquic_conn *lconn;
stream_id = fr_get_stream_id(fr);
lconn = lsquic_stream_conn(fr->fr_stream);
if (lconn->cn_if->ci_get_stream_by_id)
return lconn->cn_if->ci_get_stream_by_id(lconn, stream_id);
return NULL;
}
static int
decode_and_pass_payload (struct lsquic_frame_reader *fr)
{
@ -521,8 +536,11 @@ decode_and_pass_payload (struct lsquic_frame_reader *fr)
void *hset = NULL;
struct lsxpack_header *hdr = NULL;
size_t req_space = 0;
lsquic_stream_t *target_stream = NULL;
hset = fr->fr_hsi_if->hsi_create_header_set(fr->fr_hsi_ctx, fr->fr_stream,
if (!(fr->fr_flags & FRF_SERVER))
target_stream = find_target_stream(fr);
hset = fr->fr_hsi_if->hsi_create_header_set(fr->fr_hsi_ctx, target_stream,
READER_PUSH_PROMISE == fr->fr_state.reader_type);
if (!hset)
{

View file

@ -1407,6 +1407,15 @@ find_stream_by_id (struct full_conn *conn, lsquic_stream_id_t stream_id)
}
static struct lsquic_stream *
full_conn_ci_get_stream_by_id (struct lsquic_conn *lconn,
lsquic_stream_id_t stream_id)
{
struct full_conn *conn = (struct full_conn *) lconn;
return find_stream_by_id(conn, stream_id);
}
static struct lsquic_engine *
full_conn_ci_get_engine (struct lsquic_conn *lconn)
{
@ -4324,6 +4333,7 @@ static const struct conn_iface full_conn_iface = {
.ci_close = full_conn_ci_close,
.ci_destroy = full_conn_ci_destroy,
.ci_get_ctx = full_conn_ci_get_ctx,
.ci_get_stream_by_id = full_conn_ci_get_stream_by_id,
.ci_get_engine = full_conn_ci_get_engine,
.ci_get_path = full_conn_ci_get_path,
#if LSQUIC_CONN_STATS

View file

@ -1276,15 +1276,7 @@ stream_consumed_bytes (struct lsquic_stream *stream)
}
struct read_frames_status
{
int error;
int processed_frames;
size_t total_nread;
};
static struct read_frames_status
static ssize_t
read_data_frames (struct lsquic_stream *stream, int do_filtering,
size_t (*readf)(void *, const unsigned char *, size_t, int), void *ctx)
{
@ -1335,7 +1327,7 @@ read_data_frames (struct lsquic_stream *stream, int do_filtering,
if (!stream->data_in)
{
stream->data_in = lsquic_data_in_error_new();
return (struct read_frames_status) { .error = 1, };
return -1;
}
}
if (fin)
@ -1356,11 +1348,7 @@ read_data_frames (struct lsquic_stream *stream, int do_filtering,
if (processed_frames)
stream_consumed_bytes(stream);
return (struct read_frames_status) {
.error = 0,
.processed_frames = processed_frames,
.total_nread = total_nread,
};
return total_nread;
}
@ -1368,8 +1356,8 @@ static ssize_t
stream_readf (struct lsquic_stream *stream,
size_t (*readf)(void *, const unsigned char *, size_t, int), void *ctx)
{
size_t total_nread, nread;
int read_unc_headers;
size_t total_nread;
ssize_t nread;
total_nread = 0;
@ -1399,9 +1387,7 @@ stream_readf (struct lsquic_stream *stream,
{
if (stream->uh->uh_flags & UH_H1H)
{
nread = read_uh(stream, readf, ctx);
read_unc_headers = nread > 0;
total_nread += nread;
total_nread += read_uh(stream, readf, ctx);
if (stream->uh)
return total_nread;
}
@ -1418,25 +1404,22 @@ stream_readf (struct lsquic_stream *stream,
errno = EWOULDBLOCK;
return -1;
}
else
read_unc_headers = 0;
const struct read_frames_status rfs
= read_data_frames(stream, 1, readf, ctx);
if (rfs.error)
return -1;
total_nread += rfs.total_nread;
nread = read_data_frames(stream, 1, readf, ctx);
if (nread < 0)
return nread;
total_nread += (size_t) nread;
LSQ_DEBUG("%s: read %zd bytes, read offset %"PRIu64, __func__,
total_nread, stream->read_offset);
LSQ_DEBUG("%s: read %zd bytes, read offset %"PRIu64", reached fin: %d",
__func__, total_nread, stream->read_offset,
!!(stream->stream_flags & STREAM_FIN_REACHED));
if (rfs.processed_frames || read_unc_headers)
{
if (total_nread)
return total_nread;
}
else if (stream->stream_flags & STREAM_FIN_REACHED)
return 0;
else
{
assert(0 == total_nread);
errno = EWOULDBLOCK;
return -1;
}
@ -4342,17 +4325,17 @@ static int
hq_filter_readable (struct lsquic_stream *stream)
{
struct hq_filter *const filter = &stream->sm_hq_filter;
struct read_frames_status rfs;
ssize_t nread;
if (filter->hqfi_flags & HQFI_FLAG_BLOCKED)
return 0;
if (!hq_filter_readable_now(stream))
{
rfs = read_data_frames(stream, 0, hq_read, stream);
if (rfs.total_nread == 0)
nread = read_data_frames(stream, 0, hq_read, stream);
if (nread <= 0)
{
if (rfs.error)
if (nread < 0)
{
filter->hqfi_flags |= HQFI_FLAG_ERROR;
abort_connection(stream); /* XXX Overkill? */

@ -1 +1 @@
Subproject commit f209bb5e9af8dbb14c22b214519c8ea5ebaecb5d
Subproject commit 8d4b795ff661e73e10b7d46ce06cba3b88499769