fix(core): avoid pooling channels with tools (fixes #4684)

This commit is contained in:
Ludovic Marcotte
2020-07-10 10:22:48 -04:00
parent a91a00e33c
commit cecf157dca
13 changed files with 42 additions and 32 deletions

View File

@@ -108,6 +108,9 @@
- (EOAdaptorChannel *) acquireQuickChannel;
- (EOAdaptorChannel *) acquireAclChannel;
- (void) releaseChannel: (EOAdaptorChannel *) _channel;
- (void) releaseChannel: (EOAdaptorChannel *) _channel
immediately: (BOOL) _immediately;
- (BOOL) canConnectStore;
- (BOOL) canConnectQuick;

View File

@@ -248,9 +248,16 @@ static GCSStringFormatter *stringFormatter = nil;
return [[self _channelManager] acquireOpenChannelForURL:[self aclLocation]];
}
- (void)releaseChannel:(EOAdaptorChannel *)_channel {
[self releaseChannel: _channel immediately: NO];
}
- (void) releaseChannel: (EOAdaptorChannel *) _channel
immediately: (BOOL) _immediately
{
if (debugOn) [self debugWithFormat:@"releasing channel: %@", _channel];
[[self _channelManager] releaseChannel:_channel];
[[self _channelManager] releaseChannel:_channel immediately: _immediately];
}
- (BOOL)canConnectStore {

View File

@@ -1,6 +1,6 @@
/* SOGoToolBackup.m - this file is part of SOGo
*
* Copyright (C) 2009-2016 Inverse inc.
* Copyright (C) 2009-2020 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -168,7 +168,7 @@
if (user)
[allSqlUsers addObject: user];
}
[cm releaseChannel: fc];
[cm releaseChannel: fc immediately: YES];
users = allSqlUsers;
max = [users count];
@@ -270,7 +270,7 @@
row = [fc fetchAttributes: attrs withZone: NULL];
displayName = [row objectForKey: @"c_foldername"];
[fc cancelFetch];
[cm releaseChannel: fc];
[cm releaseChannel: fc immediately: YES];
}
if (!displayName)

View File

@@ -1,6 +1,6 @@
/* SOGoToolCheckup.m - this file is part of SOGo
*
* Copyright (C) 2017 Inverse inc.
* Copyright (C) 2017-2020 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -128,7 +128,7 @@
if (user)
[allSqlUsers addObject: user];
}
[cm releaseChannel: fc];
[cm releaseChannel: fc immediately: YES];
users = allSqlUsers;
max = [users count];

View File

@@ -1,6 +1,6 @@
/* SOGoToolCleanup.m - this file is part of SOGo
*
* Copyright (C) 2016 Inverse inc.
* Copyright (C) 2016-2020 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -122,7 +122,7 @@
if (user)
[allSqlUsers addObject: user];
}
[cm releaseChannel: fc];
[cm releaseChannel: fc immediately: YES];
users = allSqlUsers;
max = [users count];

View File

@@ -1,6 +1,6 @@
/* SOGoToolExpireUserSessions.m - this file is part of SOGo
*
* Copyright (C) 2012-2017 Inverse inc.
* Copyright (C) 2012-2020 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -134,7 +134,7 @@
NSLog(@"No session to remove");
}
[cm releaseChannel: channel];
[cm releaseChannel: channel immediately: YES];
return rc;
}

View File

@@ -206,7 +206,7 @@ typedef enum
if (u)
[allSQLUsers addObject: u];
}
[cm releaseChannel: fc];
[cm releaseChannel: fc immediately: YES];
}
// We add our system users

View File

@@ -1,6 +1,6 @@
/* SOGoToolRemove.m - this file is part of SOGo
*
* Copyright (C) 2010-2017 Inverse inc.
* Copyright (C) 2010-2020 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -105,7 +105,7 @@ static NSURL *tableURL = nil;
while ((row = [fc fetchAttributes: attrs withZone: NULL]))
[paths addObject: [row objectForKey: @"c_path"]];
}
[cm releaseChannel: fc];
[cm releaseChannel: fc immediately: YES];
}
return paths;
@@ -150,7 +150,7 @@ static NSURL *tableURL = nil;
NSLog (@"Unable to delete the preference record for '%@'", userId);
else if (verbose)
NSLog (@"Removed preference record for '%@'", userId);
[cm releaseChannel: fc];
[cm releaseChannel: fc immediately: YES];
}
}

View File

@@ -1,6 +1,6 @@
/* SOGoToolRemoveDoubles.m - this file is part of SOGo
*
* Copyright (C) 2009-2017 Inverse inc.
* Copyright (C) 2009-2020 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -207,7 +207,7 @@
usingChannel: channel];
[context commitTransaction];
[folder releaseChannel: channel];
[folder releaseChannel: channel immediately: YES];
}
- (NSArray *) namesOfRecords: (NSArray *) records

View File

@@ -1,6 +1,6 @@
/* SOGoToolRenameUser.m - this file is part of SOGo
*
* Copyright (C) 2011-2017 Inverse inc
* Copyright (C) 2011-2020 Inverse inc
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -147,7 +147,7 @@
else
rc = [ac commitTransaction];
[cm releaseChannel: fc];
[cm releaseChannel: fc immediately: YES];
return rc;
}
@@ -200,7 +200,7 @@
else
rc = [ac commitTransaction];
[cm releaseChannel: fc];
[cm releaseChannel: fc immediately: YES];
return rc;
}
@@ -245,7 +245,7 @@
while ((row = [fc fetchAttributes: attrs withZone: NULL]))
[subscribers addObject: [row objectForKey: @"c_uid"]];
[fc cancelFetch];
[cm releaseChannel: fc];
[cm releaseChannel: fc immediately: YES];
return subscribers;
}
@@ -446,7 +446,7 @@
sql = [NSString stringWithFormat: @"UPDATE %@ SET c_object = '%@'",
[location gcsTableName], newObjectPath];
[ac evaluateExpressionX: sql];
[cm releaseChannel: ac];
[cm releaseChannel: ac immediately: YES];
}
[pool release];
@@ -480,7 +480,7 @@
fromSQLUser: sqlFromUserID
toSQLUser: sqlToUserID];
[fc cancelFetch];
[cm releaseChannel: fc];
[cm releaseChannel: fc immediately: YES];
}
- (void) _updateForeignACLsForLocation: (NSString *) locationString
@@ -505,7 +505,7 @@
[location gcsTableName],
sqlToUserID, sqlFromUserID];
[tc evaluateExpressionX: sql];
[cm releaseChannel: tc];
[cm releaseChannel: tc immediately: YES];
[pool release];
}
@@ -537,7 +537,7 @@
fromSQLUser: sqlFromUserID
toSQLUser: sqlToUserID];
[fc cancelFetch];
[cm releaseChannel: fc];
[cm releaseChannel: fc immediately: YES];
}
- (BOOL) proceed

View File

@@ -1,6 +1,6 @@
/* SOGoToolRestore.m - this file is part of SOGo
*
* Copyright (C) 2009-2019 Inverse inc.
* Copyright (C) 2009-2020 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -312,7 +312,7 @@
withString: @"''"],
[gcsFolder path]];
[fc evaluateExpressionX: sql];
[cm releaseChannel: fc];
[cm releaseChannel: fc immediately: YES];
}
}
else
@@ -365,7 +365,7 @@
}
[[channel adaptorContext] commitTransaction];
[gcsFolder releaseChannel: channel];
[gcsFolder releaseChannel: channel immediately: YES];
rc = YES;
}

View File

@@ -1,6 +1,6 @@
/* SOGoToolTruncateCalendar.m - this file is part of SOGo
*
* Copyright (C) 2009-2016 Inverse inc.
* Copyright (C) 2009-2020 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -108,7 +108,7 @@
}
[context commitTransaction];
[folder releaseChannel: channel];
[folder releaseChannel: channel immediately: YES];
}
- (BOOL) truncateEntriesFromFolder: (GCSFolder *) folder

View File

@@ -83,9 +83,9 @@
- (void) parseArguments: (NSArray *) arguments
{
BOOL error;
int count, max;
NSString *argument;
int count, max;
BOOL error;
error = NO;
@@ -104,7 +104,7 @@
{
error = YES;
helpMode = YES;
NSLog (@"Invalid command line parameter: '%@'", argument);
NSLog(@"Invalid command line parameter: '%@'", argument);
}
else
{