aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/MCPKit
diff options
context:
space:
mode:
Diffstat (limited to 'Frameworks/MCPKit')
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h2
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m13
2 files changed, 15 insertions, 0 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h
index 66f76083..adcecb05 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h
@@ -141,6 +141,7 @@
BOOL useKeepAlive;
BOOL isDisconnecting;
+ BOOL userTriggeredDisconnect;
NSInteger connectionTimeout;
CGFloat keepAliveInterval;
@@ -227,6 +228,7 @@
- (void)disconnect;
- (BOOL)reconnect;
- (BOOL)isConnected;
+- (BOOL)userTriggeredDisconnect;
- (BOOL)checkConnection;
- (BOOL)pingConnection;
void pingConnectionTask(void *ptr);
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
index 143152d2..56073806 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
@@ -118,6 +118,7 @@ static BOOL sTruncateLongFieldInLogs = YES;
serverVersionString = nil;
mTimeZone = nil;
isDisconnecting = NO;
+ userTriggeredDisconnect = NO;
automaticReconnectAttempts = 0;
pingFailureCount = 0;
@@ -395,6 +396,7 @@ static BOOL sTruncateLongFieldInLogs = YES;
}
mConnected = YES;
+ userTriggeredDisconnect = NO;
connectionStartTime = mach_absolute_time();
lastKeepAliveTime = 0;
automaticReconnectAttempts = 0;
@@ -598,6 +600,7 @@ static BOOL sTruncateLongFieldInLogs = YES;
switch (failureDecision) {
case MCPConnectionCheckDisconnect:
[self setLastErrorMessage:NSLocalizedString(@"User triggered disconnection", @"User triggered disconnection")];
+ userTriggeredDisconnect = YES;
[reconnectionPool release];
return NO;
default:
@@ -619,6 +622,15 @@ static BOOL sTruncateLongFieldInLogs = YES;
}
/**
+ * Returns YES if the user chose to disconnect at the last "connection failure"
+ * prompt, NO otherwise.
+ */
+- (BOOL)userTriggeredDisconnect
+{
+ return userTriggeredDisconnect;
+}
+
+/**
* Checks if the connection to the server is still on.
* If not, tries to reconnect (changing no parameters from the MYSQL pointer).
* This method just uses mysql_ping().
@@ -670,6 +682,7 @@ static BOOL sTruncateLongFieldInLogs = YES;
case MCPConnectionCheckDisconnect:
if (mConnected) [self disconnect];
[self setLastErrorMessage:NSLocalizedString(@"User triggered disconnection", @"User triggered disconnection")];
+ userTriggeredDisconnect = YES;
return NO;
// 'Retry' has been selected - return a recursive call.