mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-23 20:31:13 +08:00
Fix for inappropriate suspension of the main queue when using an IP address instead of a hostname.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user