@@ -3300,19 +3300,29 @@ headers_stream_on_incoming_headers (void *ctx, struct uncompressed_headers *uh)
3300
3300
stream = find_stream_on_non_stream_frame (conn , uh -> uh_stream_id , 0 ,
3301
3301
"headers" );
3302
3302
if (!stream )
3303
+ goto free_uh ;
3304
+
3305
+ if (lsquic_stream_is_reset (stream ))
3303
3306
{
3304
- free ( uh );
3305
- return ;
3307
+ LSQ_DEBUG ( "stream is reset: ignore headers" );
3308
+ goto free_uh ;
3306
3309
}
3307
3310
3308
3311
if (0 != lsquic_stream_uh_in (stream , uh ))
3309
3312
{
3310
3313
ABORT_ERROR ("stream %u refused incoming headers" , uh -> uh_stream_id );
3311
- free ( uh ) ;
3314
+ goto free_uh ;
3312
3315
}
3313
3316
3314
3317
if (!(stream -> stream_flags & STREAM_ONNEW_DONE ))
3315
3318
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 );
3316
3326
}
3317
3327
3318
3328
@@ -3332,26 +3342,23 @@ headers_stream_on_push_promise (void *ctx, struct uncompressed_headers *uh)
3332
3342
{
3333
3343
ABORT_ERROR ("invalid push promise stream IDs: %u, %u" ,
3334
3344
uh -> uh_oth_stream_id , uh -> uh_stream_id );
3335
- free (uh );
3336
- return ;
3345
+ goto free_uh ;
3337
3346
}
3338
3347
3339
3348
if (!(conn_is_stream_closed (conn , uh -> uh_stream_id ) ||
3340
3349
find_stream_by_id (conn , uh -> uh_stream_id )))
3341
3350
{
3342
3351
ABORT_ERROR ("invalid push promise original stream ID %u never "
3343
3352
"initiated" , uh -> uh_stream_id );
3344
- free (uh );
3345
- return ;
3353
+ goto free_uh ;
3346
3354
}
3347
3355
3348
3356
if (conn_is_stream_closed (conn , uh -> uh_oth_stream_id ) ||
3349
3357
find_stream_by_id (conn , uh -> uh_oth_stream_id ))
3350
3358
{
3351
3359
ABORT_ERROR ("invalid promised stream ID %u already used" ,
3352
3360
uh -> uh_oth_stream_id );
3353
- free (uh );
3354
- return ;
3361
+ goto free_uh ;
3355
3362
}
3356
3363
3357
3364
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)
3360
3367
if (!stream )
3361
3368
{
3362
3369
ABORT_ERROR ("cannot create stream: %s" , strerror (errno ));
3363
- free (uh );
3364
- return ;
3370
+ goto free_uh ;
3365
3371
}
3366
3372
lsquic_stream_push_req (stream , uh );
3367
3373
lsquic_stream_call_on_new (stream );
3368
3374
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 );
3369
3380
}
3370
3381
3371
3382
@@ -3420,7 +3431,9 @@ lsquic_conn_status (lsquic_conn_t *lconn, char *errbuf, size_t bufsz)
3420
3431
|FC_CLOSING
3421
3432
|FC_GOING_AWAY )))
3422
3433
{
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 )
3424
3437
return LSCONN_ST_CONNECTED ;
3425
3438
else
3426
3439
return LSCONN_ST_HSK_IN_PROGRESS ;
0 commit comments