@@ -130,7 +130,7 @@ impl EventLoop {
130130
131131 requests_in_channel. retain ( |request| {
132132 match request {
133- Request :: PubAck ( _) => false , // Wait for publish retransmission, else the broker could be confused by an unexpected ack
133+ Request :: PubAck ( _) => false , // Wait for publish retransmission, else the broker could be confused by an unexpected ack
134134 _ => true ,
135135 }
136136 } ) ;
@@ -398,20 +398,20 @@ async fn mqtt_connect(
398398 options : & mut MqttOptions ,
399399 network : & mut Network ,
400400) -> Result < ConnAck , ConnectionError > {
401- let keep_alive = options. keep_alive ( ) . as_secs ( ) as u16 ;
402- let clean_start = options. clean_start ( ) ;
403- let client_id = options. client_id ( ) ;
404- let properties = options. connect_properties ( ) ;
405-
406- let connect = Connect {
407- keep_alive,
408- client_id,
409- clean_start,
410- properties,
411- } ;
401+ let packet = Packet :: Connect (
402+ Connect {
403+ client_id : options. client_id ( ) ,
404+ keep_alive : options. keep_alive ( ) . as_secs ( ) as u16 ,
405+ clean_start : options. clean_start ( ) ,
406+ properties : options. connect_properties ( ) ,
407+ } ,
408+ options. last_will ( ) ,
409+ options. credentials ( ) ,
410+ ) ;
412411
413412 // send mqtt connect packet
414- network. connect ( connect, options) . await ?;
413+ network. write ( packet) . await ?;
414+ network. flush ( ) . await ?;
415415
416416 // validate connack
417417 match network. read ( ) . await ? {
0 commit comments