From 10a7c5a32983070158a736e479b2c6200ecd70fd Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Wed, 25 Feb 2009 01:03:29 +0000 Subject: Implement a connection keepalive, addressing Issue #171. This runs a ping every sixty seconds (a value stored in prefs, though not exposed via the prefs interface yet) in a background thread, to further improve connectivity handling following r334. Pings are only run when necessary - ie active use of the program extends the next ping interval as appropriate, so general impact should be minimal. --- Source/MainController.m | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Source/MainController.m') diff --git a/Source/MainController.m b/Source/MainController.m index f05d7046..c5e2eeb0 100644 --- a/Source/MainController.m +++ b/Source/MainController.m @@ -663,11 +663,13 @@ checks for updates and opens download page in default browser [NSNumber numberWithBool:YES], @"fetchRowCount", [NSNumber numberWithBool:YES], @"limitRows", [NSNumber numberWithInt:1000], @"limitRowsValue", + [NSNumber numberWithInt:60], @"keepAliveInterval", + [NSNumber numberWithInt:0], @"lastUsedVersion", nil]]; - // If no version number is present in prefs, and column widths have been saved, walk through - // them and remove any table widths set to 15 or less (fix for mangled columns caused by Issue #140) - if ([prefs objectForKey:@"lastUsedVersion"] == nil && [prefs objectForKey:@"tableColumnWidths"] != nil) { + // For versions prior to r336, where column widths have been saved, walk through them and remove + // any table widths set to 15 or less (fix for mangled columns caused by Issue #140) + if ([[prefs objectForKey:@"lastUsedVersion"] intValue] < 336 && [prefs objectForKey:@"tableColumnWidths"] != nil) { NSEnumerator *databaseEnumerator, *tableEnumerator, *columnEnumerator; NSString *databaseKey, *tableKey, *columnKey; NSMutableDictionary *newDatabase, *newTable; @@ -700,7 +702,7 @@ checks for updates and opens download page in default browser [prefs setObject:[NSDictionary dictionaryWithDictionary:newTableColumnWidths] forKey:@"tableColumnWidths"]; [newTableColumnWidths release]; } - + // Write the current bundle version to the prefs [prefs setObject:[NSNumber numberWithInt:currentVersionNumber] forKey:@"lastUsedVersion"]; -- cgit v1.2.3