aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2009-08-28 18:27:36 +0000
committerstuconnolly <stuart02@gmail.com>2009-08-28 18:27:36 +0000
commitaea8e96f2adc91b64e7c521f34890e93f27da36c (patch)
treecfdaf58dfe18e46c890023cbe53f17231097beb5 /Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
parent480e035307bfc2dfa5feee16dacd43150b520d6a (diff)
downloadsequelpro-aea8e96f2adc91b64e7c521f34890e93f27da36c.tar.gz
sequelpro-aea8e96f2adc91b64e7c521f34890e93f27da36c.tar.bz2
sequelpro-aea8e96f2adc91b64e7c521f34890e93f27da36c.zip
If the SSH tunnel is unable to bind to the local port because there is already an existing tunnel, give the user the option of using a standard connection to localhost on the port that is in use in order to use the existing tunnel. Fixes issue #371.
Diffstat (limited to 'Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m')
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m21
1 files changed, 10 insertions, 11 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
index 06a8a757..fd2d6444 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
@@ -192,8 +192,7 @@ static BOOL sTruncateLongFieldInLogs = YES;
{
delegate = connectionDelegate;
- // Check that the delegate implements willQueryString:connection: and cache the result as its used
- // vert frequently.
+ // Check that the delegate implements willQueryString:connection: and cache the result as its used very frequently.
delegateResponseToWillQueryString = [delegate respondsToSelector:@selector(willQueryString:connection:)];
}
@@ -273,11 +272,11 @@ static BOOL sTruncateLongFieldInLogs = YES;
*/
- (BOOL)connect
{
- const char *theLogin = [self cStringFromString:connectionLogin];
- const char *theHost;
- const char *thePass;
- const char *theSocket;
- void *theRet;
+ const char *theLogin = [self cStringFromString:connectionLogin];
+ const char *theHost;
+ const char *thePass;
+ const char *theSocket;
+ void *theRet;
// Disconnect if a connection is already active
if (mConnected) {
@@ -301,8 +300,6 @@ static BOOL sTruncateLongFieldInLogs = YES;
// Set the host as appropriate
if (!connectionHost || ![connectionHost length]) {
theHost = NULL;
-
-
} else {
theHost = [self cStringFromString:connectionHost];
}
@@ -559,7 +556,7 @@ static BOOL sTruncateLongFieldInLogs = YES;
* ping, but cause long queries to be terminated.
* Unlike mysql_ping, this function returns FALSE on failure and TRUE on success.
*/
-- (BOOL) pingConnection
+- (BOOL)pingConnection
{
struct sigaction timeoutAction;
NSDate *startDate = [[NSDate alloc] initWithTimeIntervalSinceNow:0];
@@ -1531,7 +1528,7 @@ static void forcePingTimeout(NSInteger signalNumber)
const char *theCDBsName = (const char *)[self cStringFromString:dbsName];
if (theResPtr = mysql_list_dbs(mConnection, theCDBsName)) {
- [theResult initWithResPtr: theResPtr encoding: mEncoding timeZone:mTimeZone];
+ [theResult initWithResPtr:theResPtr encoding:mEncoding timeZone:mTimeZone];
}
else {
[theResult init];
@@ -1593,11 +1590,13 @@ static void forcePingTimeout(NSInteger signalNumber)
[theResult init];
}
}
+
[queryLock unlock];
if (theResult) {
[theResult autorelease];
}
+
return theResult;
}