From 4542163241fc7ab89c40ff8228cd493b45c107c6 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Mon, 27 Aug 2018 08:41:24 -0400 Subject: [PATCH] (fix) retry connection if abruptly closed --- Main/SOGo.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Main/SOGo.m b/Main/SOGo.m index 31c2bd97f..45d6418b5 100644 --- a/Main/SOGo.m +++ b/Main/SOGo.m @@ -203,6 +203,9 @@ static BOOL debugLeaks; [NSString stringWithFormat: @"SELECT count(*) FROM %@", tableName]]) { + // We re-acquire the channel in case it was abruptly closed between statements + if (![tc isOpen]) + tc = [cm acquireOpenChannelForURL: channelURL]; tableScript = [self _sqlScriptForTable: tableName withType: tableType andFileSuffix: fileSuffix]; @@ -236,6 +239,9 @@ static BOOL debugLeaks; type = [GCSFolderType folderTypeWithName: typeName]; if (type) { + // We re-acquire the channel in case it was abruptly closed between statements + if (![channel isOpen]) + channel = [cm acquireOpenChannelForURL: [NSURL URLWithString: url]]; sql = [type sqlQuickCreateWithTableName: tableName]; if (!(ex = [channel evaluateExpressionX: sql])) [self logWithFormat: @"sogo quick table '%@' successfully created!",