@@ -130,7 +130,7 @@ impl EventLoop {
130
130
131
131
requests_in_channel. retain ( |request| {
132
132
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
134
134
_ => true ,
135
135
}
136
136
} ) ;
@@ -398,20 +398,20 @@ async fn mqtt_connect(
398
398
options : & mut MqttOptions ,
399
399
network : & mut Network ,
400
400
) -> 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
+ ) ;
412
411
413
412
// send mqtt connect packet
414
- network. connect ( connect, options) . await ?;
413
+ network. write ( packet) . await ?;
414
+ network. flush ( ) . await ?;
415
415
416
416
// validate connack
417
417
match network. read ( ) . await ? {
0 commit comments