reresolve address at every reconnect, to avoid problems switching from IPv6 to IPv4-only networks
This commit is contained in:
parent
002393b18e
commit
caf3912af1
@ -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())?;
|
cli.server.as_str().try_into().unwrap())?;
|
||||||
|
|
||||||
let mut addrs = cli.addrs.borrow_mut();
|
let mut addrs = cli.addrs.borrow_mut();
|
||||||
if addrs.is_empty() {
|
addrs.clear();
|
||||||
addrs.extend(
|
addrs.extend(
|
||||||
(cli.server.as_str(), cli.port)
|
(cli.server.as_str(), cli.port)
|
||||||
.to_socket_addrs()
|
.to_socket_addrs()
|
||||||
.map_err(|e|io::Error::new(ErrorKind::NotConnected, e.to_string()))?
|
.map_err(|e|io::Error::new(ErrorKind::NotConnected, e.to_string()))?
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
let mut socket = TcpStream::connect(addrs.as_slice())?;
|
let mut socket = TcpStream::connect(addrs.as_slice())?;
|
||||||
let mut state = ImapState::Unauthenticated;
|
let mut state = ImapState::Unauthenticated;
|
||||||
|
Loading…
Reference in New Issue
Block a user