aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/SPMySQLFramework
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2012-10-14 19:22:45 +0000
committerrowanbeentje <rowan@beent.je>2012-10-14 19:22:45 +0000
commitd8896ae0a22b0014d0b43706280c8a390f14b058 (patch)
tree7ffd10862c22a37507bd7d10edae26d015fd5620 /Frameworks/SPMySQLFramework
parentdc45c654aab99cbccecda192396dc8baefd5690e (diff)
downloadsequelpro-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')
-rw-r--r--Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Delegate & Proxy.m11
-rw-r--r--Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.m1
-rw-r--r--Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m4
-rw-r--r--Frameworks/SPMySQLFramework/Source/SPMySQLFastStreamingResult.m2
4 files changed, 13 insertions, 5 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 {
diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.m b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.m
index fb8a984f..43050a54 100644
--- a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.m
+++ b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.m
@@ -83,6 +83,7 @@
- (void)_threadedKeepAlive
{
keepAliveThread = [NSThread currentThread];
+ [keepAliveThread setName:@"SPMySQL connection keepalive thread"];
// If the maximum number of ping failures has been reached, determine whether to reconnect.
if (keepAliveLastPingBlocked || keepAlivePingFailures >= 3) {
diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m
index e12063a2..bdef884c 100644
--- a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m
+++ b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m
@@ -211,7 +211,7 @@ const char *SPMySQLSSLPermissibleCiphers = "DHE-RSA-AES256-SHA:AES256-SHA:DHE-RS
[self _cancelKeepAlives];
// Disconnect if appropriate (which should also disconnect any proxy)
- [self disconnect];
+ [self _disconnect];
// Clean up the connection proxy, if any
if (proxy) {
@@ -638,7 +638,7 @@ const char *SPMySQLSSLPermissibleCiphers = "DHE-RSA-AES256-SHA:AES256-SHA:DHE-RS
if (proxy) proxyStateChangeNotificationsIgnored = YES;
// Close the connection if it's active
- [self disconnect];
+ [self _disconnect];
// Lock the connection while waiting for network and proxy
[self _lockConnection];
diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLFastStreamingResult.m b/Frameworks/SPMySQLFramework/Source/SPMySQLFastStreamingResult.m
index 1fa4b829..064494f3 100644
--- a/Frameworks/SPMySQLFramework/Source/SPMySQLFastStreamingResult.m
+++ b/Frameworks/SPMySQLFramework/Source/SPMySQLFastStreamingResult.m
@@ -336,6 +336,8 @@ typedef struct st_spmysqlstreamingrowdata {
NSUInteger i, dataCopiedLength, rowDataLength;
SPMySQLStreamingRowData *newRowStore;
+ [[NSThread currentThread] setName:@"SPMySQLFastStreamingResult data download thread"];
+
size_t sizeOfStreamingRowData = sizeof(SPMySQLStreamingRowData);
size_t sizeOfDataLengths = (size_t)(sizeof(unsigned long) * numberOfFields);
size_t sizeOfChar = sizeof(char);