Skip to content

Commit

Permalink
refactor!: Remove Connect from ConnectionError::StateError (byteb…
Browse files Browse the repository at this point in the history
…eamio#541)

* refactor!: remove `Connect` from `ConnectionError::StateError`

* fix clippy warnings
  • Loading branch information
henil committed Dec 16, 2022
1 parent 7b8103c commit a5b695a
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -21,6 +21,7 @@ rumqttc v0.18.0
- Add support for native-tls within rumqttc (#501)
- Fixed panicking in `recv_timeout` and `try_recv` by entering tokio runtime context (#492, #497)
- Removed unused dependencies and updated version of some of used libraries to fix dependabots warning (#475)
- Remove `Connect` from `ConnectionError::StateError` (#541)

rumqttd
-------
Expand Down
2 changes: 1 addition & 1 deletion rumqttc/src/eventloop.rs
Expand Up @@ -43,7 +43,7 @@ pub enum ConnectionError {
Tls(#[from] tls::Error),
#[error("I/O: {0}")]
Io(#[from] io::Error),
#[error("Connection refused, return code: {0:?}")]
#[error("Connection refused, return code: `{0:?}`")]
ConnectionRefused(ConnectReturnCode),
#[error("Expected ConnAck packet, received: {0:?}")]
NotConnAck(Packet),
Expand Down
3 changes: 0 additions & 3 deletions rumqttc/src/state.rs
Expand Up @@ -12,9 +12,6 @@ pub enum StateError {
/// Io Error while state is passed to network
#[error("Io error: {0:?}")]
Io(#[from] io::Error),
/// Broker's error reply to client's connect packet
#[error("Connect return code: `{0:?}`")]
Connect(ConnectReturnCode),
/// Invalid state for a given operation
#[error("Invalid state for a given operation")]
InvalidState,
Expand Down
2 changes: 1 addition & 1 deletion rumqttc/src/v5/eventloop.rs
Expand Up @@ -44,7 +44,7 @@ pub enum ConnectionError {
Tls(#[from] tls::Error),
#[error("I/O: {0}")]
Io(#[from] io::Error),
#[error("Connection refused, return code: {0:?}")]
#[error("Connection refused, return code: `{0:?}`")]
ConnectionRefused(ConnectReturnCode),
#[error("Expected ConnAck packet, received: {0:?}")]
NotConnAck(Box<Packet>),
Expand Down
5 changes: 1 addition & 4 deletions rumqttc/src/v5/state.rs
Expand Up @@ -2,7 +2,7 @@ use crate::v5::mqttbytes::PingReq;

use super::mqttbytes::v5::Packet;
use super::mqttbytes::{
self, ConnectReturnCode, PubAck, PubComp, PubRec, PubRel, Publish, QoS, Subscribe, Unsubscribe,
self, PubAck, PubComp, PubRec, PubRel, Publish, QoS, Subscribe, Unsubscribe,
};
use super::{Event, Incoming, Outgoing, Request};

Expand All @@ -16,9 +16,6 @@ pub enum StateError {
/// Io Error while state is passed to network
#[error("Io error: {0:?}")]
Io(#[from] io::Error),
/// Broker's error reply to client's connect packet
#[error("Connect return code: `{0:?}`")]
Connect(ConnectReturnCode),
/// Invalid state for a given operation
#[error("Invalid state for a given operation")]
InvalidState,
Expand Down
2 changes: 1 addition & 1 deletion rumqttd/src/router/iobufs.rs
Expand Up @@ -68,7 +68,7 @@ impl Outgoing {
pub(crate) fn new(client_id: String) -> (Self, Receiver<()>) {
let (handle, rx) = flume::bounded(MAX_CHANNEL_CAPACITY);
let data_buffer = VecDeque::with_capacity(MAX_CHANNEL_CAPACITY);
let inflight_buffer = VecDeque::with_capacity(MAX_INFLIGHT as usize);
let inflight_buffer = VecDeque::with_capacity(MAX_INFLIGHT);

// Ensure that there won't be any new allocations
assert!(MAX_INFLIGHT <= inflight_buffer.capacity());
Expand Down
2 changes: 1 addition & 1 deletion rumqttd/src/segments/mod.rs
Expand Up @@ -127,7 +127,7 @@ where
#[allow(dead_code)]
#[inline]
pub fn len(&self) -> usize {
self.segments.len() as usize
self.segments.len()
}

/// Number of packets
Expand Down

0 comments on commit a5b695a

Please sign in to comment.