Authored by Thomas Rasch

RMAbstractWebMapSource:

o Renamed waitSeconds to requestTimeoutSeconds
o Timeout for the non-threaded version is now self.waitSeconds / self.retryCount to be consistent with the GCD version
... ... @@ -34,7 +34,7 @@
@interface RMAbstractWebMapSource : RMAbstractMercatorTileSource
@property (nonatomic, assign) NSUInteger retryCount;
@property (nonatomic, assign) NSTimeInterval waitSeconds;
@property (nonatomic, assign) NSTimeInterval requestTimeoutSeconds;
- (NSURL *)URLForTile:(RMTile)tile;
... ...
... ... @@ -32,7 +32,7 @@
@implementation RMAbstractWebMapSource
@synthesize retryCount, waitSeconds;
@synthesize retryCount, requestTimeoutSeconds;
- (id)init
{
... ... @@ -40,7 +40,7 @@
return nil;
self.retryCount = RMAbstractWebMapSourceDefaultRetryCount;
self.waitSeconds = RMAbstractWebMapSourceDefaultWaitSeconds;
self.requestTimeoutSeconds = RMAbstractWebMapSourceDefaultWaitSeconds;
return self;
}
... ... @@ -98,7 +98,7 @@
for (NSUInteger try = 0; tileData == nil && try < self.retryCount; ++try)
{
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:currentURL];
[request setTimeoutInterval:(self.waitSeconds / (CGFloat)self.retryCount)];
[request setTimeoutInterval:(self.requestTimeoutSeconds / (CGFloat)self.retryCount)];
tileData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
}
... ... @@ -116,7 +116,7 @@
// wait for whole group of fetches (with retries) to finish, then clean up
//
dispatch_group_wait(fetchGroup, dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * self.waitSeconds));
dispatch_group_wait(fetchGroup, dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * self.requestTimeoutSeconds));
dispatch_release(fetchGroup);
// composite the collected images together
... ... @@ -147,7 +147,7 @@
{
NSHTTPURLResponse *response = nil;
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[URLs objectAtIndex:0]];
[request setTimeoutInterval:self.waitSeconds];
[request setTimeoutInterval:(self.requestTimeoutSeconds / (CGFloat)self.retryCount)];
image = [UIImage imageWithData:[NSURLConnection sendSynchronousRequest:request returningResponse:&response error:nil]];
if (response.statusCode == HTTP_404_NOT_FOUND)
... ...