aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-10-05 00:20:08 +0000
committerrowanbeentje <rowan@beent.je>2009-10-05 00:20:08 +0000
commit581e50a3637f5eb017661b2edca4e91f9ba7591b (patch)
tree2e4f6670cdbb6f31dbe03bb71673c7da18b945db /Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h
parent387ad15e48924129c0779860bc2cac005d18bbc1 (diff)
downloadsequelpro-581e50a3637f5eb017661b2edca4e91f9ba7591b.tar.gz
sequelpro-581e50a3637f5eb017661b2edca4e91f9ba7591b.tar.bz2
sequelpro-581e50a3637f5eb017661b2edca4e91f9ba7591b.zip
- Rewrite keepalive pings to be performed within pthreads, enforcing ping timeouts and thus avoiding problems with network connections dropping and mysql_ping sticking and crashing as more keepalive pings kick in. This should address Issue #298.
Diffstat (limited to 'Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h')
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h
index edb71ee4..8a9e2567 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h
@@ -31,6 +31,7 @@
#import "MCPConstants.h"
#import "mysql.h"
+#include <pthread.h>
enum
{
@@ -105,7 +106,7 @@ static inline NSData* NSStringDataUsingLossyEncoding(NSString* self, NSInteger e
NSString *serverVersionString;
NSTimer *keepAliveTimer;
- NSDate *lastKeepAliveSuccess;
+ pthread_t keepAliveThread;
uint64_t connectionStartTime;
BOOL retryAllowed;
@@ -116,14 +117,14 @@ static inline NSData* NSStringDataUsingLossyEncoding(NSString* self, NSInteger e
IMP cStringPtr;
IMP willQueryStringPtr;
IMP stopKeepAliveTimerPtr;
- IMP startKeepAliveTimerResettingStatePtr;
+ IMP startKeepAliveTimerPtr;
IMP timeConnectedPtr;
// Selectors
SEL cStringSEL;
SEL willQueryStringSEL;
SEL stopKeepAliveTimerSEL;
- SEL startKeepAliveTimerResettingStateSEL;
+ SEL startKeepAliveTimerSEL;
SEL timeConnectedSEL;
}
@@ -155,10 +156,11 @@ static inline NSData* NSStringDataUsingLossyEncoding(NSString* self, NSInteger e
- (BOOL)isConnected;
- (BOOL)checkConnection;
- (BOOL)pingConnection;
-- (void)startKeepAliveTimerResettingState:(BOOL)resetState;
+- (void)startKeepAliveTimer;
- (void)stopKeepAliveTimer;
- (void)keepAlive:(NSTimer *)theTimer;
- (void)threadedKeepAlive;
+void performThreadedKeepAlive(void *ptr);
- (void)restoreConnectionDetails;
- (void)setAllowQueryRetries:(BOOL)allow;
- (double)timeConnected;