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 @@ @@ -34,7 +34,7 @@
34 @interface RMAbstractWebMapSource : RMAbstractMercatorTileSource 34 @interface RMAbstractWebMapSource : RMAbstractMercatorTileSource
35 35
36 @property (nonatomic, assign) NSUInteger retryCount; 36 @property (nonatomic, assign) NSUInteger retryCount;
37 -@property (nonatomic, assign) NSTimeInterval waitSeconds; 37 +@property (nonatomic, assign) NSTimeInterval requestTimeoutSeconds;
38 38
39 - (NSURL *)URLForTile:(RMTile)tile; 39 - (NSURL *)URLForTile:(RMTile)tile;
40 40
@@ -32,7 +32,7 @@ @@ -32,7 +32,7 @@
32 32
33 @implementation RMAbstractWebMapSource 33 @implementation RMAbstractWebMapSource
34 34
35 -@synthesize retryCount, waitSeconds; 35 +@synthesize retryCount, requestTimeoutSeconds;
36 36
37 - (id)init 37 - (id)init
38 { 38 {
@@ -40,7 +40,7 @@ @@ -40,7 +40,7 @@
40 return nil; 40 return nil;
41 41
42 self.retryCount = RMAbstractWebMapSourceDefaultRetryCount; 42 self.retryCount = RMAbstractWebMapSourceDefaultRetryCount;
43 - self.waitSeconds = RMAbstractWebMapSourceDefaultWaitSeconds; 43 + self.requestTimeoutSeconds = RMAbstractWebMapSourceDefaultWaitSeconds;
44 44
45 return self; 45 return self;
46 } 46 }
@@ -98,7 +98,7 @@ @@ -98,7 +98,7 @@
98 for (NSUInteger try = 0; tileData == nil && try < self.retryCount; ++try) 98 for (NSUInteger try = 0; tileData == nil && try < self.retryCount; ++try)
99 { 99 {
100 NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:currentURL]; 100 NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:currentURL];
101 - [request setTimeoutInterval:(self.waitSeconds / (CGFloat)self.retryCount)]; 101 + [request setTimeoutInterval:(self.requestTimeoutSeconds / (CGFloat)self.retryCount)];
102 tileData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]; 102 tileData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
103 } 103 }
104 104
@@ -116,7 +116,7 @@ @@ -116,7 +116,7 @@
116 116
117 // wait for whole group of fetches (with retries) to finish, then clean up 117 // wait for whole group of fetches (with retries) to finish, then clean up
118 // 118 //
119 - dispatch_group_wait(fetchGroup, dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * self.waitSeconds)); 119 + dispatch_group_wait(fetchGroup, dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * self.requestTimeoutSeconds));
120 dispatch_release(fetchGroup); 120 dispatch_release(fetchGroup);
121 121
122 // composite the collected images together 122 // composite the collected images together
@@ -147,7 +147,7 @@ @@ -147,7 +147,7 @@
147 { 147 {
148 NSHTTPURLResponse *response = nil; 148 NSHTTPURLResponse *response = nil;
149 NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[URLs objectAtIndex:0]]; 149 NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[URLs objectAtIndex:0]];
150 - [request setTimeoutInterval:self.waitSeconds]; 150 + [request setTimeoutInterval:(self.requestTimeoutSeconds / (CGFloat)self.retryCount)];
151 image = [UIImage imageWithData:[NSURLConnection sendSynchronousRequest:request returningResponse:&response error:nil]]; 151 image = [UIImage imageWithData:[NSURLConnection sendSynchronousRequest:request returningResponse:&response error:nil]];
152 152
153 if (response.statusCode == HTTP_404_NOT_FOUND) 153 if (response.statusCode == HTTP_404_NOT_FOUND)