Skip to content

/reconnect when opening a socket does not work as expected? #255

@osa1

Description

@osa1

Screenshot_2020-09-17_09-34-53

In the screenshot I have a problem with my connection and I'm unable to open connection to the shown address.

First of all, I think we should retry connection if there isn't progress in e.g. 30 seconds at this step, similar to how we reconnect if we don't hear from the server for a while.

But the actual bug is /reconnect isn't doing anything at this step. I see the code that is supposed to handle /reconnect during address name resolving step, but I don't see it in try_connect:

async fn try_connect(
addrs: Vec<SocketAddr>,
serv_name: &str,
use_tls: bool,
snd_ev: &mut mpsc::Sender<Event>,
) -> Option<Stream> {
for addr in addrs {
snd_ev.send(Event::Connecting(addr)).await.unwrap();
let mb_stream = if use_tls {
Stream::new_tls(addr, &serv_name).await
} else {
Stream::new_tcp(addr).await
};
match mb_stream {
Err(err) => {
snd_ev.send(Event::from(err)).await.unwrap();
}
Ok(stream) => {
return Some(stream);
}
}
}
None
}

I think we need to do the same there.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions