diff options
author | rowanbeentje <rowan@beent.je> | 2010-09-25 00:59:36 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2010-09-25 00:59:36 +0000 |
commit | 23ff1e6015d06e3158c20a5a9a191dced2bc33d5 (patch) | |
tree | 48c77c1ae506d318a02a14a2acb0b9314231284f /Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h | |
parent | c5b9f95e0ba0cb0ef7bfa045b3e1a771674f01c1 (diff) | |
download | sequelpro-23ff1e6015d06e3158c20a5a9a191dced2bc33d5.tar.gz sequelpro-23ff1e6015d06e3158c20a5a9a191dced2bc33d5.tar.bz2 sequelpro-23ff1e6015d06e3158c20a5a9a191dced2bc33d5.zip |
Consolidate and improve ping code:
- Foreground and keepalive pings now use the same code, which has been tidied and improved
- Global variables are no longer incorrectly shared across multiple instances
- If a ping thread blocks in a state where pthread_cancel no longer functions, the connection is assumed to have failed (network issues etc)
This should further improve MySQL crashes linked to pings, and will hopefully address Issue #830. Also update localizable strings
Diffstat (limited to 'Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h')
-rw-r--r-- | Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h index ef1da3df..609830ce 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h @@ -32,6 +32,12 @@ #import "MCPConstants.h" #import "mysql.h" +typedef struct { + MYSQL *mySQLConnection; + BOOL *pingActivePointer; + BOOL *lastPingSuccessPointer; +} MCPConnectionPingDetails; + @protocol MCPConnectionProxy; @class MCPResult, MCPStreamingResult; @@ -168,10 +174,13 @@ NSMutableDictionary *structure; NSMutableArray *allKeysofDbStructure; + pthread_t pingThread; + NSInteger pingFailureCount; + BOOL pingThreadActive; + BOOL lastPingSuccess; + BOOL lastPingBlocked; NSTimer *keepAliveTimer; double lastKeepAliveTime; - pthread_t keepAliveThread; - pthread_t pingThread; uint64_t connectionStartTime; BOOL retryAllowed; @@ -231,15 +240,18 @@ - (BOOL)isConnectedViaSSL; - (BOOL)userTriggeredDisconnect; - (BOOL)checkConnection; -- (BOOL)pingConnection; -void pingConnectionTask(void *ptr); -- (void)keepAlive:(NSTimer *)theTimer; -- (void)threadedKeepAlive; -void performThreadedKeepAlive(void *ptr); - (void)restoreConnectionDetails; - (void)setAllowQueryRetries:(BOOL)allow; - (double)timeConnected; +// Pinging and keepalive +- (BOOL)pingConnectionUsingLoopDelay:(NSUInteger)loopDelay; +void backgroundPingTask(void *ptr); +void forceThreadExit(int signalNumber); +void pingThreadCleanup(); +- (void)keepAlive:(NSTimer *)theTimer; +- (void)threadedKeepAlive; + // Server versions - (NSString *)serverVersionString; - (NSInteger)serverMajorVersion; |