Fix for inappropriate suspension of the main queue when using an IP address instead of a hostname.

This commit is contained in:
Blake Watters
2011-07-05 16:22:12 -04:00
parent 1014656328
commit 348e86cbc8
5 changed files with 22 additions and 5 deletions

View File

@@ -225,7 +225,7 @@ NSString* RKPathAppendQueryParams(NSString* resourcePath, NSDictionary* queryPar
_baseURLReachabilityObserver = [[RKReachabilityObserver alloc] initWithHostname:[URL host]];
// Suspend the queue until reachability to our new hostname is established
[RKRequestQueue sharedQueue].suspended = YES;
[RKRequestQueue sharedQueue].suspended = !_baseURLReachabilityObserver.reachabilityEstablished;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(reachabilityWasDetermined:)
name:RKReachabilityStateWasDeterminedNotification

View File

@@ -40,6 +40,11 @@ typedef enum {
*/
@property (nonatomic, readonly) NSString* hostName;
/**
Returns YES if reachability has been determined
*/
@property (nonatomic, readonly) BOOL reachabilityEstablished;
/**
* Create a new reachability observer against a given hostname. The observer
* will monitor the ability to reach the specified hostname and emit notifications

View File

@@ -45,7 +45,6 @@ static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReach
if (!observer.reachabilityEstablished) {
RKLogInfo(@"Network availability has been determined for reachability observer %@", observer);
observer.reachabilityEstablished = YES;
[[NSNotificationCenter defaultCenter] postNotificationName:RKReachabilityStateWasDeterminedNotification object:observer];
}
// Post a notification to notify the client that the network reachability changed.
@@ -223,7 +222,8 @@ static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReach
}
- (void)setReachabilityEstablished:(BOOL)reachabilityEstablished {
_reachabilityEstablished = reachabilityEstablished;
_reachabilityEstablished = reachabilityEstablished;
[[NSNotificationCenter defaultCenter] postNotificationName:RKReachabilityStateWasDeterminedNotification object:self];
}
@end