Commit c8f5e029 authored by Michael Gratton's avatar Michael Gratton 🤞

Merge branch 'wip/goa-error-when-disconnected' into 'master'

Fix GOA accounts throwing an error when starting offline

See merge request !161
parents 224ccb18 82160e9f
Pipeline #65334 passed with stages
in 32 minutes and 24 seconds
......@@ -160,11 +160,6 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
new LoadFolders(this, this.local, get_supported_special_folders())
);
// To prevent spurious connection failures, we make sure we
// have passwords before attempting a connection.
yield this.information.load_incoming_credentials(cancellable);
yield this.information.load_outgoing_credentials(cancellable);
// Start the mail services. Start incoming directly, but queue
// outgoing so local folders can be loaded first in case
// queued mail gets sent and needs to get saved somewhere.
......
......@@ -265,6 +265,20 @@ internal class Geary.Imap.ClientService : Geary.ClientService {
debug("Checking session pool with %d of %d free",
this.free_queue.size, this.all_sessions.size);
if (!is_claiming) {
// To prevent spurious connection failures, ensure tokens
// are up-to-date before attempting a connection, but
// after we know we should be able to connect to it
try {
yield this.account.load_incoming_credentials(
this.pool_cancellable
);
} catch (GLib.Error err) {
notify_connection_failed(new ErrorContext(err));
return;
}
}
int needed = this.min_pool_size - this.all_sessions.size;
if (needed <= 0 && is_claiming) {
needed = 1;
......
......@@ -188,6 +188,10 @@ internal class Geary.Smtp.ClientService : Geary.ClientService {
// Returns true if email was successfully processed, else false
private async void process_email(EmailIdentifier id, Cancellable cancellable)
throws GLib.Error {
// To prevent spurious connection failures, ensure tokens are
// up-to-date before attempting to send the email
yield this.account.load_outgoing_credentials(cancellable);
Email? email = null;
try {
email = yield this.outbox.fetch_email_async(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment