@@ -111,15 +111,15 @@ impl MqttState {
111
111
112
112
for publish in second_half. iter_mut ( ) . chain ( first_half) {
113
113
if let Some ( publish) = publish. take ( ) {
114
- let tx = self . ack_waiter . remove ( publish. pkid as usize ) ;
114
+ let tx = self . ack_waiter [ publish. pkid as usize ] . take ( ) ;
115
115
let request = Request :: Publish ( publish) ;
116
116
pending. push ( ( request, tx) ) ;
117
117
}
118
118
}
119
119
120
120
// remove and collect pending releases
121
121
for pkid in self . outgoing_rel . ones ( ) {
122
- let tx = self . ack_waiter . remove ( pkid ) ;
122
+ let tx = self . ack_waiter [ pkid ] . take ( ) ;
123
123
let request = Request :: PubRel ( PubRel :: new ( pkid as u16 ) ) ;
124
124
pending. push ( ( request, tx) ) ;
125
125
}
@@ -238,7 +238,7 @@ impl MqttState {
238
238
return Err ( StateError :: Unsolicited ( puback. pkid ) ) ;
239
239
}
240
240
241
- if let Some ( tx) = self . ack_waiter . remove ( puback. pkid as usize ) {
241
+ if let Some ( tx) = self . ack_waiter [ puback. pkid as usize ] . take ( ) {
242
242
// Resolve promise for QoS 1
243
243
tx. resolve ( ) ;
244
244
}
@@ -300,7 +300,7 @@ impl MqttState {
300
300
return Err ( StateError :: Unsolicited ( pubcomp. pkid ) ) ;
301
301
}
302
302
303
- if let Some ( tx) = self . ack_waiter . remove ( pubcomp. pkid as usize ) {
303
+ if let Some ( tx) = self . ack_waiter [ pubcomp. pkid as usize ] . take ( ) {
304
304
// Resolve promise for QoS 2
305
305
tx. resolve ( ) ;
306
306
}
0 commit comments