Skip to content

Commit

Permalink
Disconnect on error from service readiness check (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
fafhrd91 authored Oct 15, 2024
1 parent 3916356 commit a5e1d20
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all --features=ntex/tokio
args: --all --features=ntex-net/tokio

fmt:
name: Rustfmt
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
uses: Swatinem/[email protected]

- name: Generate code coverage
run: cargo llvm-cov --features=ntex/compio --workspace --lcov --output-path lcov.info
run: cargo llvm-cov --features=ntex/tokio --workspace --lcov --output-path lcov.info

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
Expand Down
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes

## [4.1.1] - 2024-10-15

* Disconnect on error from service readiness check

## [4.1.0] - 2024-10-10

* Do not check readiness for call
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ntex-mqtt"
version = "4.1.0"
version = "4.1.1"
authors = ["ntex contributors <[email protected]>"]
description = "Client and Server framework for MQTT v5 and v3.1.1 protocols"
documentation = "https://docs.rs/ntex-mqtt"
Expand Down
4 changes: 2 additions & 2 deletions src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,11 +489,11 @@ where
}
// handle service readiness error
Poll::Ready(Err(err)) => {
log::trace!("{}: Service readiness check failed, stopping", self.io.tag());
log::error!("{}: Service readiness check failed, stopping", self.io.tag());
self.st = IoDispatcherState::Stop;
self.flags.insert(Flags::READY_ERR);
self.state.borrow_mut().error = Some(IoDispatcherError::Service(err));
Poll::Ready(PollService::Continue)
Poll::Ready(PollService::Item(DispatchItem::Disconnect(None)))
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ async fn handle_or_drop_publish_after_disconnect(
sleep(Millis(1750)).await;
io.close();
drop(io);
sleep(Millis(500)).await;
sleep(Millis(750)).await;

assert!(disconnect.load(Relaxed));

Expand Down

0 comments on commit a5e1d20

Please sign in to comment.