Merge branch 'experimental-issue-738'
Conflicts: AFNetworking/AFURLConnectionOperation.m
This commit is contained in:
commit
2c55ad7abc
1 changed files with 25 additions and 23 deletions
|
|
@ -325,8 +325,11 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setState:(AFOperationState)state {
|
- (void)setState:(AFOperationState)state {
|
||||||
|
if (!AFStateTransitionIsValid(self.state, state, [self isCancelled])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
[self.lock lock];
|
[self.lock lock];
|
||||||
if (AFStateTransitionIsValid(self.state, state, [self isCancelled])) {
|
|
||||||
NSString *oldStateKey = AFKeyPathFromOperationState(self.state);
|
NSString *oldStateKey = AFKeyPathFromOperationState(self.state);
|
||||||
NSString *newStateKey = AFKeyPathFromOperationState(state);
|
NSString *newStateKey = AFKeyPathFromOperationState(state);
|
||||||
|
|
||||||
|
|
@ -335,6 +338,7 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
|
||||||
_state = state;
|
_state = state;
|
||||||
[self didChangeValueForKey:oldStateKey];
|
[self didChangeValueForKey:oldStateKey];
|
||||||
[self didChangeValueForKey:newStateKey];
|
[self didChangeValueForKey:newStateKey];
|
||||||
|
[self.lock unlock];
|
||||||
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
switch (state) {
|
switch (state) {
|
||||||
|
|
@ -349,8 +353,6 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
[self.lock unlock];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSString *)responseString {
|
- (NSString *)responseString {
|
||||||
[self.lock lock];
|
[self.lock lock];
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue