Skip to content

Commit 0a19f39

Browse files
author
Dmitri Tikhonov
committed
Release 1.15.0
- [API Change] Add LSCONN_ST_PEER_GOING_AWAY to the list of conn statuses - [BUGFIX] free uncompressed headers correctly when error occurs
1 parent 3229dd1 commit 0a19f39

File tree

3 files changed

+33
-14
lines changed

3 files changed

+33
-14
lines changed

CHANGELOG

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2018-09-27
2+
- 1.15.0
3+
- [API Change] Add LSCONN_ST_PEER_GOING_AWAY to the list of conn statuses
4+
- [BUGFIX] free uncompressed headers correctly when error occurs
5+
16
2018-09-12
27
- 1.14.3
38
- [BUGFIX] Do not abort conn on STREAM frame for a reset stream

include/lsquic.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ extern "C" {
2424
#endif
2525

2626
#define LSQUIC_MAJOR_VERSION 1
27-
#define LSQUIC_MINOR_VERSION 14
28-
#define LSQUIC_PATCH_VERSION 3
27+
#define LSQUIC_MINOR_VERSION 15
28+
#define LSQUIC_PATCH_VERSION 0
2929

3030
/**
3131
* Engine flags:
@@ -1052,6 +1052,7 @@ enum LSQUIC_CONN_STATUS
10521052
LSCONN_ST_USER_ABORTED,
10531053
LSCONN_ST_ERROR,
10541054
LSCONN_ST_CLOSED,
1055+
LSCONN_ST_PEER_GOING_AWAY,
10551056
};
10561057

10571058
enum LSQUIC_CONN_STATUS

src/liblsquic/lsquic_full_conn.c

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3300,19 +3300,29 @@ headers_stream_on_incoming_headers (void *ctx, struct uncompressed_headers *uh)
33003300
stream = find_stream_on_non_stream_frame(conn, uh->uh_stream_id, 0,
33013301
"headers");
33023302
if (!stream)
3303+
goto free_uh;
3304+
3305+
if (lsquic_stream_is_reset(stream))
33033306
{
3304-
free(uh);
3305-
return;
3307+
LSQ_DEBUG("stream is reset: ignore headers");
3308+
goto free_uh;
33063309
}
33073310

33083311
if (0 != lsquic_stream_uh_in(stream, uh))
33093312
{
33103313
ABORT_ERROR("stream %u refused incoming headers", uh->uh_stream_id);
3311-
free(uh);
3314+
goto free_uh;
33123315
}
33133316

33143317
if (!(stream->stream_flags & STREAM_ONNEW_DONE))
33153318
lsquic_stream_call_on_new(stream);
3319+
3320+
return;
3321+
3322+
free_uh:
3323+
if (uh->uh_hset)
3324+
conn->fc_enpub->enp_hsi_if->hsi_discard_header_set(uh->uh_hset);
3325+
free(uh);
33163326
}
33173327

33183328

@@ -3332,26 +3342,23 @@ headers_stream_on_push_promise (void *ctx, struct uncompressed_headers *uh)
33323342
{
33333343
ABORT_ERROR("invalid push promise stream IDs: %u, %u",
33343344
uh->uh_oth_stream_id, uh->uh_stream_id);
3335-
free(uh);
3336-
return;
3345+
goto free_uh;
33373346
}
33383347

33393348
if (!(conn_is_stream_closed(conn, uh->uh_stream_id) ||
33403349
find_stream_by_id(conn, uh->uh_stream_id)))
33413350
{
33423351
ABORT_ERROR("invalid push promise original stream ID %u never "
33433352
"initiated", uh->uh_stream_id);
3344-
free(uh);
3345-
return;
3353+
goto free_uh;
33463354
}
33473355

33483356
if (conn_is_stream_closed(conn, uh->uh_oth_stream_id) ||
33493357
find_stream_by_id(conn, uh->uh_oth_stream_id))
33503358
{
33513359
ABORT_ERROR("invalid promised stream ID %u already used",
33523360
uh->uh_oth_stream_id);
3353-
free(uh);
3354-
return;
3361+
goto free_uh;
33553362
}
33563363

33573364
stream = new_stream_ext(conn, uh->uh_oth_stream_id, STREAM_IF_STD,
@@ -3360,12 +3367,16 @@ headers_stream_on_push_promise (void *ctx, struct uncompressed_headers *uh)
33603367
if (!stream)
33613368
{
33623369
ABORT_ERROR("cannot create stream: %s", strerror(errno));
3363-
free(uh);
3364-
return;
3370+
goto free_uh;
33653371
}
33663372
lsquic_stream_push_req(stream, uh);
33673373
lsquic_stream_call_on_new(stream);
33683374
return;
3375+
3376+
free_uh:
3377+
if (uh->uh_hset)
3378+
conn->fc_enpub->enp_hsi_if->hsi_discard_header_set(uh->uh_hset);
3379+
free(uh);
33693380
}
33703381

33713382

@@ -3420,7 +3431,9 @@ lsquic_conn_status (lsquic_conn_t *lconn, char *errbuf, size_t bufsz)
34203431
|FC_CLOSING
34213432
|FC_GOING_AWAY)))
34223433
{
3423-
if (lconn->cn_flags & LSCONN_HANDSHAKE_DONE)
3434+
if (lconn->cn_flags & LSCONN_PEER_GOING_AWAY)
3435+
return LSCONN_ST_PEER_GOING_AWAY;
3436+
else if (lconn->cn_flags & LSCONN_HANDSHAKE_DONE)
34243437
return LSCONN_ST_CONNECTED;
34253438
else
34263439
return LSCONN_ST_HSK_IN_PROGRESS;

0 commit comments

Comments
 (0)