Skip non-AFHTTPRequestOperations in AFHTTPClient -cancelAllHTTPOperationsWithMethod

This commit is contained in:
Mattt Thompson 2012-03-01 09:09:17 -08:00
parent f489189a76
commit cac44aeb34

View file

@ -416,8 +416,12 @@ static void AFReachabilityCallback(SCNetworkReachabilityRef __unused target, SCN
}
- (void)cancelAllHTTPOperationsWithMethod:(NSString *)method path:(NSString *)path {
for (AFHTTPRequestOperation *operation in [self.operationQueue operations]) {
if ((!method || [method isEqualToString:[[operation request] HTTPMethod]]) && [path isEqualToString:[[[operation request] URL] path]]) {
for (NSOperation *operation in [self.operationQueue operations]) {
if (![operation isKindOfClass:[AFHTTPRequestOperation class]]) {
continue;
}
if ((!method || [method isEqualToString:[[(AFHTTPRequestOperation *)operation request] HTTPMethod]]) && [path isEqualToString:[[[(AFHTTPRequestOperation *)operation request] URL] path]]) {
[operation cancel];
}
}