diff options
author | rowanbeentje <rowan@beent.je> | 2012-10-14 19:22:45 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2012-10-14 19:22:45 +0000 |
commit | d8896ae0a22b0014d0b43706280c8a390f14b058 (patch) | |
tree | 7ffd10862c22a37507bd7d10edae26d015fd5620 /Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Delegate & Proxy.m | |
parent | dc45c654aab99cbccecda192396dc8baefd5690e (diff) | |
download | sequelpro-d8896ae0a22b0014d0b43706280c8a390f14b058.tar.gz sequelpro-d8896ae0a22b0014d0b43706280c8a390f14b058.tar.bz2 sequelpro-d8896ae0a22b0014d0b43706280c8a390f14b058.zip |
- Clean up some connection cancellation/close-during-connect edges as a result of r3894, attempting to improve some exceptions during aborted connections
- Name threads created in SPMySQL.framework
Diffstat (limited to 'Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Delegate & Proxy.m')
-rw-r--r-- | Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Delegate & Proxy.m | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Delegate & Proxy.m b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Delegate & Proxy.m index e0b745e0..9f6d8dff 100644 --- a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Delegate & Proxy.m +++ b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Delegate & Proxy.m @@ -95,6 +95,7 @@ */ - (void)_proxyStateChange:(NSObject <SPMySQLConnectionProxy> *)aProxy { + NSThread *reconnectionThread; // Perform no actions if this isn't the current connection proxy, or if notifications // are currently set to be ignored @@ -112,11 +113,15 @@ // Trigger a reconnect depending on connection usage recently. If the connection has // actively been used in the last couple of minutes, trigger a full reconnection attempt. if (_elapsedSecondsSinceAbsoluteTime(lastConnectionUsedTime) < 60 * 2) { - [NSThread detachNewThreadSelector:@selector(reconnect) toTarget:self withObject:nil]; - + reconnectionThread = [[[NSThread alloc] initWithTarget:self selector:@selector(_reconnectAllowingRetries:) object:[NSNumber numberWithBool:YES]] autorelease]; + [reconnectionThread setName:@"SPMySQL reconnection thread (full)"]; + [reconnectionThread start]; + // If used within the last fifteen minutes, trigger a background/single reconnection attempt } else if (_elapsedSecondsSinceAbsoluteTime(lastConnectionUsedTime) < 60 * 15) { - [NSThread detachNewThreadSelector:@selector(_reconnectAfterBackgroundConnectionLoss) toTarget:self withObject:nil]; + reconnectionThread = [[[NSThread alloc] initWithTarget:self selector:@selector(_reconnectAfterBackgroundConnectionLoss:) object:nil] autorelease]; + [reconnectionThread setName:@"SPMySQL reconnection thread (limited)"]; + [reconnectionThread start]; // Otherwise set the state to connection lost for automatic reconnect on next use } else { |