engine: Ensure we try to connect again on connection error

Fix #1552
This commit is contained in:
Cédric Bellegarde 2023-10-03 16:42:42 +02:00 committed by Niels De Graef
parent c3629be043
commit 5dde584f1f
3 changed files with 10 additions and 1 deletions

View file

@ -400,6 +400,8 @@ public abstract class Geary.ClientService : BaseObject, Logging.Source {
this.last_error = error; this.last_error = error;
this.current_status = CONNECTION_FAILED; this.current_status = CONNECTION_FAILED;
connection_error(error); connection_error(error);
// Network error, so try to connect again
on_connectivity_change();
} }
/** /**

View file

@ -546,6 +546,12 @@ public class Geary.Imap.ClientService : Geary.ClientService {
session, session,
(obj, res) => { this.remove_session_async.end(res); } (obj, res) => { this.remove_session_async.end(res); }
); );
if (session.disconnected == ClientSession.DisconnectReason.REMOTE_ERROR) {
Geary.ErrorContext context = new Geary.ErrorContext(
new GLib.IOError.NOT_CONNECTED("Session disconnected, remote error")
);
notify_connection_failed(context);
}
} }
} }

View file

@ -189,8 +189,9 @@ public class Geary.ConnectivityManager : BaseObject {
// localhost. (This is a Linux program, after all...) // localhost. (This is a Linux program, after all...)
debug("Network changed: %s", debug("Network changed: %s",
some_available ? "some available" : "none available"); some_available ? "some available" : "none available");
cancel_check();
if (some_available) { if (some_available) {
cancel_check();
this.delayed_check.start_ms(CHECK_SOON); this.delayed_check.start_ms(CHECK_SOON);
} else { } else {
// None available, so definitely not reachable. // None available, so definitely not reachable.