aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-01-24 21:02:18 +0000
committerrowanbeentje <rowan@beent.je>2010-01-24 21:02:18 +0000
commit9997d982ca4fcbacb04b41c7f7e2aa7dd44db312 (patch)
tree8672ff610b9b932d4f5c59a8223e2033ac95e3b5 /Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
parent127df973e23e7843320e470aad166ea587ab92eb (diff)
downloadsequelpro-9997d982ca4fcbacb04b41c7f7e2aa7dd44db312.tar.gz
sequelpro-9997d982ca4fcbacb04b41c7f7e2aa7dd44db312.tar.bz2
sequelpro-9997d982ca4fcbacb04b41c7f7e2aa7dd44db312.zip
Improve Disconnection on connection loss:
- Set error strings on MCPConnection on user disconnect to allow existing error chcking to catch the state - Improve close behaviour from threads - Improve window close behaviour and appearance - Add new checks for disconnection in one or two crash-prone locations This addresses Issue #531, one of Issue #532, one of Issue #539, and probable reported crashes on Issue #541.
Diffstat (limited to 'Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m')
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m7
1 files changed, 6 insertions, 1 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
index cda82647..7a3c9c8c 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
@@ -341,6 +341,7 @@ static BOOL sTruncateLongFieldInLogs = YES;
mConnected = YES;
connectionStartTime = mach_absolute_time();
mEncoding = [MCPConnection encodingForMySQLEncoding:mysql_character_set_name(mConnection)];
+ [self setLastErrorMessage:nil];
connectionThreadId = mConnection->thread_id;
[self timeZone]; // Getting the timezone used by the server.
@@ -536,8 +537,12 @@ static BOOL sTruncateLongFieldInLogs = YES;
return [self checkConnection];
- // 'Disconnect' has been selected. Close the parent window, which will handle disconnections, and return false.
+ // 'Disconnect' has been selected. The parent window should already have
+ // triggered UI-specific actions, and may have disconnected already; if
+ // not, disconnect, and clean up.
case MCPConnectionCheckDisconnect:
+ if (mConnected) [self disconnect];
+ [self setLastErrorMessage:NSLocalizedString(@"User triggered disconnection", @"User triggered disconnection")];
return NO;
// 'Retry' has been selected - return a recursive call.