Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disconnect on error from service readiness check #180

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading