@@ -14,7 +14,7 @@ use stream::WriteBuf;
1414use tracing:: { instrument, warn} ;
1515
1616use crate :: {
17- config:: Config ,
17+ config:: { Config , Settings } ,
1818 error:: {
1919 connection_error_creators:: {
2020 CloseRawQuicConnection , CloseStream , HandleFrameStreamErrorOnRequestStream ,
@@ -579,14 +579,19 @@ where
579579 ) ,
580580 ) ) ) ;
581581 }
582- Ok ( Some ( Frame :: Settings ( settings ) ) ) => {
582+ Ok ( Some ( Frame :: Settings ( peer_settings ) ) ) => {
583583 if !self . got_peer_settings {
584584 // Received settings frame
585-
586585 self . got_peer_settings = true ;
587- self . set_settings ( ( & settings) . into ( ) ) ;
588586
589- Frame :: Settings ( settings)
587+ //= https://www.rfc-editor.org/rfc/rfc9297#section-2.1.1
588+ //# QUIC DATAGRAM frames MUST NOT be sent until the SETTINGS_H3_DATAGRAM
589+ //# setting has been both sent and received with a value of 1.
590+ let mut negotiated = Settings :: from ( & peer_settings) ;
591+ negotiated. enable_datagram &= self . config . settings . enable_datagram ;
592+ self . set_settings ( negotiated) ;
593+
594+ Frame :: Settings ( peer_settings)
590595 } else {
591596 //= https://www.rfc-editor.org/rfc/rfc9114#section-7.2.4
592597 //# If an endpoint receives a second SETTINGS
0 commit comments