@@ -755,6 +755,7 @@ blocked_ka_alarm_expired (enum alarm_id al_id, void *ctx,
755
755
struct ietf_full_conn * const conn = (struct ietf_full_conn * ) ctx ;
756
756
struct lsquic_stream * stream ;
757
757
struct lsquic_hash_elem * el ;
758
+ int has_send_flag ;
758
759
759
760
if (lsquic_conn_cap_avail (& conn -> ifc_pub .conn_cap ) == 0 )
760
761
{
@@ -769,12 +770,18 @@ blocked_ka_alarm_expired (enum alarm_id al_id, void *ctx,
769
770
stream = lsquic_hashelem_getdata (el );
770
771
if (lsquic_stream_is_blocked (stream ))
771
772
{
772
- if (!(stream -> sm_qflags & SMQF_SENDING_FLAGS ))
773
- TAILQ_INSERT_TAIL (& conn -> ifc_pub .sending_streams , stream ,
774
- next_send_stream );
773
+ has_send_flag = (stream -> sm_qflags & SMQF_SENDING_FLAGS );
775
774
stream -> sm_qflags |= SMQF_SEND_BLOCKED ;
776
775
LSQ_DEBUG ("set SEND_BLOCKED flag on stream %" PRIu64 , stream -> id );
777
- return ;
776
+ if (!lsquic_sendctl_gen_stream_blocked_frame (
777
+ stream -> conn_pub -> send_ctl , stream ))
778
+ {
779
+ LSQ_DEBUG ("failed to send STREAM_BLOCKED frame for"
780
+ " stream %" PRIu64 " immedately, postpone." , stream -> id );
781
+ if (!has_send_flag )
782
+ TAILQ_INSERT_TAIL (& conn -> ifc_pub .sending_streams , stream ,
783
+ next_send_stream );
784
+ }
778
785
}
779
786
}
780
787
}
@@ -7387,6 +7394,7 @@ process_regular_packet (struct ietf_full_conn *conn,
7387
7394
enum was_missing was_missing ;
7388
7395
int is_rechist_empty ;
7389
7396
unsigned char saved_path_id ;
7397
+ int is_dcid_changed ;
7390
7398
7391
7399
if (HETY_RETRY == packet_in -> pi_header_type )
7392
7400
return process_retry_packet (conn , packet_in );
@@ -7489,16 +7497,31 @@ process_regular_packet (struct ietf_full_conn *conn,
7489
7497
}
7490
7498
}
7491
7499
7500
+ is_dcid_changed = !LSQUIC_CIDS_EQ (CN_SCID (& conn -> ifc_conn ),
7501
+ & packet_in -> pi_dcid );
7492
7502
if (pns == PNS_INIT )
7493
7503
conn -> ifc_conn .cn_esf .i -> esfi_set_iscid (conn -> ifc_conn .cn_enc_session ,
7494
7504
packet_in );
7495
- else if ( pns == PNS_HSK )
7505
+ else
7496
7506
{
7497
- if ((conn -> ifc_flags & (IFC_SERVER | IFC_IGNORE_INIT )) == IFC_SERVER )
7498
- ignore_init (conn );
7499
- lsquic_send_ctl_maybe_calc_rough_rtt (& conn -> ifc_send_ctl , pns - 1 );
7507
+ if (is_dcid_changed )
7508
+ {
7509
+ if (LSQUIC_CIDS_EQ (& conn -> ifc_conn .cn_cces [0 ].cce_cid ,
7510
+ & packet_in -> pi_dcid )
7511
+ && !(conn -> ifc_conn .cn_cces [0 ].cce_flags & CCE_SEQNO ))
7512
+ {
7513
+ ABORT_QUIETLY (0 , TEC_PROTOCOL_VIOLATION ,
7514
+ "protocol violation detected bad dcid" );
7515
+ return -1 ;
7516
+ }
7517
+ }
7518
+ if (pns == PNS_HSK )
7519
+ {
7520
+ if ((conn -> ifc_flags & (IFC_SERVER | IFC_IGNORE_INIT )) == IFC_SERVER )
7521
+ ignore_init (conn );
7522
+ lsquic_send_ctl_maybe_calc_rough_rtt (& conn -> ifc_send_ctl , pns - 1 );
7523
+ }
7500
7524
}
7501
-
7502
7525
EV_LOG_PACKET_IN (LSQUIC_LOG_CONN_ID , packet_in );
7503
7526
7504
7527
is_rechist_empty = lsquic_rechist_is_empty (& conn -> ifc_rechist [pns ]);
@@ -7522,8 +7545,7 @@ process_regular_packet (struct ietf_full_conn *conn,
7522
7545
<< packet_in -> pi_path_id );
7523
7546
}
7524
7547
}
7525
- else if (!LSQUIC_CIDS_EQ (CN_SCID (& conn -> ifc_conn ),
7526
- & packet_in -> pi_dcid ))
7548
+ else if (is_dcid_changed )
7527
7549
{
7528
7550
if (0 != on_dcid_change (conn , & packet_in -> pi_dcid ))
7529
7551
return -1 ;
0 commit comments