From 581e50a3637f5eb017661b2edca4e91f9ba7591b Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Mon, 5 Oct 2009 00:20:08 +0000 Subject: - 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. --- Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h') 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 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; -- cgit v1.2.3