reresolve address at every reconnect, to avoid problems switching from IPv6 to IPv4-only networks
This commit is contained in:
parent
002393b18e
commit
caf3912af1
13
src/lib.rs
13
src/lib.rs
@ -214,13 +214,12 @@ pub fn connect_and_idle<F: Fn(), G: Fn()>(cli: &Cli, connected_callback: F, mail
|
||||
cli.server.as_str().try_into().unwrap())?;
|
||||
|
||||
let mut addrs = cli.addrs.borrow_mut();
|
||||
if addrs.is_empty() {
|
||||
addrs.extend(
|
||||
(cli.server.as_str(), cli.port)
|
||||
.to_socket_addrs()
|
||||
.map_err(|e|io::Error::new(ErrorKind::NotConnected, e.to_string()))?
|
||||
);
|
||||
}
|
||||
addrs.clear();
|
||||
addrs.extend(
|
||||
(cli.server.as_str(), cli.port)
|
||||
.to_socket_addrs()
|
||||
.map_err(|e|io::Error::new(ErrorKind::NotConnected, e.to_string()))?
|
||||
);
|
||||
|
||||
let mut socket = TcpStream::connect(addrs.as_slice())?;
|
||||
let mut state = ImapState::Unauthenticated;
|
||||
|
Loading…
Reference in New Issue
Block a user