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

Connecting twice to the same broker causes AsyncClient to get stuck #234

Open
Altair-Bueno opened this issue Jul 29, 2024 · 0 comments
Open

Comments

@Altair-Bueno
Copy link

Altair-Bueno commented Jul 29, 2024

MRE

use paho_mqtt::AsyncClient;
use paho_mqtt::ConnectOptionsBuilder;
use paho_mqtt::CreateOptions;
use paho_mqtt::Error;

#[tokio::main]
async fn main() -> Result<(), Error> {
    let client = AsyncClient::new(CreateOptions::default())?;

    println!("First one connecting");
    client
        .connect(
            ConnectOptionsBuilder::new()
                .server_uris(&["test.mosquitto.org:1883"])
                .finalize(),
        )
        .await?;
    println!("Fist one connected");

    println!("Second one connecting");
    client
        .connect(
            ConnectOptionsBuilder::new()
                .server_uris(&["test.mosquitto.org:1883"])
                .finalize(),
        )
        .await?;
    println!("Second one connected");

    Ok(())
}
First one connecting
Fist one connected
Second one connecting

repr-async-client-stuck-double-connect.zip

Current behavior

Connecting twice to the same broker causes AsyncClient to get stuck on the second connect call.

Expected behaviour

Second connect call should be ignored, as it is already connected.

Additional information

Setting different protocols doesn't change anything

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant