James Thrasher

Make persistent connection timeout configurable and default to 60s

... ... @@ -342,6 +342,10 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount;
// Persistent connections only work when the server sends a 'Keep-Alive' header
// Default is YES
BOOL shouldAttemptPersistentConnection;
// Number of seconds to keep an inactive persistent connection open on the client side
// Default is 60
NSTimeInterval persistentConnectionTimeout;
// Set to yes when an appropriate keep-alive header is found
BOOL connectionCanBeReused;
... ... @@ -716,6 +720,7 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount;
@property (assign) int numberOfTimesToRetryOnTimeout;
@property (assign, readonly) int retryCount;
@property (assign) BOOL shouldAttemptPersistentConnection;
@property (assign) NSTimeInterval persistentConnectionTimeout;
@property (assign) BOOL shouldUseRFC2616RedirectBehaviour;
@property (assign, readonly) BOOL connectionCanBeReused;
@end
... ...
... ... @@ -223,6 +223,7 @@ static BOOL isiPhoneOS2;
[self setRequestMethod:@"GET"];
[self setShouldAttemptPersistentConnection:YES];
[self setPersistentConnectionTimeout:60.0];
[self setShouldPresentCredentialsBeforeChallenge:YES];
[self setShouldRedirect:YES];
[self setShowAccurateProgress:YES];
... ... @@ -1805,7 +1806,10 @@ static BOOL isiPhoneOS2;
// Otherwise, we'll assume we can keep this connection open
} else {
[self setConnectionCanBeReused:YES];
closeStreamTime = 60;
closeStreamTime = [self persistentConnectionTimeout];
#if DEBUG_PERSISTENT_CONNECTIONS
NSLog(@"Set connection to close after %f seconds", closeStreamTime);
#endif
}
}
}
... ... @@ -3748,6 +3752,7 @@ static BOOL isiPhoneOS2;
@synthesize numberOfTimesToRetryOnTimeout;
@synthesize retryCount;
@synthesize shouldAttemptPersistentConnection;
@synthesize persistentConnectionTimeout;
@synthesize connectionCanBeReused;
@synthesize connectionInfo;
@synthesize readStream;
... ...