AtherEnergy / rumqtt

Pure rust mqtt cilent
The Unlicense
203 stars 72 forks source link

Connection issues when dns resolve fails are not detected #151

Closed TotalKrill closed 5 years ago

TotalKrill commented 5 years ago

Trying to connect to an invalid web-address such as braker.hivemq.com are never resolved,

#[macro_use] extern crate log;
use rumqtt::*;
use rumqtt::mqttoptions::*;

fn main() {
    simple_logger::init_with_level( log::Level::Info )
        .expect("Could not initiate logger");

    let mqtt_options = MqttOptions::new( "Testclient".to_string(), "braker.hivemq.com".to_string(), 1883)
        .set_reconnect_opts(ReconnectOptions::AfterFirstSuccess(0));

    let mqtt_conn = MqttClient::start(mqtt_options);

    loop {
    }
}

yields image

but the error is never detected and the code continues anyway

TotalKrill commented 5 years ago

If timeout is set to 1 an error is returned, so one can react, however the eventloop never exits.

TotalKrill commented 5 years ago

Might I ask you to push this change to crates.io? would be very appreciated

tekjar commented 5 years ago

Hi. This crate is used in production and my confidence levels are little low now as I've merged a bunch of commits without unit tests and CI. I'm adding these in develop branch and there are already a bunch of changes. I'll push to crates as soon as I'm done with it

TotalKrill commented 5 years ago

Hey, might be the wrong topic, but since I am watching this repo, I got that you merged the develop branch.

What is missing to bump the version number, I might be able to help

tekjar commented 5 years ago

Can you verify if this problem is solved? I've already bumped the version. I'll push it crates day after tomorrow

TotalKrill commented 5 years ago

Ran my tests again, seems to be fine. But to be sure maybe there should be some kind of integration testing. Could also be good for future confidence levels of the system

tekjar commented 5 years ago

There are unitests for connection eventloop as well now. I think there is already a test for this