Skip to content

Commit

Permalink
fix: readb should block for 1 packet (#824)
Browse files Browse the repository at this point in the history
  • Loading branch information
Devdutt Shenoi committed Mar 25, 2024
1 parent 284f81a commit 1fd8825
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions rumqttc/src/framed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,11 @@ impl Network {
}
}
// If some packets are already framed, return those
Err(mqttbytes::Error::InsufficientBytes(_)) if count > 0 => break,
// TODO: figure out how not to block
Ok(_) => break,
Err(mqttbytes::Error::InsufficientBytes(_)) | Ok(_) if count > 0 => break,
// NOTE: read atleast 1 packet
Ok(_) => {
self.read_bytes(2).await?;
}
// Wait for more bytes until a frame can be created
Err(mqttbytes::Error::InsufficientBytes(required)) => {
self.read_bytes(required).await?;
Expand Down

0 comments on commit 1fd8825

Please sign in to comment.